[PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed

Andrei Paskevich andrei at tertium.org
Tue Aug 10 16:16:02 PDT 2010


Currently, the LVDS connector on i915-equipped laptops
is always reported as connected, regardless of the lid 
state and presence of external monitors. This was done
because of too many BIOSes reporting lid status in 
an unreliable way. However, in a quite usual setup of
a laptop attached to an external monitor, the only way 
to obtain the monitor's resolution on boot is to disable 
the LVDS via the boot command line, which is unfortunate 
as one have to reboot to get the internal screen back.

The following patch implements the same scheme as in 
the Nouveau driver: if the lid is reported as closed,
the LVDS connector status is set to unknown, and the
internal screen will be turned on only if there are
no other connected monitors. The ACPI lid status is
not checked if the "i915.ignorelid" parameter is set 
to zero (to account for the buggy BIOSes), which is 
the default value, so that the current behavior does
not change. 

The patch applies to the 2.6.35 kernel.

Best regards,
Andrei

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 423dc90..5206136 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -45,6 +45,9 @@ module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400);
 unsigned int i915_powersave = 1;
 module_param_named(powersave, i915_powersave, int, 0400);
 
+unsigned int i915_ignorelid = 1;
+module_param_named(ignorelid, i915_ignorelid, int, 0400);
+
 unsigned int i915_lvds_downclock = 0;
 module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 2e1744d..a03d344 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -815,6 +815,7 @@ extern struct drm_ioctl_desc i915_ioctls[];
 extern int i915_max_ioctl;
 extern unsigned int i915_fbpercrtc;
 extern unsigned int i915_powersave;
+extern unsigned int i915_ignorelid;
 extern unsigned int i915_lvds_downclock;
 
 extern int i915_suspend(struct drm_device *dev, pm_message_t state);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 0eab8df..85a09c9 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -551,11 +551,8 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
 	struct drm_device *dev = connector->dev;
 	enum drm_connector_status status = connector_status_connected;
 
-	/* ACPI lid methods were generally unreliable in this generation, so
-	 * don't even bother.
-	 */
-	if (IS_GEN2(dev) || IS_GEN3(dev))
-		return connector_status_connected;
+	if (!i915_ignorelid && !acpi_lid_open())
+		status = connector_status_unknown;
 
 	return status;
 }


More information about the dri-devel mailing list