From 00ce86f967a2cd2a1b6284bcdec58144b454f8c4 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 13 Aug 2014 12:23:15 +0100 Subject: [PATCH] drm/i915: Delay the hotplug event to give time for HDMI monitors to settle References: https://bugs.freedesktop.org/show_bug.cgi?id=82551 Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/i915_irq.c | 10 ++++++---- drivers/gpu/drm/i915/intel_display.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index cfbed37b86fb..e30a9e1ee549 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1488,7 +1488,7 @@ struct drm_i915_private { u32 pm_irq_mask; u32 pipestat_irq_mask[I915_MAX_PIPES]; - struct work_struct hotplug_work; + struct delayed_work hotplug_work; struct { unsigned long hpd_last_jiffies; int hpd_cnt; diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 574cf26ab02d..5f79ae15cdb0 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -1143,7 +1143,8 @@ static void i915_digport_work_func(struct work_struct *work) dev_priv->hpd_event_bits |= old_bits; spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); - schedule_work(&dev_priv->hotplug_work); + schedule_delayed_work(&dev_priv->hotplug_work, + msecs_to_jiffies(50)); } } @@ -1155,7 +1156,7 @@ static void i915_digport_work_func(struct work_struct *work) static void i915_hotplug_work_func(struct work_struct *work) { struct drm_i915_private *dev_priv = - container_of(work, struct drm_i915_private, hotplug_work); + container_of(work, struct drm_i915_private, hotplug_work.work); struct drm_device *dev = dev_priv->dev; struct drm_mode_config *mode_config = &dev->mode_config; struct intel_connector *intel_connector; @@ -1795,7 +1796,8 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev, if (queue_dig) queue_work(dev_priv->dp_wq, &dev_priv->dig_port_work); if (queue_hp) - schedule_work(&dev_priv->hotplug_work); + schedule_delayed_work(&dev_priv->hotplug_work, + msecs_to_jiffies(50)); } static void gmbus_irq_handler(struct drm_device *dev) @@ -4556,7 +4558,7 @@ void intel_irq_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func); + INIT_DELAYED_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func); INIT_WORK(&dev_priv->dig_port_work, i915_digport_work_func); INIT_WORK(&dev_priv->gpu_error.work, i915_error_work_func); INIT_WORK(&dev_priv->rps.work, gen6_pm_rps_work); diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 6ede76f021c0..f4171f1f9c48 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -13169,7 +13169,7 @@ void intel_modeset_cleanup(struct drm_device *dev) * experience fancy races otherwise. */ drm_irq_uninstall(dev); - cancel_work_sync(&dev_priv->hotplug_work); + cancel_delayed_work_sync(&dev_priv->hotplug_work); dev_priv->pm._irqs_disabled = true; /* -- 2.1.0.rc1