Skip to contentSkip to conversation

*** fix missing unplug interrupt problem ***

PATCH Superseded Kuogee Hsieh 2 participants 14 messages Jan 7, 2021 – Jan 14, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover *** fix missing unplug interrupt problem ***

Both AUX_SW_RESET and DP_SW_RESET clear pending HPD interrupts. Therefore irq_hpd handler should not issues either aux or sw reset to avoid following unplug interrupt be cleared accidentally.

Kuogee Hsieh (2):
drm/msm/dp: postpone irq_hpd event during connection pending state drm/msm/dp: unplug interrupt missed after irq_hpd handler

 drivers/gpu/drm/msm/dp/dp_aux.c     |  7 -------
 drivers/gpu/drm/msm/dp/dp_catalog.c | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/msm/dp/dp_ctrl.c    | 15 ++++++++++-----
 drivers/gpu/drm/msm/dp/dp_display.c |  7 +++++++
 drivers/gpu/drm/msm/dp/dp_panel.c   | 12 +++++++++---
 5 files changed, 50 insertions(+), 15 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH 1/2 drm/msm/dp: postpone irq_hpd event during connection pending state

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane are valid before start link training.

---
 drivers/gpu/drm/msm/dp/dp_display.c |  7 +++++++
 drivers/gpu/drm/msm/dp/dp_panel.c   | 12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +7 -0
index 6e971d5..3bc7ed2 100644
@@ -693,6 +693,13 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
 		return 0;
 	}
 
