<div dir="ltr">Thanks! I have no problem with this patch.<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 4, 2018 at 2:08 AM Guang Bai <<a href="mailto:guang.bai@intel.com">guang.bai@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On some platforms, slowly unplugging (wiggling) the HDMI cable makes<br>
the kernel to believe the HDMI display still connected. This is because<br>
the HDMI DDC lines are disconnected sometimes later after the hot-plug<br>
interrupt triggered. Use the hot plug live states to honor HDMI hot plug<br>
status in addtion to access the DDC channels.<br>
<br>
v2: Fix the formatting issue<br>
<br>
Cc: Jani Nikula <<a href="mailto:jani.nikula@intel.com" target="_blank">jani.nikula@intel.com</a>><br>
Cc: Chris Chiu <<a href="mailto:chiu@endlessm.com" target="_blank">chiu@endlessm.com</a>><br>
Signed-off-by: Guang Bai <<a href="mailto:guang.bai@intel.com" target="_blank">guang.bai@intel.com</a>><br>
---<br>
 drivers/gpu/drm/i915/intel_hotplug.c | 32 +++++++++++++++++++++++++++++---<br>
 1 file changed, 29 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c<br>
index 648a13c..98ab1ab 100644<br>
--- a/drivers/gpu/drm/i915/intel_hotplug.c<br>
+++ b/drivers/gpu/drm/i915/intel_hotplug.c<br>
@@ -246,17 +246,43 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)<br>
        intel_runtime_pm_put(dev_priv);<br>
 }<br>
<br>
+#define MAX_SHORT_PULSE_MS     100<br>
+#define PORT_CHECK_LOOP_COUNT  3<br>
+<br>
 bool intel_encoder_hotplug(struct intel_encoder *encoder,<br>
                           struct intel_connector *connector)<br>
 {<br>
        struct drm_device *dev = connector->base.dev;<br>
-       enum drm_connector_status old_status;<br>
+       enum drm_connector_status old_status, new_status;<br>
+       enum hpd_pin pin = encoder->hpd_pin;<br>
+       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);<br>
+       u32 count = 0;<br>
<br>
        WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));<br>
        old_status = connector->base.status;<br>
<br>
-       connector->base.status =<br>
-               drm_helper_probe_detect(&connector->base, NULL, false);<br>
+       /*<br>
+        * Set HDMI connection status based on hot-plug live states and<br>
+        * display probe results.<br>
+        */<br>
+       if ((encoder->type == INTEL_OUTPUT_HDMI ||<br>
+            encoder->type == INTEL_OUTPUT_DDI) &&<br>
+           dev_priv->hotplug.stats[pin].state == HPD_ENABLED) {<br>
+               do {<br>
+                       new_status = connector_status_disconnected;<br>
+                       msleep(MAX_SHORT_PULSE_MS);<br>
+<br>
+                       if (intel_digital_port_connected(encoder))<br>
+                               new_status = drm_helper_probe_detect(&connector->base,<br>
+                                                                    NULL, false);<br>
+                       if (new_status == connector_status_connected)<br>
+                               break;<br>
+               } while (++count <= PORT_CHECK_LOOP_COUNT);<br>
+               connector->base.status = new_status;<br>
+       } else {<br>
+               connector->base.status =<br>
+                       drm_helper_probe_detect(&connector->base, NULL, false);<br>
+       }<br>
<br>
        if (old_status == connector->base.status)<br>
                return false;<br>
-- <br>
2.7.4<br>
<br>
</blockquote></div>