[PATCH] drm/i915: Fix the HDMI hot plug disconnection failure (v3)

Guang Bai guang.bai at intel.com
Thu Nov 8 14:49:55 UTC 2018


On some platforms, slowly unplugging (wiggling) the HDMI cable makes
the kernel to believe the HDMI display still connected. This is because
the HDMI DDC lines are disconnected sometimes later after the hot-plug
interrupt triggered. Use the hot plug live states to honor HDMI hot plug
status in addtion to access the DDC channels.

v2: Fix the formatting issue
v3: Use connector type to apply changes to HDMI port only (James & Matt)

Cc: Jani Nikula <jani.nikula at intel.com>
Cc: Chris Chiu <chiu at endlessm.com>
Signed-off-by: Guang Bai <guang.bai at intel.com>
---
 drivers/gpu/drm/i915/intel_hotplug.c | 40 ++++++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 42e61e1..d5958c6 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -265,17 +265,49 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
 	intel_runtime_pm_put(dev_priv);
 }
 
+#define MAX_SHORT_PULSE_MS	100
+#define PORT_CHECK_LOOP_COUNT	3
+
 bool intel_encoder_hotplug(struct intel_encoder *encoder,
 			   struct intel_connector *connector)
 {
 	struct drm_device *dev = connector->base.dev;
-	enum drm_connector_status old_status;
+	/*struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);*/
+	enum drm_connector_status old_status, new_status;
+	/*
+	enum hpd_pin pin = encoder->hpd_pin;
+	int connector_type = connector->base.connector_type;
+	*/
+	u32 count = 0;
 
 	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
 	old_status = connector->base.status;
-
-	connector->base.status =
-		drm_helper_probe_detect(&connector->base, NULL, false);
+	/*
+	 * Set HDMI connection status based on hot-plug live states and
+	 * display probe results.
+	 */
+	/* TBD-gbai3 - Debug the trybot test failure */
+	if (0) {
+	/*
+	if ((connector_type == DRM_MODE_CONNECTOR_HDMIA ||
+	     connector_type == DRM_MODE_CONNECTOR_HDMIB) &&
+	    dev_priv->hotplug.stats[pin].state == HPD_ENABLED) {
+	*/
+		do {
+			new_status = connector_status_disconnected;
+			msleep(MAX_SHORT_PULSE_MS);
+
+			if (intel_digital_port_connected(encoder))
+				new_status = drm_helper_probe_detect(&connector->base,
+								     NULL, false);
+			if (new_status == connector_status_connected)
+				break;
+		} while (++count <= PORT_CHECK_LOOP_COUNT);
+		connector->base.status = new_status;
+	} else {
+		connector->base.status =
+			drm_helper_probe_detect(&connector->base, NULL, false);
+	}
 
 	if (old_status == connector->base.status)
 		return false;
-- 
2.7.4



More information about the Intel-gfx-trybot mailing list