drm/amd/display: add retimer log for HWQ tuning use.
authorCharlene Liu <charlene.liu@amd.com>
Wed, 1 Aug 2018 00:14:26 +0000 (20:14 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Aug 2018 16:10:15 +0000 (11:10 -0500)
Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/include/logger_types.h

index 567867915d32d84cb6bb68d3e4da33842de9b2e4..1adfcdd588d6c7c590ea65fcc67a06b067d55daf 100644 (file)
@@ -54,6 +54,9 @@
        DC_LOG_HW_HOTPLUG(  \
                __VA_ARGS__)
 
+#define RETIMER_REDRIVER_INFO(...) \
+       DC_LOG_RETIMER_REDRIVER(  \
+               __VA_ARGS__)
 /*******************************************************************************
  * Private structures
  ******************************************************************************/
@@ -1547,6 +1550,7 @@ static void write_i2c_retimer_setting(
        uint8_t value = 0;
        int i = 0;
        bool i2c_success = false;
+       DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
 
        memset(&buffer, 0, sizeof(buffer));
 
@@ -1560,6 +1564,9 @@ static void write_i2c_retimer_setting(
                        buffer[1] = settings->reg_settings[i].i2c_reg_val;
                        i2c_success = i2c_write(pipe_ctx, slave_address,
                                                buffer, sizeof(buffer));
+                       RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\
+                               offset = 0x%x, reg_val= 0x%x, i2c_success = %d\n",
+                               slave_address, buffer[0], buffer[1], i2c_success?1:0);
 
                        if (!i2c_success)
                                /* Write failure */
@@ -1590,6 +1597,9 @@ static void write_i2c_retimer_setting(
                                buffer[1] = value | apply_rx_tx_change;
                                i2c_success = i2c_write(pipe_ctx, slave_address,
                                                buffer, sizeof(buffer));
+                               RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\
+                                       offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+                                       slave_address, buffer[0], buffer[1], i2c_success?1:0);
                                if (!i2c_success)
                                        /* Write failure */
                                        ASSERT(i2c_success);
@@ -1607,6 +1617,9 @@ static void write_i2c_retimer_setting(
                                buffer[1] = settings->reg_settings_6g[i].i2c_reg_val;
                                i2c_success = i2c_write(pipe_ctx, slave_address,
                                                        buffer, sizeof(buffer));
+                               RETIMER_REDRIVER_INFO("above 340Mhz: retimer write to slave_address = 0x%x,\
+                                       offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+                                       slave_address, buffer[0], buffer[1], i2c_success?1:0);
 
                                if (!i2c_success)
                                        /* Write failure */
@@ -1637,6 +1650,9 @@ static void write_i2c_retimer_setting(
                                        buffer[1] = value | apply_rx_tx_change;
                                        i2c_success = i2c_write(pipe_ctx, slave_address,
                                                        buffer, sizeof(buffer));
+                                       RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\
+                                               offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+                                               slave_address, buffer[0], buffer[1], i2c_success?1:0);
                                        if (!i2c_success)
                                                /* Write failure */
                                                ASSERT(i2c_success);
@@ -1653,6 +1669,9 @@ static void write_i2c_retimer_setting(
                buffer[1] = 0x01;
                i2c_success = i2c_write(pipe_ctx, slave_address,
                                buffer, sizeof(buffer));
+               RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\
+                               offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+                               slave_address, buffer[0], buffer[1], i2c_success?1:0);
                if (!i2c_success)
                        /* Write failure */
                        ASSERT(i2c_success);
@@ -1662,6 +1681,9 @@ static void write_i2c_retimer_setting(
                buffer[1] = 0x23;
                i2c_success = i2c_write(pipe_ctx, slave_address,
                                buffer, sizeof(buffer));
+               RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\
+                       offset = 0x%d, reg_val = 0x%d, i2c_success = %d\n",
+                       slave_address, buffer[0], buffer[1], i2c_success?1:0);
                if (!i2c_success)
                        /* Write failure */
                        ASSERT(i2c_success);
@@ -1671,6 +1693,9 @@ static void write_i2c_retimer_setting(
                buffer[1] = 0x00;
                i2c_success = i2c_write(pipe_ctx, slave_address,
                                buffer, sizeof(buffer));
+               RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\
+                       offset = 0x%d, reg_val = 0x%d, i2c_success = %d\n",
+                       slave_address, buffer[0], buffer[1], i2c_success?1:0);
                if (!i2c_success)
                        /* Write failure */
                        ASSERT(i2c_success);
@@ -1686,6 +1711,7 @@ static void write_i2c_default_retimer_setting(
        uint8_t slave_address = (0xBA >> 1);
        uint8_t buffer[2];
        bool i2c_success = false;
+       DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
 
        memset(&buffer, 0, sizeof(buffer));
 
@@ -1695,6 +1721,9 @@ static void write_i2c_default_retimer_setting(
        buffer[1] = 0x13;
        i2c_success = i2c_write(pipe_ctx, slave_address,
                        buffer, sizeof(buffer));
+       RETIMER_REDRIVER_INFO("retimer writes default setting to slave_address = 0x%x,\
+               offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+               slave_address, buffer[0], buffer[1], i2c_success?1:0);
        if (!i2c_success)
                /* Write failure */
                ASSERT(i2c_success);
@@ -1704,6 +1733,9 @@ static void write_i2c_default_retimer_setting(
        buffer[1] = 0x17;
        i2c_success = i2c_write(pipe_ctx, slave_address,
                        buffer, sizeof(buffer));
+       RETIMER_REDRIVER_INFO("retimer write to slave_addr = 0x%x,\
+               offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+               slave_address, buffer[0], buffer[1], i2c_success?1:0);
        if (!i2c_success)
                /* Write failure */
                ASSERT(i2c_success);
@@ -1713,6 +1745,9 @@ static void write_i2c_default_retimer_setting(
        buffer[1] = is_over_340mhz ? 0xDA : 0xD8;
        i2c_success = i2c_write(pipe_ctx, slave_address,
                        buffer, sizeof(buffer));
+       RETIMER_REDRIVER_INFO("retimer write to slave_addr = 0x%x,\
+               offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+               slave_address, buffer[0], buffer[1], i2c_success?1:0);
        if (!i2c_success)
                /* Write failure */
                ASSERT(i2c_success);
@@ -1722,6 +1757,9 @@ static void write_i2c_default_retimer_setting(
        buffer[1] = 0x17;
        i2c_success = i2c_write(pipe_ctx, slave_address,
                        buffer, sizeof(buffer));
+       RETIMER_REDRIVER_INFO("retimer write to slave_addr = 0x%x,\
+               offset = 0x%x, reg_val= 0x%x, i2c_success = %d\n",
+               slave_address, buffer[0], buffer[1], i2c_success?1:0);
        if (!i2c_success)
                /* Write failure */
                ASSERT(i2c_success);
@@ -1731,6 +1769,9 @@ static void write_i2c_default_retimer_setting(
        buffer[1] = is_over_340mhz ? 0x1D : 0x91;
        i2c_success = i2c_write(pipe_ctx, slave_address,
                        buffer, sizeof(buffer));
+       RETIMER_REDRIVER_INFO("retimer write to slave_addr = 0x%x,\
+               offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+               slave_address, buffer[0], buffer[1], i2c_success?1:0);
        if (!i2c_success)
                /* Write failure */
                ASSERT(i2c_success);
@@ -1740,6 +1781,9 @@ static void write_i2c_default_retimer_setting(
        buffer[1] = 0x17;
        i2c_success = i2c_write(pipe_ctx, slave_address,
                        buffer, sizeof(buffer));
+       RETIMER_REDRIVER_INFO("retimer write to slave_addr = 0x%x,\
+               offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+               slave_address, buffer[0], buffer[1], i2c_success?1:0);
        if (!i2c_success)
                /* Write failure */
                ASSERT(i2c_success);
@@ -1753,6 +1797,9 @@ static void write_i2c_default_retimer_setting(
                buffer[1] = 0x01;
                i2c_success = i2c_write(pipe_ctx, slave_address,
                                buffer, sizeof(buffer));
+               RETIMER_REDRIVER_INFO("retimer write to slave_addr = 0x%x,\
+                       offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
+                       slave_address, buffer[0], buffer[1], i2c_success?1:0);
                if (!i2c_success)
                        /* Write failure */
                        ASSERT(i2c_success);
@@ -1762,6 +1809,9 @@ static void write_i2c_default_retimer_setting(
                buffer[1] = 0x23;
                i2c_success = i2c_write(pipe_ctx, slave_address,
                                buffer, sizeof(buffer));
+               RETIMER_REDRIVER_INFO("retimer write to slave_addr = 0x%x,\
+                       offset = 0x%x, reg_val= 0x%x, i2c_success = %d\n",
+                       slave_address, buffer[0], buffer[1], i2c_success?1:0);
                if (!i2c_success)
                        /* Write failure */
                        ASSERT(i2c_success);
@@ -1771,6 +1821,9 @@ static void write_i2c_default_retimer_setting(
                buffer[1] = 0x00;
                i2c_success = i2c_write(pipe_ctx, slave_address,
                                buffer, sizeof(buffer));
+               RETIMER_REDRIVER_INFO("retimer write default setting to slave_addr = 0x%x,\
+                       offset = 0x%x, reg_val= 0x%x, i2c_success = %d end here\n",
+                       slave_address, buffer[0], buffer[1], i2c_success?1:0);
                if (!i2c_success)
                        /* Write failure */
                        ASSERT(i2c_success);
@@ -1784,6 +1837,7 @@ static void write_i2c_redriver_setting(
        uint8_t slave_address = (0xF0 >> 1);
        uint8_t buffer[16];
        bool i2c_success = false;
+       DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
 
        memset(&buffer, 0, sizeof(buffer));
 
@@ -1795,6 +1849,11 @@ static void write_i2c_redriver_setting(
 
        i2c_success = i2c_write(pipe_ctx, slave_address,
                                        buffer, sizeof(buffer));
+       RETIMER_REDRIVER_INFO("redriver write 0 to all 16 reg offset expect following:\n\
+               \t slave_addr = 0x%x, offset[3] = 0x%x, offset[4] = 0x%x,\
+               offset[5] = 0x%x,offset[6] is_over_340mhz = 0x%x,\
+               i2c_success = %d\n",
+               slave_address, buffer[3], buffer[4], buffer[5], buffer[6], i2c_success?1:0);
 
        if (!i2c_success)
                /* Write failure */
index ad3695e67b76feb866c0132e043c70b8a0b294cb..bc57326680923c53b1dda7d1fc6a4dca4d3856d8 100644 (file)
@@ -62,6 +62,7 @@
 #define DC_LOG_EVENT_UNDERFLOW(...) DRM_DEBUG_KMS(__VA_ARGS__)
 #define DC_LOG_IF_TRACE(...) pr_debug("[IF_TRACE]:"__VA_ARGS__)
 #define DC_LOG_PERF_TRACE(...) DRM_DEBUG_KMS(__VA_ARGS__)
+#define DC_LOG_RETIMER_REDRIVER(...) DRM_DEBUG_KMS(__VA_ARGS__)
 
 struct dal_logger;
 
@@ -99,7 +100,7 @@ enum dc_log_type {
        LOG_IF_TRACE,
        LOG_PERF_TRACE,
        LOG_DISPLAYSTATS,
-
+       LOG_HDMI_RETIMER_REDRIVER,
        LOG_SECTION_TOTAL_COUNT
 };