[PATCH] drm/radeon: Add hotplug disconnected detection to radeon_dvi_detect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
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(+)

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);

-- 
2.7.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20170707/9f0bb51d/attachment.html>


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux