A curious phenomenon in HDMI hotplug.

Aaron Chou zhoubb.aaron at gmail.com
Wed May 6 03:29:23 UTC 2020


Hi all:

I'm a newer about the amdgpu driver.
I have a question about it.
In my company, there are some experiments about HDMI hotplug.
First, I introduce the lab environment:
cpu: huawei kunpeng
os: uos
kernel: 4.19.90
video card: Radeon HD 700

the lab step is:
1, I connect the hdmi and vga with the expand mode;
2. I disconnect the hdmi connector, but the app display in the hdmi is
not back to vga, and the mode is still expand mode.

I found when I disconnect the hdmi connector, the sys files about HDMI
are keep the connection status.
Such as the value of /sys/class/drm/card0-HDMI-A-1/status is
connected, and I can read the edid file correctly.
At this moment, I use I2C driver to read the edid via /dev/i2c-X. I
can not get the edid value.

In kernel source ,I found the suspicious points in
amdgpu_connector_dvi_detect() (amdgpu_connector.c)

In amdgpu_connector_dvi_detect() function,
The hpd status was correctly through the amdgpu_display_hpd_sence(),
but the ddc probe operation is successed via
amdgpu_display_ddc_probe()

I am so confused.

Is it a normal behavior?

I have written a workaround patch to fix this problem.

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index c770d73352a7..4809ceb56f5e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -975,7 +975,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, unknown_status = false;

        if (!drm_kms_helper_is_poll_worker()) {
                r = pm_runtime_get_sync(connector->dev->dev);
@@ -990,7 +990,11 @@ 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) {
+
+       if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd))
+               unknown_status = true;
+
+       if (dret && !unknown_status) {
                amdgpu_connector->detected_by_load = false;
                amdgpu_connector_free_edid(connector);
                amdgpu_connector_get_edid(connector);

Is it correctly.

Best Wishes!

Aaron.


More information about the amd-gfx mailing list