All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guang Bai <guang.bai@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>, Chris Chiu <chiu@endlessm.com>
Subject: [PATCH] drm/i915: Fix the HDMI hot plug disconnection failure
Date: Tue,  2 Oct 2018 22:12:36 -0700	[thread overview]
Message-ID: <1538543556-31778-1-git-send-email-guang.bai@intel.com> (raw)

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.

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

diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 648a13c..db6288f 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -246,17 +246,42 @@ 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;
+	enum drm_connector_status old_status, new_status;
+	enum hpd_pin pin = encoder->hpd_pin;
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	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.
+	 */
+	if ((encoder->type == INTEL_OUTPUT_HDMI ||
+	     encoder->type == INTEL_OUTPUT_DDI) &&
+	    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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2018-10-03  5:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03  5:12 Guang Bai [this message]
2018-10-03  5:33 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix the HDMI hot plug disconnection failure Patchwork
2018-10-03  5:57 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-03  9:22 ` [PATCH] " Chris Chiu
2018-10-03 17:57   ` [PATCH] drm/i915: Fix the HDMI hot plug disconnection failure (v2) Guang Bai
2018-10-08 14:35     ` Chris Chiu
2018-10-08 15:56       ` Guang Bai
2018-10-10 17:52         ` Guang Bai
2018-10-23  9:14           ` Chris Chiu
2018-10-29 17:12             ` Guang Bai
2018-11-13  1:04               ` Chris Chiu
2018-11-13  5:07                 ` Guang Bai
2018-11-13 11:07                   ` Jani Nikula
2018-11-28 22:58                     ` Guang Bai
2018-11-20  3:11                   ` Chris Chiu
2018-10-03  9:34 ` ✗ Fi.CI.IGT: failure for drm/i915: Fix the HDMI hot plug disconnection failure Patchwork
2018-10-03  9:52   ` Martin Peres
2018-10-03 18:41 ` ✗ Fi.CI.BAT: failure for drm/i915: Fix the HDMI hot plug disconnection failure (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1538543556-31778-1-git-send-email-guang.bai@intel.com \
    --to=guang.bai@intel.com \
    --cc=chiu@endlessm.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.