Skip to contentSkip to conversation

UPSTREAM: drm/amd/display: Fix Apple dongle cannot be successfully detected

PATCH Superseded Louis Li 4 participants 5 messages Oct 21, 2019 – Oct 28, 2019 3 messages not in the archive

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Louis Li

author
#0 lore raw

PATCH 1/1 UPSTREAM: drm/amd/display: Fix Apple dongle cannot be successfully detected

[Why]
External monitor cannot be displayed consistently, if connecting via this Apple dongle (A1621, USB Type-C to HDMI).
By experiments, it is confirmed that the dongle needs 200ms at least to be ready for communication, after it sets HPD signal high.

[How]
When receiving HPD IRQ, delay 500ms at the beginning of handle_hpd_irq(). Then run the original procedure.
With this patch applied, the problem cannot be reproduced. With other dongles, test results are PASS.
Test result is PASS after system resumes from suspend.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
index 0aef92b7c037..043ddac73862 100644
@@ -1025,6 +1025,11 @@ static void handle_hpd_irq(void *param)
 	struct drm_device *dev = connector->dev;
 	enum dc_connection_type new_connection_type = dc_connection_none;
 
+    /* Some monitors/dongles need around 200ms to be ready for communication
+     * after they drive HPD signal high.
+     */
+    mdelay(500);
+
 	/* In case of failure or MST no need to update connector status or notify the OS
 	 * since (for MST case) MST does this in it's own context.
 	 */
Signature · 6 lines
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 23 lines · Louis Li

[Why]
External monitor cannot be displayed consistently, if connecting via this Apple dongle (A1621, USB Type-C to HDMI).
By experiments, it is confirmed that the dongle needs 200ms at least to be ready for communication, after it sets HPD signal high.

[How]
When receiving HPD IRQ, delay 500ms at the beginning of handle_hpd_irq(). Then run the original procedure.
With this patch applied, the problem cannot be reproduced. With other dongles, test results are PASS.
Test result is PASS after system resumes from suspend.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 0aef92b7c037..043ddac73862 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void handle_hpd_irq(void *param) · line 1032

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
@@ -1025,6 +1025,11 @@ static void handle_hpd_irq(void *param)
  	struct drm_device *dev = connector->dev;
  	enum dc_connection_type new_connection_type = dc_connection_none;
 
+    /* Some monitors/dongles need around 200ms to be ready for communication
+     * after they drive HPD signal high.
+     */
+    mdelay(500);
+

This sounds more like a quirk than behavior we want for all monitors, but regardless this sleep isn't the correct place for this - since this is an high priority interrupt handler this is really just blocking everything for half a second.

I think it'd make more sense to queue off the work to occur half a second later.

Nicholas Kazlauskas

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void handle_hpd_irq(void *param) · line 1035

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
  	/* In case of failure or MST no need to update connector status or notify the OS
  	 * since (for MST case) MST does this in it's own context.
  	 */

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c125018e-ef0f-9c90-0d8b-81bee96faa71-5C7GfCeVMHo@public.gmane.org

#4 lore raw
Quoted 37 lines · Nicholas
Quoted 23 lines · Louis Li

[Why]
External monitor cannot be displayed consistently, if connecting via this Apple dongle (A1621, USB Type-C to HDMI).
By experiments, it is confirmed that the dongle needs 200ms at least to be ready for communication, after it sets HPD signal high.

[How]
When receiving HPD IRQ, delay 500ms at the beginning of handle_hpd_irq(). Then run the original procedure.
With this patch applied, the problem cannot be reproduced. With other dongles, test results are PASS.
Test result is PASS after system resumes from suspend.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 0aef92b7c037..043ddac73862 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void handle_hpd_irq(void *param) · line 1032

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
@@ -1025,6 +1025,11 @@ static void handle_hpd_irq(void *param)
  	struct drm_device *dev = connector->dev;
  	enum dc_connection_type new_connection_type = dc_connection_none;
 
+    /* Some monitors/dongles need around 200ms to be ready for communication
+     * after they drive HPD signal high.
+     */
+    mdelay(500);
+

This sounds more like a quirk than behavior we want for all monitors, but regardless this sleep isn't the correct place for this - since this is an high priority interrupt handler this is really just blocking everything for half a second.

