Skip to contentSkip to conversation

drm/msm/dp: return correct connection status after suspend

PATCH Superseded Kuogee Hsieh 2 participants 2 messages Sep 26, 2020 – Sep 29, 2020

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/msm/dp: return correct connection status after suspend

At dp_pm_resume, reinitialize both dp host controller and hpd block so that hpd connection can be detected at realtime by reading hpd state status register. Also hpd plug interrupt can be generated accordingly.

Changes in v2:
-- use container_of to cast correct dp_display_private pointer
at both dp_pm_suspend and dp_pm_resume.

---
 drivers/gpu/drm/msm/dp/dp_catalog.c | 13 ++++++
 drivers/gpu/drm/msm/dp/dp_catalog.h |  1 +
 drivers/gpu/drm/msm/dp/dp_display.c | 67 ++++++++++++-----------------
 drivers/gpu/drm/msm/dp/dp_reg.h     |  2 +
 4 files changed, 43 insertions(+), 40 deletions(-)
drivers/gpu/drm/msm/dp/dp_catalog.c +13 -0
index b15b4ce4ba35..63c5ada34c21 100644
@@ -572,6 +572,19 @@ void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog)
 	dp_write_aux(catalog, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN);
 }
 
+u32 dp_catalog_hpd_get_state_status(struct dp_catalog *dp_catalog)
+{
+	struct dp_catalog_private *catalog = container_of(dp_catalog,
+				struct dp_catalog_private, dp_catalog);
+	u32 status = 0;
+
+	status = dp_read_aux(catalog, REG_DP_DP_HPD_INT_STATUS);
+	status >>= DP_DP_HPD_STATE_STATUS_BITS_SHIFT;
+	status &= DP_DP_HPD_STATE_STATUS_BITS_MASK;
+
+	return status;
+}
+
 u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog)
 {
 	struct dp_catalog_private *catalog = container_of(dp_catalog,
drivers/gpu/drm/msm/dp/dp_catalog.h +1 -0
index 4b7666f1fe6f..6d257dbebf29 100644
@@ -97,6 +97,7 @@ void dp_catalog_ctrl_enable_irq(struct dp_catalog *dp_catalog, bool enable);
 void dp_catalog_hpd_config_intr(struct dp_catalog *dp_catalog,
 			u32 intr_mask, bool en);
 void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog);
+u32 dp_catalog_hpd_get_state_status(struct dp_catalog *dp_catalog);
 u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog);
 void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog);
 int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog, u8 v_level,
drivers/gpu/drm/msm/dp/dp_display.c +27 -40

122 lines not on this page · raw message

drivers/gpu/drm/msm/dp/dp_reg.h +2 -0
index 43042ff90a19..268602803d9a 100644
@@ -32,6 +32,8 @@
 #define DP_DP_IRQ_HPD_INT_ACK			(0x00000002)
 #define DP_DP_HPD_REPLUG_INT_ACK		(0x00000004)
 #define DP_DP_HPD_UNPLUG_INT_ACK		(0x00000008)
+#define DP_DP_HPD_STATE_STATUS_BITS_MASK	(0x0000000F)
+#define DP_DP_HPD_STATE_STATUS_BITS_SHIFT	(0x1C)
 
 #define REG_DP_DP_HPD_INT_MASK			(0x0000000C)
 #define DP_DP_HPD_PLUG_INT_MASK			(0x00000001)

base-commit: 3c0f462da069af12211901ddf26f7e16e6951d9b

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

Quoting Kuogee Hsieh (2020-09-26 13:34:54)

Quoted 1 line

At dp_pm_resume, reinitialize both dp host controller and hpd block

dp_pm_resume()

Quoted 2 lines

so that hpd connection can be detected at realtime by reading hpd state status register. Also hpd plug interrupt can be generated accordingly.

Can you describe more here? The subject says "return correct connection status after suspend" so it seems that suspend connection status is broken. How is it broken? What can be done to see if it is broken? I think you can suspend, disconnect the DP cable, and then resume and see that the device is connected still?

What does "hpd plug interrupt can be generated accordingly" mean? Is the interrupt not being generated?

Quoted 6 lines

Changes in v2:
-- use container_of to cast correct dp_display_private pointer
at both dp_pm_suspend and dp_pm_resume.

Any Fixes tag?

drivers/gpu/drm/msm/dp/dp_catalog.c void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog) · line 579

Quoted 13 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +5 -0
index b15b4ce4ba35..63c5ada34c21 100644
@@ -572,6 +572,19 @@ void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog)
        dp_write_aux(catalog, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN);
 }
 
+u32 dp_catalog_hpd_get_state_status(struct dp_catalog *dp_catalog)
+{
+       struct dp_catalog_private *catalog = container_of(dp_catalog,
+                               struct dp_catalog_private, dp_catalog);
+       u32 status = 0;

We don't need to assign to 0 to reassign immediately after.

Quoted 11 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +8 -0
+
+       status = dp_read_aux(catalog, REG_DP_DP_HPD_INT_STATUS);
+       status >>= DP_DP_HPD_STATE_STATUS_BITS_SHIFT;
+       status &= DP_DP_HPD_STATE_STATUS_BITS_MASK;
+
+       return status;
+}
+
 u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog)
 {
        struct dp_catalog_private *catalog = container_of(dp_catalog,