+	if (state == ST_CONNECT_PENDING) {
+		/* wait until ST_CONNECTED */
+		dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */
+		mutex_unlock(&dp->event_mutex);
+		return 0;
+	}
+
 	ret = dp_display_usbpd_attention_cb(&dp->pdev->dev);
 	if (ret == -ECONNRESET) { /* cable unplugged */
 		dp->core_initialized = false;
drivers/gpu/drm/msm/dp/dp_panel.c +9 -3
index 97dca3e..d1780bc 100644
@@ -167,12 +167,18 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
 	panel = container_of(dp_panel, struct dp_panel_private, dp_panel);
 
 	rc = dp_panel_read_dpcd(dp_panel);
+	if (rc) {
+		DRM_ERROR("read dpcd failed %d\n", rc);
+		return rc;
+	}
+
 	bw_code = drm_dp_link_rate_to_bw_code(dp_panel->link_info.rate);
-	if (rc || !is_link_rate_valid(bw_code) ||
+	if (!is_link_rate_valid(bw_code) ||
 			!is_lane_count_valid(dp_panel->link_info.num_lanes) ||
 			(bw_code > dp_panel->max_bw_code)) {
-		DRM_ERROR("read dpcd failed %d\n", rc);
-		return rc;
+		DRM_ERROR("Illegal link rate=%d lane=%d\n", dp_panel->link_info.rate,
+				dp_panel->link_info.num_lanes);
+		return -EINVAL;
 	}
 
 	if (dp_panel->dfp_present) {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

Re: [PATCH 1/2] drm/msm/dp: postpone irq_hpd event during connection pending state

Quoting Kuogee Hsieh (2021-01-07 12:30:24)

Quoted 3 lines

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane

Why does it happen at connection pending state?

Quoted 1 line

are valid before start link training.

Can this part about link rate and lane being valid be split off into another patch?

Quoted 3 lines

---

Any fixes tag?

Quoted 22 lines
 drivers/gpu/drm/msm/dp/dp_display.c |  7 +++++++
 drivers/gpu/drm/msm/dp/dp_panel.c   | 12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +7 -0
index 6e971d5..3bc7ed2 100644
@@ -693,6 +693,13 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
                return 0;
        }
 
+       if (state == ST_CONNECT_PENDING) {
+               /* wait until ST_CONNECTED */
+               dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */
+               mutex_unlock(&dp->event_mutex);
+               return 0;
+       }
+
        ret = dp_display_usbpd_attention_cb(&dp->pdev->dev);
        if (ret == -ECONNRESET) { /* cable unplugged */
                dp->core_initialized = false;
#3 lore raw

Re: [PATCH 1/2] drm/msm/dp: postpone irq_hpd event during connection pending state

Quoted 6 lines · Stephen Boyd

Quoting Kuogee Hsieh (2021-01-07 12:30:24)

Quoted 3 lines

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane

Why does it happen at connection pending state?

plug in need two state to complete it.
advance to connection pending state once link training completed and sent uevent notification to frame work. transition to connected state after frame work provided resolution timing and start transmit video panel. Therefore irq_hpd should not be handled if it occurred before connected state.

Quoted 6 lines
Quoted 2 lines

are valid before start link training.

Can this part about link rate and lane being valid be split off into another patch?

ok, i will spilt this patch into two.
I will merge irq_hpd event part into 2nd patch (drm/msm/dp: unplug interrupt missed after irq_hpd handler).

Quoted 30 lines
Quoted 3 lines

---

Any fixes tag?

Quoted 24 lines
 drivers/gpu/drm/msm/dp/dp_display.c |  7 +++++++
 drivers/gpu/drm/msm/dp/dp_panel.c   | 12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +7 -0
index 6e971d5..3bc7ed2 100644
@@ -693,6 +693,13 @@ static int dp_irq_hpd_handle(struct 
 dp_display_private *dp, u32 data)
                return 0;
        }
 
+       if (state == ST_CONNECT_PENDING) {
+               /* wait until ST_CONNECTED */
+               dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 
 */
+               mutex_unlock(&dp->event_mutex);
+               return 0;
+       }
+
        ret = dp_display_usbpd_attention_cb(&dp->pdev->dev);
        if (ret == -ECONNRESET) { /* cable unplugged */
                dp->core_initialized = false;
#4 lore raw

Re: [PATCH 1/2] drm/msm/dp: postpone irq_hpd event during connection pending state

Quoting [email protected] (2021-01-13 09:44:24)

Quoted 15 lines · Stephen Boyd
Quoted 6 lines

Quoting Kuogee Hsieh (2021-01-07 12:30:24)

Quoted 3 lines

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane

Why does it happen at connection pending state?

plug in need two state to complete it.
advance to connection pending state once link training completed and sent uevent notification to frame work.
transition to connected state after frame work provided resolution timing and start transmit video panel.
Therefore irq_hpd should not be handled if it occurred before connected state.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

are valid before start link training.

Can this part about link rate and lane being valid be split off into another patch?

ok, i will spilt this patch into two.
I will merge irq_hpd event part into 2nd patch (drm/msm/dp: unplug interrupt missed after irq_hpd handler).

It looks like Rob already picked this patch up

https://gitlab.freedesktop.org/drm/msm/-/commit/2b5f09cadfc576817c0450e01d454f750909b103

#5 lore raw

Re: [PATCH 1/2] drm/msm/dp: postpone irq_hpd event during connection pending state

In reply to [email protected]

Quoting [email protected] (2021-01-13 09:44:24)

Quoted 6 lines · Stephen Boyd
Quoted 5 lines

Quoting Kuogee Hsieh (2021-01-07 12:30:24)

Quoted 3 lines

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane

Quoted 8 lines
Quoted 1 line

Why does it happen at connection pending state?

plug in need two state to complete it.
advance to connection pending state once link training completed and sent uevent notification to frame work.
transition to connected state after frame work provided resolution timing and start transmit video panel.
Therefore irq_hpd should not be handled if it occurred before connected state.

Sure that's what's going on in the patch but you didn't answer my question. Why does irq_hpd happen before connected state?

#6 lore raw

Re: [PATCH 1/2] drm/msm/dp: postpone irq_hpd event during connection pending state

Quoted 16 lines · Stephen Boyd

Quoting [email protected] (2021-01-13 09:44:24)

Quoted 6 lines · Stephen Boyd
Quoted 5 lines

Quoting Kuogee Hsieh (2021-01-07 12:30:24)

Quoted 3 lines

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane

Quoted 8 lines
Quoted 1 line

Why does it happen at connection pending state?

plug in need two state to complete it.
advance to connection pending state once link training completed and sent uevent notification to frame work.
transition to connected state after frame work provided resolution timing and start transmit video panel.
Therefore irq_hpd should not be handled if it occurred before connected state.

Quoted 2 lines

Sure that's what's going on in the patch but you didn't answer my question. Why does irq_hpd happen before connected state?

I have no idea why it happen this way.
during debug https://partnerissuetracker.corp.google.com/issues/170598152
I saw two different scenario
1) irq_hpd followed by unplug with less than 20 ms in between. this one fixed by this patch set.
2) plug followed by irq_hpd around 300ms in between. it does not cause problem. but it should be handled in order (after connected state).

#7 lore raw

Re: [PATCH 1/2] drm/msm/dp: postpone irq_hpd event during connection pending state

Quoting [email protected] (2021-01-13 15:44:32)

Quoted 21 lines · Stephen Boyd
Quoted 17 lines

Quoting [email protected] (2021-01-13 09:44:24)

Quoted 7 lines · Stephen Boyd
Quoted 6 lines

Quoting Kuogee Hsieh (2021-01-07 12:30:24)

Quoted 3 lines

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane

Why does it happen at connection pending state?

Quoted 8 lines

plug in need two state to complete it.
advance to connection pending state once link training completed and sent uevent notification to frame work.
transition to connected state after frame work provided resolution timing and start transmit video panel.
Therefore irq_hpd should not be handled if it occurred before connected
state.

Quoted 2 lines

Sure that's what's going on in the patch but you didn't answer my question. Why does irq_hpd happen before connected state?

Quoted 8 lines

I have no idea why it happen this way.
during debug
https://partnerissuetracker.corp.google.com/issues/170598152
I saw two different scenario
1) irq_hpd followed by unplug with less than 20 ms in between. this one fixed by this patch set.
2) plug followed by irq_hpd around 300ms in between. it does not cause problem. but it should be handled in order (after connected state).

