aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_lvds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_lvds.c')
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 98ae3d73577e..808bbe412ba8 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -656,6 +656,15 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
656 return 0; 656 return 0;
657} 657}
658 658
659/*
660 * Lid events. Note the use of 'modeset_on_lid':
661 * - we set it on lid close, and reset it on open
662 * - we use it as a "only once" bit (ie we ignore
663 * duplicate events where it was already properly
664 * set/reset)
665 * - the suspend/resume paths will also set it to
666 * zero, since they restore the mode ("lid open").
667 */
659static int intel_lid_notify(struct notifier_block *nb, unsigned long val, 668static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
660 void *unused) 669 void *unused)
661{ 670{
@@ -663,13 +672,19 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
663 container_of(nb, struct drm_i915_private, lid_notifier); 672 container_of(nb, struct drm_i915_private, lid_notifier);
664 struct drm_device *dev = dev_priv->dev; 673 struct drm_device *dev = dev_priv->dev;
665 674
666 if (acpi_lid_open() && !dev_priv->suspended) { 675 if (!acpi_lid_open()) {
667 mutex_lock(&dev->mode_config.mutex); 676 dev_priv->modeset_on_lid = 1;
668 drm_helper_resume_force_mode(dev); 677 return NOTIFY_OK;
669 mutex_unlock(&dev->mode_config.mutex);
670 } 678 }
671 679
672 drm_sysfs_hotplug_event(dev_priv->dev); 680 if (!dev_priv->modeset_on_lid)
681 return NOTIFY_OK;
682
683 dev_priv->modeset_on_lid = 0;
684
685 mutex_lock(&dev->mode_config.mutex);
686 drm_helper_resume_force_mode(dev);
687 mutex_unlock(&dev->mode_config.mutex);
673 688
674 return NOTIFY_OK; 689 return NOTIFY_OK;
675} 690}