<div dir="ltr"><div><div><div>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. <br><br></div>After looking at the code it seemed that in case of cable disconnected there is not point where hotplug state is polled. <br><br></div>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. <br><br></div>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.<br><br>From c7c97f746ce4402ae5857f63c640d691efdc5813 Mon Sep 17 00:00:00 2001<br>From: Aki Lemmetyinen <<a href="mailto:aki.lemmetyinen@gmail.com">aki.lemmetyinen@gmail.com</a>><br>Date: Fri, 7 Jul 2017 17:32:21 +0300<br>Subject: [PATCH] drm/radeon: Add hotplug disconnected detection to<br> radeon_dvi_detect<br><br>---<br> drivers/gpu/drm/radeon/radeon_connectors.c | 7 +++++++<br> 1 file changed, 7 insertions(+)<br><br>diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c<br>index 27affbd..c5a6635 100644<br>--- a/drivers/gpu/drm/radeon/radeon_connectors.c<br>+++ b/drivers/gpu/drm/radeon/radeon_connectors.c<br>@@ -1263,6 +1263,13 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)<br>         goto exit;<br>     }<br> <br>+    if (rdev->family >= CHIP_R600 &&<br>+        connector->status == connector_status_connected &&<br>+        !radeon_check_hpd_status_unchanged(connector)) {<br>+        ret = connector_status_disconnected;<br>+        goto exit;<br>+    }<br>+<br>     if (radeon_connector->ddc_bus) {<br>         dret = radeon_ddc_probe(radeon_connector, false);<br> <br>-- <br>2.7.4<br></div>