#include <drm/drm_framebuffer.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_atomic.h>
+#include "dcn10/dcn10_optc.h"
 
 #include "dc/inc/core_types.h"
 
            )
 );
 
+TRACE_EVENT(dcn_optc_lock_unlock_state,
+           TP_PROTO(const struct optc *optc_state, int instance, bool lock, const char *function, const int line),
+           TP_ARGS(optc_state, instance, lock, function, line),
+
+           TP_STRUCT__entry(
+                            __field(const char *, function)
+                            __field(int, instance)
+                            __field(bool, lock)
+                            __field(int, line)
+                            __field(int, opp_count)
+                            __field(int, max_h_total)
+                            __field(int, max_v_total)
+                            __field(int, min_h_blank)
+                            __field(int, min_h_sync_width)
+                            __field(int, min_v_sync_width)
+                            __field(int, min_v_blank)
+                            __field(int, min_v_blank_interlace)
+                            __field(int, vstartup_start)
+                            __field(int, vupdate_offset)
+                            __field(int, vupdate_width)
+                            __field(int, vready_offset)
+           ),
+           TP_fast_assign(
+                          __entry->function = function;
+                          __entry->instance = instance;
+                          __entry->lock = lock;
+                          __entry->line = line;
+                          __entry->opp_count = optc_state->opp_count;
+                          __entry->max_h_total = optc_state->max_h_total;
+                          __entry->max_v_total = optc_state->max_v_total;
+                          __entry->min_h_blank = optc_state->min_h_blank;
+                          __entry->min_h_sync_width = optc_state->min_h_sync_width;
+                          __entry->min_v_sync_width = optc_state->min_v_sync_width;
+                          __entry->min_v_blank = optc_state->min_v_blank;
+                          __entry->min_v_blank_interlace = optc_state->min_v_blank_interlace;
+                          __entry->vstartup_start = optc_state->vstartup_start;
+                          __entry->vupdate_offset = optc_state->vupdate_offset;
+                          __entry->vupdate_width = optc_state->vupdate_width;
+                          __entry->vready_offset = optc_state->vupdate_offset;
+           ),
+           TP_printk("%s: %s()+%d: optc_instance=%d opp_count=%d max_h_total=%d max_v_total=%d "
+                     "min_h_blank=%d min_h_sync_width=%d min_v_sync_width=%d min_v_blank=%d "
+                     "min_v_blank_interlace=%d vstartup_start=%d vupdate_offset=%d vupdate_width=%d "
+                     "vready_offset=%d",
+                     __entry->lock ? "Lock" : "Unlock",
+                     __entry->function,
+                     __entry->line,
+                     __entry->instance,
+                     __entry->opp_count,
+                     __entry->max_h_total,
+                     __entry->max_v_total,
+                     __entry->min_h_blank,
+                     __entry->min_h_sync_width,
+                     __entry->min_v_sync_width,
+                     __entry->min_v_blank,
+                     __entry->min_v_blank_interlace,
+                     __entry->vstartup_start,
+                     __entry->vupdate_offset,
+                     __entry->vupdate_width,
+                     __entry->vready_offset
+           )
+);
+
 #endif /* _AMDGPU_DM_TRACE_H_ */
 
 #undef TRACE_INCLUDE_PATH
 
 #include "dc_dmub_srv.h"
 
 #include "dml/dcn30/dcn30_fpu.h"
+#include "dc_trace.h"
 
 #define REG(reg)\
        optc1->tg_regs->reg
                REG_WAIT(OTG_MASTER_UPDATE_LOCK,
                                UPDATE_LOCK_STATUS, 1,
                                1, 10);
+
+       TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true);
 }
 
 void optc3_lock_doublebuffer_enable(struct timing_generator *optc)
                MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_START_OFFSET, 0,
                MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_END_OFFSET, 100,
                OTG_MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_EN, 1);
+
+       TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true);
 }
 
 void optc3_lock_doublebuffer_disable(struct timing_generator *optc)
 
        REG_UPDATE(OTG_GLOBAL_CONTROL2, GLOBAL_UPDATE_LOCK_EN, 0);
        REG_UPDATE(OTG_GLOBAL_CONTROL0, MASTER_UPDATE_LOCK_DB_EN, 0);
+
+       TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true);
 }
 
 void optc3_lock(struct timing_generator *optc)
        REG_WAIT(OTG_MASTER_UPDATE_LOCK,
                        UPDATE_LOCK_STATUS, 1,
                        1, 10);
+
+       TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true);
 }
 
 void optc3_set_out_mux(struct timing_generator *optc, enum otg_out_mux_dest dest)