Ok. So nobody understands why the hardware is acting this way and we're papering over the problem by forcing the HPD state to be what we think it should be? That's not great.

#8 lore raw

Re: [PATCH 1/2] drm/msm/dp: postpone irq_hpd event during connection pending state

Quoted 31 lines · Stephen Boyd

Quoting [email protected] (2021-01-13 15:44:32)

Quoted 21 lines · Stephen Boyd
Quoted 17 lines

Quoting [email protected] (2021-01-13 09:44:24)

Quoted 7 lines · Stephen Boyd
Quoted 6 lines

Quoting Kuogee Hsieh (2021-01-07 12:30:24)

Quoted 3 lines

irq_hpd event can only be executed at connected state. Therefore irq_hpd event should be postponed if it happened at connection pending state. This patch also make sure both link rate and lane

Why does it happen at connection pending state?

Quoted 8 lines

plug in need two state to complete it.
advance to connection pending state once link training completed and sent uevent notification to frame work.
transition to connected state after frame work provided resolution timing and start transmit video panel.
Therefore irq_hpd should not be handled if it occurred before connected
state.

Quoted 2 lines

Sure that's what's going on in the patch but you didn't answer my question. Why does irq_hpd happen before connected state?

Quoted 8 lines

I have no idea why it happen this way.
during debug
https://partnerissuetracker.corp.google.com/issues/170598152
I saw two different scenario
1) irq_hpd followed by unplug with less than 20 ms in between. this one fixed by this patch set.
2) plug followed by irq_hpd around 300ms in between. it does not cause problem. but it should be handled in order (after connected state).

Quoted 3 lines

Ok. So nobody understands why the hardware is acting this way and we're papering over the problem by forcing the HPD state to be what we think it should be? That's not great.

irq_hpd is issued from dongle.
it then go through EC ps8805 driver and reach DP driver finally.
Again, to duplicate problem #1 this at my set up, i have to intentionally wiggling type-c connector of dongle. But I can not duplicate problem #2 and only saw it one time from Quantan provide logs.

#9 lore raw

PATCH 2/2 drm/msm/dp: unplug interrupt missed after irq_hpd handler

In reply to Kuogee Hsieh

There is HPD unplug interrupts missed at scenario of an irq_hpd followed by unplug interrupts with around 10 ms in between. Since both AUX_SW_RESET and DP_SW_RESET clear pending HPD interrupts, irq_hpd handler should not issues either aux or sw reset to avoid following unplug interrupt be cleared accidentally.

---
 drivers/gpu/drm/msm/dp/dp_aux.c     |  7 -------
 drivers/gpu/drm/msm/dp/dp_catalog.c | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/msm/dp/dp_ctrl.c    | 15 ++++++++++-----
 3 files changed, 34 insertions(+), 12 deletions(-)
