[Intel-gfx] [PATCH] Poll for HDMI disconnects.

Stuart Abercrombie sabercrombie at chromium.org
Fri Oct 12 01:27:54 CEST 2012


Following a hotplug interrupt the driver uses a successful EDID read to indicate HDMI sink presence.

This leads to missing HDMI cable unplug events because the DDC lines can remain up, allowing an EDID read to complete, well after the HPD line goes down during unplugging

Since it is only the disconnect case that suffers from unplug ordering problems with the DDC lines, restrict polling to that.  Otherwise we waste power.
---
 drivers/gpu/drm/drm_crtc_helper.c |    8 ++++++--
 drivers/gpu/drm/i915/intel_hdmi.c |    2 +-
 include/drm/drm_crtc.h            |    2 ++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 3252e70..b38ea4f 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -938,8 +938,12 @@ static void output_poll_execute(struct work_struct *work)
 		if (!connector->polled)
 			continue;
 
-		else if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT))
-			repoll = true;
+		if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT)) {
+			if (connector->polled & DRM_CONNECTOR_POLL_DISCONNECT_ONLY)
+				repoll = (connector->status == connector_status_connected);
+			else
+				repoll = true;
+		}
 
 		old_status = connector->status;
 		/* if we are connected and don't want to poll for disconnect
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 229897f..246e8f4 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -964,7 +964,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port)
 
 	intel_encoder->type = INTEL_OUTPUT_HDMI;
 
-	connector->polled = DRM_CONNECTOR_POLL_HPD;
+	connector->polled = DRM_CONNECTOR_POLL_DISCONNECT | DRM_CONNECTOR_POLL_DISCONNECT_ONLY;
 	connector->interlace_allowed = 1;
 	connector->doublescan_allowed = 0;
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 316ce64..a60abb5 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -503,6 +503,8 @@ enum drm_connector_force {
 /* can cleanly poll for disconnections without flickering the screen */
 /* DACs should rarely do this without a lot of testing */
 #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
+/* Only poll for disconnections. */
+#define DRM_CONNECTOR_POLL_DISCONNECT_ONLY (1 << 3)
 
 #define MAX_ELD_BYTES	128
 
-- 
1.7.7.3




More information about the Intel-gfx mailing list