[Intel-gfx] [PATCH] CHROMIUM: i915: Allow 0 level when turning on backlight.
james.ausmus at intel.com
james.ausmus at intel.com
Fri Aug 16 02:30:46 CEST 2013
From: Daniel Erat <derat at chromium.org>
Previously, the i915 panel driver would set the backlight to
its maximum level if the level was 0 when turning the
display on. We don't need this (powerd already does it),
and removing it avoids a potential race where we jump to
100% brightness when the brightness-up key is pressed due to
Chrome turning on the display before powerd sets a non-zero
level.
BUG=chromium-os:31795,chromium-os:32447,chromium-os:35481
TEST=manual: no bright flash when increasing the backlight
from 0% on lumpy or resuming from suspend
CQ-DEPEND=I26f11562df8e01927c0220cddd91e665fe087be9
CQ-DEPEND=Ia961baae656044c3713fb967d8ad173d317c4217
Signed-off-by: Daniel Erat <derat at chromium.org>
Change-Id: I4bafa1c2e1254b09906245b59c935a4be1088d71
Reviewed-on: https://gerrit.chromium.org/gerrit/36135
Reviewed-by: Simon Que <sque at chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu at chromium.org>
[marcheu: fixup for 3.8 rebase]
---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/intel_panel.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 646c3eb..806a694 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -700,6 +700,7 @@ typedef struct drm_i915_private {
/* LVDS info */
int backlight_level; /* restore backlight to this value */
+ bool backlight_level_has_been_set;
bool backlight_enabled;
struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 92678f6..abc7064 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -319,6 +319,8 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
struct drm_i915_private *dev_priv = dev->dev_private;
dev_priv->backlight_level = level;
+ if (level > 0)
+ dev_priv->backlight_level_has_been_set = true;
if (dev_priv->backlight_enabled)
intel_panel_actually_set_backlight(dev, level);
}
@@ -350,7 +352,11 @@ static void intel_panel_enable_backlight(struct drm_device *dev,
{
struct drm_i915_private *dev_priv = dev->dev_private;
- if (dev_priv->backlight_level == 0)
+ /* Increase the level from 0 unless someone in userspace has requested a
+ * nonzero level at least once already -- in that case, we assume that
+ * they know what they're doing and will raise the level themselves. */
+ if (dev_priv->backlight_level == 0 &&
+ !dev_priv->backlight_level_has_been_set)
dev_priv->backlight_level = dev_priv->get_max_backlight(dev);
if (INTEL_INFO(dev)->gen >= 4) {
@@ -424,6 +430,7 @@ static void intel_panel_init_backlight(struct drm_device *dev)
dev_priv->enable_backlight = intel_panel_enable_backlight;
dev_priv->backlight_level = dev_priv->get_backlight(dev);
+ dev_priv->backlight_level_has_been_set = false;
dev_priv->backlight_enabled = dev_priv->backlight_level != 0;
if (dmi_check_system(link_dmi_table)) {
--
1.8.3.2
More information about the Intel-gfx
mailing list