drivers/gpu/drm/msm/dp/dp_aux.c +0 -7
index 19b35ae..1c6e1d2 100644
@@ -336,7 +336,6 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux,
 	ssize_t ret;
 	int const aux_cmd_native_max = 16;
 	int const aux_cmd_i2c_max = 128;
-	int const retry_count = 5;
 	struct dp_aux_private *aux = container_of(dp_aux,
 		struct dp_aux_private, dp_aux);
 
@@ -378,12 +377,6 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux,
 	ret = dp_aux_cmd_fifo_tx(aux, msg);
 
 	if (ret < 0) {
-		if (aux->native) {
-			aux->retry_cnt++;
-			if (!(aux->retry_cnt % retry_count))
-				dp_catalog_aux_update_cfg(aux->catalog);
-			dp_catalog_aux_reset(aux->catalog);
-		}
 		usleep_range(400, 500); /* at least 400us to next try */
 		goto unlock_exit;
 	}
drivers/gpu/drm/msm/dp/dp_catalog.c +24 -0
index 44f0c57..9c0ce98 100644
@@ -190,6 +190,18 @@ int dp_catalog_aux_clear_hw_interrupts(struct dp_catalog *dp_catalog)
 	return 0;
 }
 
+/**
+ * dp_catalog_aux_reset() - reset AUX controller
+ *
+ * @aux: DP catalog structure
+ *
+ * return: void
+ *
+ * This function reset AUX controller
+ *
+ * NOTE: reset AUX controller will also clear any pending HPD related interrupts
+ * 
+ */
 void dp_catalog_aux_reset(struct dp_catalog *dp_catalog)
 {
 	u32 aux_ctrl;
@@ -483,6 +495,18 @@ int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog,
 	return 0;
 }
 
+/**
+ * dp_catalog_ctrl_reset() - reset DP controller
+ *
+ * @aux: DP catalog structure
+ *
+ * return: void
+ *
+ * This function reset DP controller
+ *
+ * NOTE: reset DP controller will also clear any pending HPD related interrupts
+ * 
+ */
 void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog)
 {
 	u32 sw_reset;
drivers/gpu/drm/msm/dp/dp_ctrl.c +10 -5
index e3462f5..f96c415 100644
@@ -1296,7 +1296,8 @@ static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl,
 	 * transitioned to PUSH_IDLE. In order to start transmitting
 	 * a link training pattern, we have to first do soft reset.
 	 */
-	dp_catalog_ctrl_reset(ctrl->catalog);
+	if (*training_step != DP_TRAINING_NONE)
+		dp_catalog_ctrl_reset(ctrl->catalog);
 
 	ret = dp_ctrl_link_train(ctrl, cr, training_step);
 
@@ -1491,15 +1492,18 @@ static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl)
 	return 0;
 }
 
