From 9be1d7bcd4167e9e2cc1d6218080963e514f28d4 Mon Sep 17 00:00:00 2001 From: Luke Diamand Date: Sat, 7 May 2016 15:19:41 +0100 Subject: [PATCH] i915: hdmi: wait up to 90ms for hotplug detect On some monitors (e.g. Acer G246HYL) we need to wait for up to 90ms for hotplug detection. Otherwise we can end up with a blank screen after coming out of standby. The previous version of this code would only wait for up to 70ms, and possibly less than that, which doesn't seem to be enough (by experiment). Experimentally this section of code actually always either waits 90ms and then fails, or succeeds immediately after having previously failed. Reference: https://bugs.freedesktop.org/show_bug.cgi?id=94014 Signed-off-by: Luke Diamand --- drivers/gpu/drm/i915/intel_hdmi.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index a0d8dae..78f0549 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1401,22 +1401,30 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); struct drm_i915_private *dev_priv = to_i915(connector->dev); bool live_status = false; - unsigned int try; + unsigned long maxwait = msecs_to_jiffies(90); + unsigned long timeout = jiffies + maxwait; + unsigned long start = jiffies; DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); - for (try = 0; !live_status && try < 9; try++) { - if (try) - msleep(10); + while (time_before(jiffies, timeout)) { + live_status = intel_digital_port_connected(dev_priv, hdmi_to_dig_port(intel_hdmi)); + + if (live_status) + break; + + usleep_range(5000,10000); } if (!live_status) - DRM_DEBUG_KMS("Live status not up!"); + DRM_DEBUG_KMS("%s: Live status not up after %d ms!", + __func__, + jiffies_to_msecs(jiffies-start)); intel_hdmi_unset_edid(connector); -- 2.8.1.218.gd2cea43.dirty