diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-11-20 08:50:08 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-11-21 11:45:05 -0500 |
commit | a726915cef1daab57aad4c5b5e4773822f0a4bf8 (patch) | |
tree | 5702e3b08ee6bf844278a77b7ff695cf82b39385 /drivers | |
parent | 8fed6193736bf22e0e44c03ee783761e9cc37238 (diff) |
drm/i915: resurrect panel lid handling
But disabled by default. This essentially reverts
commit bcd5023c961a44c7149936553b6929b2b233dd27
Author: Dave Airlie <airlied@redhat.com>
Date: Mon Mar 14 14:17:55 2011 +1000
drm/i915: disable opregion lid detection for now
but leaves the autodetect mode disabled. There's also the explicit lid
status option added in
commit fca874092597ef946b8f07031d8c31c58b212144
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Feb 17 13:44:48 2011 +0000
drm/i915: Add a module parameter to ignore lid status
Which overloaded the meaning for the panel_ignore_lid parameter even
more. To fix up this mess, give the non-negative numbers 0,1 the
original meaning back and use negative numbers to force a given state.
So now we have
1 - disable autodetect, return unknown
0 - enable autodetect
-1 - force to disconnected/lid closed
-2 - force to connected/lid open
v2: My C programmer license has been revoked ...
v3: Beautify the code a bit, as suggested by Chris Wilson.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=27622
Tested-by: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 25 |
2 files changed, 14 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a3d754dba5a9..f5b505a5b81e 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -47,11 +47,11 @@ MODULE_PARM_DESC(modeset, | |||
47 | unsigned int i915_fbpercrtc __always_unused = 0; | 47 | unsigned int i915_fbpercrtc __always_unused = 0; |
48 | module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400); | 48 | module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400); |
49 | 49 | ||
50 | int i915_panel_ignore_lid __read_mostly = 0; | 50 | int i915_panel_ignore_lid __read_mostly = 1; |
51 | module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600); | 51 | module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600); |
52 | MODULE_PARM_DESC(panel_ignore_lid, | 52 | MODULE_PARM_DESC(panel_ignore_lid, |
53 | "Override lid status (0=autodetect [default], 1=lid open, " | 53 | "Override lid status (0=autodetect, 1=autodetect disabled [default], " |
54 | "-1=lid closed)"); | 54 | "-1=force lid closed, -2=force lid open)"); |
55 | 55 | ||
56 | unsigned int i915_powersave __read_mostly = 1; | 56 | unsigned int i915_powersave __read_mostly = 1; |
57 | module_param_named(powersave, i915_powersave, int, 0600); | 57 | module_param_named(powersave, i915_powersave, int, 0600); |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 41d463573baa..c758ad277473 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -275,7 +275,7 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level | |||
275 | } | 275 | } |
276 | 276 | ||
277 | tmp = I915_READ(BLC_PWM_CTL); | 277 | tmp = I915_READ(BLC_PWM_CTL); |
278 | if (INTEL_INFO(dev)->gen < 4) | 278 | if (INTEL_INFO(dev)->gen < 4) |
279 | level <<= 1; | 279 | level <<= 1; |
280 | tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; | 280 | tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; |
281 | I915_WRITE(BLC_PWM_CTL, tmp | level); | 281 | I915_WRITE(BLC_PWM_CTL, tmp | level); |
@@ -374,26 +374,23 @@ static void intel_panel_init_backlight(struct drm_device *dev) | |||
374 | enum drm_connector_status | 374 | enum drm_connector_status |
375 | intel_panel_detect(struct drm_device *dev) | 375 | intel_panel_detect(struct drm_device *dev) |
376 | { | 376 | { |
377 | #if 0 | ||
378 | struct drm_i915_private *dev_priv = dev->dev_private; | 377 | struct drm_i915_private *dev_priv = dev->dev_private; |
379 | #endif | ||
380 | |||
381 | if (i915_panel_ignore_lid) | ||
382 | return i915_panel_ignore_lid > 0 ? | ||
383 | connector_status_connected : | ||
384 | connector_status_disconnected; | ||
385 | 378 | ||
386 | /* opregion lid state on HP 2540p is wrong at boot up, | ||
387 | * appears to be either the BIOS or Linux ACPI fault */ | ||
388 | #if 0 | ||
389 | /* Assume that the BIOS does not lie through the OpRegion... */ | 379 | /* Assume that the BIOS does not lie through the OpRegion... */ |
390 | if (dev_priv->opregion.lid_state) | 380 | if (!i915_panel_ignore_lid && dev_priv->opregion.lid_state) { |
391 | return ioread32(dev_priv->opregion.lid_state) & 0x1 ? | 381 | return ioread32(dev_priv->opregion.lid_state) & 0x1 ? |
392 | connector_status_connected : | 382 | connector_status_connected : |
393 | connector_status_disconnected; | 383 | connector_status_disconnected; |
394 | #endif | 384 | } |
395 | 385 | ||
396 | return connector_status_unknown; | 386 | switch (i915_panel_ignore_lid) { |
387 | case -2: | ||
388 | return connector_status_connected; | ||
389 | case -1: | ||
390 | return connector_status_disconnected; | ||
391 | default: | ||
392 | return connector_status_unknown; | ||
393 | } | ||
397 | } | 394 | } |
398 | 395 | ||
399 | #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE | 396 | #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE |