drm/radeon: Add hotplug disconnected detection to radeon_dvi_detect

Submitted by Aki Lemmetyinen on July 7, 2017, 4:28 p.m.

Details

Message ID CAK+345KVUHc5q_RDWx-JS1W0XWB92HueQm=wTNH_RK1jwj7Jbw@mail.gmail.com
State New
Headers show
Series "drm/radeon: Add hotplug disconnected detection to radeon_dvi_detect" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Aki Lemmetyinen July 7, 2017, 4:28 p.m.
I made a quick script for my HP Pavilion dv7 to automatically switch audio
to hdmi and back at hotplug event, when I noticed that the driver do not
react properly to plug/unplug. /sys/class/drm/card0-HDMI-A-1/status was
"connected" even after unplugging the cable.

After looking at the code it seemed that in case of cable disconnected
there is not point where hotplug state is polled.

Function radeon_connector_hotplug do not do much with hdmi and
radeon_hotplug_work_func cals drm_helper_hpd_irq_event which calls
radeon_dvi_detect where, in case of disconnected cable, it return with
connector_status_connected, just throwing an error for missing EDID.

It looks like there would maybe be a need for a bigger rewrite of hotplug
code, but just to get connector state working properly, I added these few
lines to radeon_connectors.c.

From c7c97f746ce4402ae5857f63c640d691efdc5813 Mon Sep 17 00:00:00 2001
From: Aki Lemmetyinen <aki.lemmetyinen@gmail.com>
Date: Fri, 7 Jul 2017 17:32:21 +0300
Subject: [PATCH] drm/radeon: Add hotplug disconnected detection to
 radeon_dvi_detect

---
 drivers/gpu/drm/radeon/radeon_connectors.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c
b/drivers/gpu/drm/radeon/radeon_connectors.c
index 27affbd..c5a6635 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1263,6 +1263,13 @@  radeon_dvi_detect(struct drm_connector *connector,
bool force)
         goto exit;
     }

+    if (rdev->family >= CHIP_R600 &&
+        connector->status == connector_status_connected &&
+        !radeon_check_hpd_status_unchanged(connector)) {
+        ret = connector_status_disconnected;
+        goto exit;
+    }
+
     if (radeon_connector->ddc_bus) {
         dret = radeon_ddc_probe(radeon_connector, false);