+static void dp_ctrl_link_idle_reset(struct dp_ctrl_private *ctrl)
+{
+	dp_ctrl_push_idle(&ctrl->dp_ctrl);
+	dp_catalog_ctrl_reset(ctrl->catalog);
+}
+
 static int dp_ctrl_link_maintenance(struct dp_ctrl_private *ctrl)
 {
 	int ret = 0;
 	struct dp_cr_status cr;
 	int training_step = DP_TRAINING_NONE;
 
-	dp_ctrl_push_idle(&ctrl->dp_ctrl);
-	dp_catalog_ctrl_reset(ctrl->catalog);
-
 	ctrl->dp_ctrl.pixel_rate = ctrl->panel->dp_mode.drm_mode.clock;
 
 	ret = dp_ctrl_setup_main_link(ctrl, &cr, &training_step);
@@ -1626,6 +1630,7 @@ void dp_ctrl_handle_sink_request(struct dp_ctrl *dp_ctrl)
 
 	if (sink_request & DP_TEST_LINK_TRAINING) {
 		dp_link_send_test_response(ctrl->link);
+		dp_ctrl_link_idle_reset(ctrl);
 		if (dp_ctrl_link_maintenance(ctrl)) {
 			DRM_ERROR("LM failed: TEST_LINK_TRAINING\n");
 			return;
@@ -1679,7 +1684,7 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
 			break;
 		}
 
-		training_step = DP_TRAINING_NONE;
+		training_step = DP_TRAINING_1;
 		rc = dp_ctrl_setup_main_link(ctrl, &cr, &training_step);
 		if (rc == 0) {
 			/* training completed successfully */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#10 lore raw

Re: [PATCH 2/2] drm/msm/dp: unplug interrupt missed after irq_hpd handler

Quoting Kuogee Hsieh (2021-01-07 12:30:25)

Quoted 5 lines

There is HPD unplug interrupts missed at scenario of an irq_hpd followed by unplug interrupts with around 10 ms in between. Since both AUX_SW_RESET and DP_SW_RESET clear pending HPD interrupts, irq_hpd handler should not issues either aux or sw reset to avoid following unplug interrupt be cleared accidentally.

So the problem is that we're resetting the DP aux phy in the middle of the HPD state machine transitioning states?

Quoted 27 lines

---

drivers/gpu/drm/msm/dp/dp_catalog.c +12 -0
index 44f0c57..9c0ce98 100644
@@ -190,6 +190,18 @@ int dp_catalog_aux_clear_hw_interrupts(struct dp_catalog *dp_catalog)
        return 0;
 }
 
+/**
+ * dp_catalog_aux_reset() - reset AUX controller
+ *
+ * @aux: DP catalog structure
+ *
+ * return: void
+ *
+ * This function reset AUX controller
+ *
+ * NOTE: reset AUX controller will also clear any pending HPD related interrupts
+ * 
+ */
 void dp_catalog_aux_reset(struct dp_catalog *dp_catalog)
 {
        u32 aux_ctrl;

drivers/gpu/drm/msm/dp/dp_catalog.c int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog, · line 501

Quoted 7 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
@@ -483,6 +495,18 @@ int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog,
        return 0;
 }
 
+/**
+ * dp_catalog_ctrl_reset() - reset DP controller
+ *
+ * @aux: DP catalog structure

It's called dp_catalog though.

drivers/gpu/drm/msm/dp/dp_catalog.c int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog, · line 505

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+ *
+ * return: void
+ *
+ * This function reset DP controller

resets the

Quoted 12 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+ *
+ * NOTE: reset DP controller will also clear any pending HPD related interrupts
+ * 
+ */
 void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog)
 {
        u32 sw_reset;
drivers/gpu/drm/msm/dp/dp_ctrl.c +0 -0
index e3462f5..f96c415 100644

drivers/gpu/drm/msm/dp/dp_ctrl.c static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl, · line 1299

Quoted 5 lines
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -1
@@ -1296,7 +1296,8 @@ static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl,
         * transitioned to PUSH_IDLE. In order to start transmitting
         * a link training pattern, we have to first do soft reset.
         */
-       dp_catalog_ctrl_reset(ctrl->catalog);
+       if (*training_step != DP_TRAINING_NONE)

Can we check for the positive value instead? i.e.
DP_TRAINING_1/DP_TRAINING_2

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -0
+               dp_catalog_ctrl_reset(ctrl->catalog);
 
        ret = dp_ctrl_link_train(ctrl, cr, training_step);
 
#11 lore raw

Re: [PATCH 2/2] drm/msm/dp: unplug interrupt missed after irq_hpd handler

Quoted 10 lines · Stephen Boyd

Quoting Kuogee Hsieh (2021-01-07 12:30:25)

Quoted 5 lines

There is HPD unplug interrupts missed at scenario of an irq_hpd followed by unplug interrupts with around 10 ms in between. Since both AUX_SW_RESET and DP_SW_RESET clear pending HPD interrupts, irq_hpd handler should not issues either aux or sw reset to avoid following unplug interrupt be cleared accidentally.

So the problem is that we're resetting the DP aux phy in the middle of the HPD state machine transitioning states?

yes, after reset aux, hw clear pending hpd interrupts

Quoted 33 lines
Quoted 33 lines

---

drivers/gpu/drm/msm/dp/dp_catalog.c +10 -0
index 44f0c57..9c0ce98 100644
@@ -190,6 +190,18 @@ int dp_catalog_aux_clear_hw_interrupts(struct 
 dp_catalog *dp_catalog)
        return 0;
 }
 
+/**
+ * dp_catalog_aux_reset() - reset AUX controller
+ *
+ * @aux: DP catalog structure
+ *
+ * return: void
+ *
+ * This function reset AUX controller
+ *
+ * NOTE: reset AUX controller will also clear any pending HPD related 

interrupts
+ *
+ */
void dp_catalog_aux_reset(struct dp_catalog *dp_catalog)

 {
        u32 aux_ctrl;
drivers/gpu/drm/msm/dp/dp_catalog.c +0 -0
@@ -483,6 +495,18 @@ int dp_catalog_ctrl_set_pattern(struct dp_catalog 
 *dp_catalog,
        return 0;
 }
 
Quoted 6 lines

drivers/gpu/drm/msm/dp/dp_catalog.c int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog, · line 501

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+/**
+ * dp_catalog_ctrl_reset() - reset DP controller
+ *
+ * @aux: DP catalog structure

It's called dp_catalog though.

registers access are through dp_catalog_xxxx

Quoted 35 lines

drivers/gpu/drm/msm/dp/dp_catalog.c int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog, · line 505

Quoted 5 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+ *
+ * return: void
+ *
+ * This function reset DP controller

resets the

Quoted 13 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +2 -0
+ *
+ * NOTE: reset DP controller will also clear any pending HPD related 

interrupts
+ *
+ */
void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog)

 {
        u32 sw_reset;
drivers/gpu/drm/msm/dp/dp_ctrl.c +0 -0
index e3462f5..f96c415 100644

drivers/gpu/drm/msm/dp/dp_ctrl.c static int dp_ctrl_setup_main_link(struct · line 1300

Quoted 6 lines
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -1
@@ -1296,7 +1296,8 @@ static int dp_ctrl_setup_main_link(struct 
 dp_ctrl_private *ctrl,
         * transitioned to PUSH_IDLE. In order to start transmitting
         * a link training pattern, we have to first do soft reset.
         */
-       dp_catalog_ctrl_reset(ctrl->catalog);
+       if (*training_step != DP_TRAINING_NONE)

Can we check for the positive value instead? i.e.
DP_TRAINING_1/DP_TRAINING_2

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -0
+               dp_catalog_ctrl_reset(ctrl->catalog);
 
        ret = dp_ctrl_link_train(ctrl, cr, training_step);
#12 lore raw

Re: [PATCH 2/2] drm/msm/dp: unplug interrupt missed after irq_hpd handler

Quoting [email protected] (2021-01-13 09:48:25)

Quoted 46 lines · Stephen Boyd
Quoted 10 lines

Quoting Kuogee Hsieh (2021-01-07 12:30:25)

Quoted 5 lines

There is HPD unplug interrupts missed at scenario of an irq_hpd followed by unplug interrupts with around 10 ms in between. Since both AUX_SW_RESET and DP_SW_RESET clear pending HPD interrupts, irq_hpd handler should not issues either aux or sw reset to avoid following unplug interrupt be cleared accidentally.

So the problem is that we're resetting the DP aux phy in the middle of the HPD state machine transitioning states?

yes, after reset aux, hw clear pending hpd interrupts

Quoted 34 lines
Quoted 34 lines

---

drivers/gpu/drm/msm/dp/dp_catalog.c +10 -0
index 44f0c57..9c0ce98 100644
@@ -190,6 +190,18 @@ int dp_catalog_aux_clear_hw_interrupts(struct 
 dp_catalog *dp_catalog)
        return 0;
 }
 
+/**
+ * dp_catalog_aux_reset() - reset AUX controller
+ *
+ * @aux: DP catalog structure
+ *
+ * return: void
+ *
+ * This function reset AUX controller
+ *
+ * NOTE: reset AUX controller will also clear any pending HPD related 

interrupts
+ *
+ */
void dp_catalog_aux_reset(struct dp_catalog *dp_catalog)

 {
        u32 aux_ctrl;
drivers/gpu/drm/msm/dp/dp_catalog.c +0 -0
@@ -483,6 +495,18 @@ int dp_catalog_ctrl_set_pattern(struct dp_catalog 
 *dp_catalog,
        return 0;
 }
 
Quoted 7 lines
Quoted 6 lines

drivers/gpu/drm/msm/dp/dp_catalog.c int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog, · line 501

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+/**
+ * dp_catalog_ctrl_reset() - reset DP controller
+ *
+ * @aux: DP catalog structure

It's called dp_catalog though.

registers access are through dp_catalog_xxxx

Agreed. The variable is not called 'aux' though, it's called 'dp_catalog'.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+ *
+ * return: void
+ *
+ * This function reset DP controller
Quoted 8 lines
Quoted 8 lines

resets the

Quoted 6 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +2 -0
+ *
+ * NOTE: reset DP controller will also clear any pending HPD related 

interrupts
+ *
+ */
void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog)

Right here.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
 {
        u32 sw_reset;
drivers/gpu/drm/msm/dp/dp_ctrl.c +0 -0
index e3462f5..f96c415 100644
@@ -1296,7 +1296,8 @@ static int dp_ctrl_setup_main_link(struct 
 dp_ctrl_private *ctrl,
         * transitioned to PUSH_IDLE. In order to start transmitting
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/dp/dp_ctrl.c static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl, · line 1299

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -1
         * a link training pattern, we have to first do soft reset.
         */
-       dp_catalog_ctrl_reset(ctrl->catalog);
+       if (*training_step != DP_TRAINING_NONE)

Can we check for the positive value instead? i.e.
DP_TRAINING_1/DP_TRAINING_2

Any answer?

#13 lore raw

Re: [PATCH 2/2] drm/msm/dp: unplug interrupt missed after irq_hpd handler

Quoted 66 lines · Stephen Boyd

Quoting [email protected] (2021-01-13 09:48:25)

Quoted 46 lines · Stephen Boyd
Quoted 10 lines

Quoting Kuogee Hsieh (2021-01-07 12:30:25)

Quoted 5 lines

There is HPD unplug interrupts missed at scenario of an irq_hpd followed by unplug interrupts with around 10 ms in between. Since both AUX_SW_RESET and DP_SW_RESET clear pending HPD interrupts, irq_hpd handler should not issues either aux or sw reset to avoid following unplug interrupt be cleared accidentally.

So the problem is that we're resetting the DP aux phy in the middle of the HPD state machine transitioning states?

yes, after reset aux, hw clear pending hpd interrupts

Quoted 34 lines
Quoted 34 lines

---

drivers/gpu/drm/msm/dp/dp_catalog.c +10 -0
index 44f0c57..9c0ce98 100644
@@ -190,6 +190,18 @@ int dp_catalog_aux_clear_hw_interrupts(struct
 dp_catalog *dp_catalog)
        return 0;
 }
 
+/**
+ * dp_catalog_aux_reset() - reset AUX controller
+ *
+ * @aux: DP catalog structure
+ *
+ * return: void
+ *
+ * This function reset AUX controller
+ *
+ * NOTE: reset AUX controller will also clear any pending HPD related

interrupts
+ *
+ */
void dp_catalog_aux_reset(struct dp_catalog *dp_catalog)

 {
        u32 aux_ctrl;
drivers/gpu/drm/msm/dp/dp_catalog.c +0 -0
@@ -483,6 +495,18 @@ int dp_catalog_ctrl_set_pattern(struct dp_catalog
 *dp_catalog,
        return 0;
 }
 
Quoted 7 lines
Quoted 6 lines

drivers/gpu/drm/msm/dp/dp_catalog.c int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog, · line 501

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+/**
+ * dp_catalog_ctrl_reset() - reset DP controller
+ *
+ * @aux: DP catalog structure

It's called dp_catalog though.

registers access are through dp_catalog_xxxx

Agreed. The variable is not called 'aux' though, it's called 'dp_catalog'.

Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/dp/dp_catalog.c int dp_catalog_ctrl_set_pattern(struct dp_catalog *dp_catalog, · line 505

Quoted 5 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +4 -0
+ *
+ * return: void
+ *
+ * This function reset DP controller

resets the

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/msm/dp/dp_catalog.c +2 -0
+ *
+ * NOTE: reset DP controller will also clear any pending HPD related

interrupts
+ *
+ */
void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog)

Right here.

fixed at v2

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
 {
        u32 sw_reset;
drivers/gpu/drm/msm/dp/dp_ctrl.c +0 -0
index e3462f5..f96c415 100644
@@ -1296,7 +1296,8 @@ static int dp_ctrl_setup_main_link(struct
 dp_ctrl_private *ctrl,
         * transitioned to PUSH_IDLE. In order to start transmitting
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/dp/dp_ctrl.c static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl, · line 1299

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -1
         * a link training pattern, we have to first do soft reset.
         */
-       dp_catalog_ctrl_reset(ctrl->catalog);
+       if (*training_step != DP_TRAINING_NONE)

Can we check for the positive value instead? i.e.
DP_TRAINING_1/DP_TRAINING_2

Quoted 1 line

Any answer?

fixed at v2