Quoted 5 lines

I think it'd make more sense to queue off the work to occur half a second later.

Nicholas Kazlauskas

Yes, I agree with your comments. However, dealing with monitors and dongles, it is proved that some monitors/dongles don't work as the way people expected. The solution makes sense to have our driver better compatibility to work with such devices. Truly, should not block high priority interrupt. I had V2 patch to use msleep instead. Customer is verifying V2. Will submit once it pass tests.

Louis Li

Quoted 5 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void handle_hpd_irq(void *param) · line 1035

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
  	/* In case of failure or MST no need to update connector status or notify the OS
  	 * since (for MST case) MST does this in it's own context.
  	 */

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw
In reply to a message not in the archive

The UPSTREAM tag in the commit message needs to be removed.

Quoted 8 lines · Louis Li

[Why]
External monitor cannot be displayed consistently, if connecting via this Apple dongle (A1621, USB Type-C to HDMI).
By experiments, it is confirmed that the dongle needs 200ms at least to be ready for communication, after it sets HPD signal high.

[How]
When receiving HPD IRQ, delay 500ms at the beginning of handle_hpd_irq().

Am not sure how this delay shall impact on dongles that don't need it,

ideally it should be added as quirk, at least restrict it to these specific vendors.

Instead of delay, can you find any parameter to wait for for the communication to be ready,

in that way it shall be failsafe.

Quoted 26 lines

Then run the original procedure.
With this patch applied, the problem cannot be reproduced. With other dongles, test results are PASS.
Test result is PASS after system resumes from suspend.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
index 0aef92b7c037..043ddac73862 100644
@@ -1025,6 +1025,11 @@ static void handle_hpd_irq(void *param)
  	struct drm_device *dev = connector->dev;
  	enum dc_connection_type new_connection_type = dc_connection_none;
 
+    /* Some monitors/dongles need around 200ms to be ready for communication
+     * after they drive HPD signal high.
+     */
+    mdelay(500);
+
  	/* In case of failure or MST no need to update connector status or notify the OS
  	 * since (for MST case) MST does this in it's own context.
  	 */
Signature · 7 lines
Regards,
Shirish S

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 2d745e77-c6be-fb02-a1ee-c07664b911cd-5C7GfCeVMHo@public.gmane.org

#7 lore raw
Quoted 2 lines · Shirish

The UPSTREAM tag in the commit message needs to be removed.

OK. Will remove it.

Quoted 12 lines · Louis Li
Quoted 8 lines

[Why]
External monitor cannot be displayed consistently, if connecting via this Apple dongle (A1621, USB Type-C to HDMI).
By experiments, it is confirmed that the dongle needs 200ms at least to be ready for communication, after it sets HPD signal high.

[How]
When receiving HPD IRQ, delay 500ms at the beginning of handle_hpd_irq().

Am not sure how this delay shall impact on dongles that don't need it,

Quoted 8 lines

ideally it should be added as quirk, at least restrict it to these specific vendors.

Instead of delay, can you find any parameter to wait for for the communication to be ready,

in that way it shall be failsafe.

For such devices (monitors/dongles), there will be no chance to get information before the defer, because it is not ready to commmunicate right after HPD interrup. All other available dongles were verified with the patch applied, and work well still. As replied earlier, this is caused by dongle/monitor, and the solution is to have the driver better compatibility.

Louis Li

Quoted 18 lines
Quoted 18 lines

Then run the original procedure.
With this patch applied, the problem cannot be reproduced. With other dongles, test results are PASS.
Test result is PASS after system resumes from suspend.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 0aef92b7c037..043ddac73862 100644
@@ -1025,6 +1025,11 @@ static void handle_hpd_irq(void *param)
  	struct drm_device *dev = connector->dev;
  	enum dc_connection_type new_connection_type = dc_connection_none;
 
Quoted 13 lines
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
+    /* Some monitors/dongles need around 200ms to be ready for communication
+     * after they drive HPD signal high.
+     */
+    mdelay(500);
+
  	/* In case of failure or MST no need to update connector status or notify the OS
  	 * since (for MST case) MST does this in it's own context.
  	 */
Signature · 2 lines
Regards,
Shirish S

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx