|
@@ -656,6 +656,15 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Lid events. Note the use of 'modeset_on_lid':
|
|
|
|
+ * - we set it on lid close, and reset it on open
|
|
|
|
+ * - we use it as a "only once" bit (ie we ignore
|
|
|
|
+ * duplicate events where it was already properly
|
|
|
|
+ * set/reset)
|
|
|
|
+ * - the suspend/resume paths will also set it to
|
|
|
|
+ * zero, since they restore the mode ("lid open").
|
|
|
|
+ */
|
|
static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
|
|
static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
|
|
void *unused)
|
|
void *unused)
|
|
{
|
|
{
|
|
@@ -663,13 +672,19 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
|
|
container_of(nb, struct drm_i915_private, lid_notifier);
|
|
container_of(nb, struct drm_i915_private, lid_notifier);
|
|
struct drm_device *dev = dev_priv->dev;
|
|
struct drm_device *dev = dev_priv->dev;
|
|
|
|
|
|
- if (acpi_lid_open() && !dev_priv->suspended) {
|
|
|
|
- mutex_lock(&dev->mode_config.mutex);
|
|
|
|
- drm_helper_resume_force_mode(dev);
|
|
|
|
- mutex_unlock(&dev->mode_config.mutex);
|
|
|
|
|
|
+ if (!acpi_lid_open()) {
|
|
|
|
+ dev_priv->modeset_on_lid = 1;
|
|
|
|
+ return NOTIFY_OK;
|
|
}
|
|
}
|
|
|
|
|
|
- drm_sysfs_hotplug_event(dev_priv->dev);
|
|
|
|
|
|
+ if (!dev_priv->modeset_on_lid)
|
|
|
|
+ return NOTIFY_OK;
|
|
|
|
+
|
|
|
|
+ dev_priv->modeset_on_lid = 0;
|
|
|
|
+
|
|
|
|
+ mutex_lock(&dev->mode_config.mutex);
|
|
|
|
+ drm_helper_resume_force_mode(dev);
|
|
|
|
+ mutex_unlock(&dev->mode_config.mutex);
|
|
|
|
|
|
return NOTIFY_OK;
|
|
return NOTIFY_OK;
|
|
}
|
|
}
|