Skip to contentSkip to conversation

drm/admgpu: check HDMI HPD status after ddc probe

PATCH In review Binbin Zhou 2 participants 3 messages May 9, 2020 – May 11, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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@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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +7 -2
index f355d9a752d2..ee657db9a228 100644
@@ -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);
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw
Quoted 21 lines · Binbin Zhou

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@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

Quoted 6 lines

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.

This is the part I don't understand. The logic already checks the HPD status in amdgpu_connector_check_hpd_status_unchanged(). Does it still report connected at that point? After that it tires to read the EDID in amdgpu_display_ddc_probe(). If the monitor is disconnected, there should be no EDID so dret should be false. We should try and figure out why the first HPD check reports connected and the EDID probe returns true.

Alex

Quoted 36 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +7 -3
index f355d9a752d2..ee657db9a228 100644
@@ -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

Quoted 4 lines

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

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

author
#2 lore raw
Quoted 38 lines · Alex Deucher
Quoted 21 lines · Binbin Zhou

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@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

Quoted 6 lines

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.

This is the part I don't understand. The logic already checks the HPD status in amdgpu_connector_check_hpd_status_unchanged(). Does it still report connected at that point? After that it tires to read the EDID in amdgpu_display_ddc_probe(). If the monitor is disconnected, there should be no EDID so dret should be false. We should try and figure out why the first HPD check reports connected and the EDID probe returns true.

Quoted 1 line

Alex

Emm.....
I have tried with Radeon driver, it is the same.
And In the Mint system, I find if I pick out the HDMI connector, I can see the status is still connected,
At the moment, If I do the xrandr command or open the Setting->Display application, the HDMI status will refresh to disconnected. The operation means to detect the display again.

Does the phenomenon meet the expectation?

Regards.
Aaron.

Quoted 37 lines
Quoted 37 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +7 -3
index f355d9a752d2..ee657db9a228 100644
@@ -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

Quoted 4 lines
Quoted 4 lines

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

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