[PATCH] drm/admgpu: check HDMI HPD status after ddc probe

Binbin Zhou zhoubb.aaron at gmail.com
Sat May 9 05:48:34 UTC 2020


Now, we check the presence of the EDID to determine if there is a monitor
present.

DVI-I connectors have both analog and digital encoders and the HPD pin
is only reliable on the digital part.

But when I pull out the Radeon HD8570's HDMI connector, the HDMI status
in system is still perform connected.

asd at asd-PC:~$ cat /sys/class/drm/card0-HDMI-A-1/status 
connected

At this moment, if I want to read the EDID by /dev/i2c-X with I2C
driver, there is no EDID can be read.

Dmesg witha drm.debug=0x6, we can find the following message:

[drm:drm_helper_hpd_irq_event] [CONNECTOR:41:HDMI-A-1] status
updated from connected to connected

Based on the appearance, I thought to check the HPD status again, because
the HPD status is perform disconnected, after amdgpu_display_ddc_probe().
If the amdgpu_display_hpd_sense() return false, I think the HDMI connector
status is undefined, and just return disconnected simply.

I'm not sure if it happened to other AMD cards.

Signed-off-by: Binbin Zhou <zhoubb.aaron at gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index f355d9a752d2..ee657db9a228 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -973,7 +973,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
 	const struct drm_encoder_helper_funcs *encoder_funcs;
 	int r;
 	enum drm_connector_status ret = connector_status_disconnected;
-	bool dret = false, broken_edid = false;
+	bool dret = false, broken_edid = false, undefined_flag = false;
 
 	if (!drm_kms_helper_is_poll_worker()) {
 		r = pm_runtime_get_sync(connector->dev->dev);
@@ -988,7 +988,12 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
 
 	if (amdgpu_connector->ddc_bus)
 		dret = amdgpu_display_ddc_probe(amdgpu_connector, false);
-	if (dret) {
+
+	/* Check the HDMI HPD pin status again */
+	if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd))
+		undefined_flag = true;
+
+	if (dret && !undefined_flag) {
 		amdgpu_connector->detected_by_load = false;
 		amdgpu_connector_free_edid(connector);
 		amdgpu_connector_get_edid(connector);
-- 
2.17.1



More information about the amd-gfx mailing list