drm/msm/dp: add connector type to enhance debug messages
authorKuogee Hsieh <quic_khsieh@quicinc.com>
Wed, 2 Feb 2022 18:56:37 +0000 (10:56 -0800)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 18 Feb 2022 15:32:58 +0000 (18:32 +0300)
DP driver is a generic driver which supports both eDP and DP.
For debugging purpose it is required to have capabilities to
differentiate message are generated from eDP or DP. This patch
add connector type into debug messages for this purpose.

Changes in v3:
-- replace original patch into 3 patches

Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/1643828199-8564-2-git-send-email-quic_khsieh@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/dp/dp_display.c

index 44d42c7..536445b 100644 (file)
@@ -394,8 +394,9 @@ end:
 
 static void dp_display_host_phy_init(struct dp_display_private *dp)
 {
-       DRM_DEBUG_DP("core_init=%d phy_init=%d\n",
-                       dp->core_initialized, dp->phy_initialized);
+       DRM_DEBUG_DP("type=%d core_init=%d phy_init=%d\n",
+               dp->dp_display.connector_type, dp->core_initialized,
+               dp->phy_initialized);
 
        if (!dp->phy_initialized) {
                dp_ctrl_phy_init(dp->ctrl);
@@ -405,8 +406,9 @@ static void dp_display_host_phy_init(struct dp_display_private *dp)
 
 static void dp_display_host_phy_exit(struct dp_display_private *dp)
 {
-       DRM_DEBUG_DP("core_init=%d phy_init=%d\n",
-                       dp->core_initialized, dp->phy_initialized);
+       DRM_DEBUG_DP("type=%d core_init=%d phy_init=%d\n",
+               dp->dp_display.connector_type, dp->core_initialized,
+               dp->phy_initialized);
 
        if (dp->phy_initialized) {
                dp_ctrl_phy_exit(dp->ctrl);
@@ -416,7 +418,9 @@ static void dp_display_host_phy_exit(struct dp_display_private *dp)
 
 static void dp_display_host_init(struct dp_display_private *dp)
 {
-       DRM_DEBUG_DP("core_initialized=%d\n", dp->core_initialized);
+       DRM_DEBUG_DP("type=%d core_init=%d phy_init=%d\n",
+               dp->dp_display.connector_type, dp->core_initialized,
+               dp->phy_initialized);
 
        dp_power_init(dp->power, false);
        dp_ctrl_reset_irq_ctrl(dp->ctrl, true);
@@ -426,7 +430,9 @@ static void dp_display_host_init(struct dp_display_private *dp)
 
 static void dp_display_host_deinit(struct dp_display_private *dp)
 {
-       DRM_DEBUG_DP("core_initialized=%d\n", dp->core_initialized);
+       DRM_DEBUG_DP("type=%d core_init=%d phy_init=%d\n",
+               dp->dp_display.connector_type, dp->core_initialized,
+               dp->phy_initialized);
 
        dp_ctrl_reset_irq_ctrl(dp->ctrl, false);
        dp_aux_deinit(dp->aux);
@@ -536,7 +542,9 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)
        mutex_lock(&dp->event_mutex);
 
        state =  dp->hpd_state;
-       DRM_DEBUG_DP("hpd_state=%d\n", state);
+       DRM_DEBUG_DP("Before, type=%d hpd_state=%d\n",
+                       dp->dp_display.connector_type, state);
+
        if (state == ST_DISPLAY_OFF || state == ST_SUSPENDED) {
                mutex_unlock(&dp->event_mutex);
                return 0;
@@ -568,6 +576,8 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)
        dp_catalog_hpd_config_intr(dp->catalog,
                DP_DP_IRQ_HPD_INT_MASK | DP_DP_HPD_REPLUG_INT_MASK, true);
 
+       DRM_DEBUG_DP("After, type=%d hpd_state=%d\n",
+                       dp->dp_display.connector_type, state);
        mutex_unlock(&dp->event_mutex);
 
        /* uevent will complete connection part */
@@ -584,8 +594,10 @@ static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data)
        mutex_lock(&dp->event_mutex);
 
        state = dp->hpd_state;
-       if (state == ST_CONNECT_PENDING)
+       if (state == ST_CONNECT_PENDING) {
                dp->hpd_state = ST_CONNECTED;
+               DRM_DEBUG_DP("type=%d\n", dp->dp_display.connector_type);
+       }
 
        mutex_unlock(&dp->event_mutex);
 
@@ -618,6 +630,9 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
 
        state = dp->hpd_state;
 
+       DRM_DEBUG_DP("Before, type=%d hpd_state=%d\n",
+                       dp->dp_display.connector_type, state);
+
        /* disable irq_hpd/replug interrupts */
        dp_catalog_hpd_config_intr(dp->catalog,
                DP_DP_IRQ_HPD_INT_MASK | DP_DP_HPD_REPLUG_INT_MASK, false);
@@ -660,13 +675,15 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
        /* start sentinel checking in case of missing uevent */
        dp_add_event(dp, EV_DISCONNECT_PENDING_TIMEOUT, 0, DP_TIMEOUT_5_SECOND);
 
-       DRM_DEBUG_DP("hpd_state=%d\n", state);
        /* signal the disconnect event early to ensure proper teardown */
        dp_display_handle_plugged_change(&dp->dp_display, false);
 
        /* enable HDP plug interrupt to prepare for next plugin */
        dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_PLUG_INT_MASK, true);
 
+       DRM_DEBUG_DP("After, type=%d hpd_state=%d\n",
+                       dp->dp_display.connector_type, state);
+
        /* uevent will complete disconnection part */
        mutex_unlock(&dp->event_mutex);
        return 0;
@@ -679,8 +696,10 @@ static int dp_disconnect_pending_timeout(struct dp_display_private *dp, u32 data
        mutex_lock(&dp->event_mutex);
 
        state =  dp->hpd_state;
-       if (state == ST_DISCONNECT_PENDING)
+       if (state == ST_DISCONNECT_PENDING) {
                dp->hpd_state = ST_DISCONNECTED;
+               DRM_DEBUG_DP("type=%d\n", dp->dp_display.connector_type);
+       }
 
        mutex_unlock(&dp->event_mutex);
 
@@ -695,6 +714,9 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
 
        /* irq_hpd can happen at either connected or disconnected state */
        state =  dp->hpd_state;
+       DRM_DEBUG_DP("Before, type=%d hpd_state=%d\n",
+                       dp->dp_display.connector_type, state);
+
        if (state == ST_DISPLAY_OFF || state == ST_SUSPENDED) {
                mutex_unlock(&dp->event_mutex);
                return 0;
@@ -716,7 +738,8 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
 
        dp_display_usbpd_attention_cb(&dp->pdev->dev);
 
-       DRM_DEBUG_DP("hpd_state=%d\n", state);
+       DRM_DEBUG_DP("After, type=%d hpd_state=%d\n",
+                       dp->dp_display.connector_type, state);
 
        mutex_unlock(&dp->event_mutex);
 
@@ -1166,8 +1189,9 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id)
 
        hpd_isr_status = dp_catalog_hpd_get_intr_status(dp->catalog);
 
-       DRM_DEBUG_DP("hpd isr status=%#x\n", hpd_isr_status);
        if (hpd_isr_status & 0x0F) {
+               DRM_DEBUG_DP("type=%d isr=0x%x\n",
+                       dp->dp_display.connector_type, hpd_isr_status);
                /* hpd related interrupts */
                if (hpd_isr_status & DP_DP_HPD_PLUG_INT_MASK)
                        dp_add_event(dp, EV_HPD_PLUG_INT, 0, 0);
@@ -1320,8 +1344,9 @@ static int dp_pm_resume(struct device *dev)
 
        mutex_lock(&dp->event_mutex);
 
-       DRM_DEBUG_DP("Before, core_inited=%d power_on=%d\n",
-                       dp->core_initialized, dp_display->power_on);
+       DRM_DEBUG_DP("Before, type=%d core_inited=%d phy_inited=%d power_on=%d\n",
+               dp->dp_display.connector_type, dp->core_initialized,
+               dp->phy_initialized, dp_display->power_on);
 
        /* start from disconnected state */
        dp->hpd_state = ST_DISCONNECTED;
@@ -1360,9 +1385,11 @@ static int dp_pm_resume(struct device *dev)
                dp_display_handle_plugged_change(dp_display, false);
        }
 
-       DRM_DEBUG_DP("After, sink_count=%d is_connected=%d core_inited=%d power_on=%d\n",
-                       dp->link->sink_count, dp->dp_display.is_connected,
-                       dp->core_initialized, dp_display->power_on);
+       DRM_DEBUG_DP("After, type=%d sink_count=%d is_connected=%d \
+                       core_inited=%d phy_inited=%d power_on=%d\n",
+               dp->dp_display.connector_type, dp->link->sink_count,
+               dp->dp_display.is_connected, dp->core_initialized,
+               dp->phy_initialized, dp_display->power_on);
 
        mutex_unlock(&dp->event_mutex);
 
@@ -1379,8 +1406,9 @@ static int dp_pm_suspend(struct device *dev)
 
        mutex_lock(&dp->event_mutex);
 
-       DRM_DEBUG_DP("Before, core_inited=%d power_on=%d\n",
-                       dp->core_initialized, dp_display->power_on);
+       DRM_DEBUG_DP("Before, type=%d core_inited=%d phy_inited=%d power_on=%d\n",
+               dp->dp_display.connector_type, dp->core_initialized,
+               dp->phy_initialized, dp_display->power_on);
 
        /* mainlink enabled */
        if (dp_power_clk_status(dp->power, DP_CTRL_PM))
@@ -1393,8 +1421,9 @@ static int dp_pm_suspend(struct device *dev)
 
        dp->hpd_state = ST_SUSPENDED;
 
-       DRM_DEBUG_DP("After, core_inited=%d power_on=%d\n",
-                       dp->core_initialized, dp_display->power_on);
+       DRM_DEBUG_DP("After, type=%d core_inited=%d phy_inited=%d power_on=%d\n",
+               dp->dp_display.connector_type, dp->core_initialized,
+               dp->phy_initialized, dp_display->power_on);
 
        mutex_unlock(&dp->event_mutex);