diff options
author | Jani Nikula <jani.nikula@intel.com> | 2013-03-12 11:44:15 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-03-27 21:06:03 +0100 |
commit | b6b3ba5b22fc46736f3deb4c1d2300533c813a50 (patch) | |
tree | 602fce810652306c9a6581bc154df7cc39feb58f /drivers/gpu/drm/i915/intel_panel.c | |
parent | 73c352a265e8fde47a8f4dde5c92c0c88bcb9b26 (diff) | |
download | lwn-b6b3ba5b22fc46736f3deb4c1d2300533c813a50.tar.gz lwn-b6b3ba5b22fc46736f3deb4c1d2300533c813a50.zip |
drm/i915: keep backlight_level and backlight device brightness in sync
A single point of truth would be better than two, but achieving that would
require more abstractions for CONFIG_BACKLIGHT_CLASS_DEVICE=n with not a
whole lot of real benefits. Take the short route and just keep the
backlight levels in sync. In particular, update backlight device brightness
on opregion brightness changes.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_panel.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index f1530f4ad7fe..00f367af7790 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -287,6 +287,9 @@ 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 (dev_priv->backlight) + dev_priv->backlight->props.brightness = level; + if (dev_priv->backlight_enabled) intel_panel_actually_set_backlight(dev, level); } @@ -318,8 +321,12 @@ void intel_panel_enable_backlight(struct drm_device *dev, { struct drm_i915_private *dev_priv = dev->dev_private; - if (dev_priv->backlight_level == 0) + if (dev_priv->backlight_level == 0) { dev_priv->backlight_level = intel_panel_get_max_backlight(dev); + if (dev_priv->backlight) + dev_priv->backlight->props.brightness = + dev_priv->backlight_level; + } dev_priv->backlight_enabled = true; intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); @@ -427,6 +434,7 @@ int intel_panel_setup_backlight(struct drm_connector *connector) memset(&props, 0, sizeof(props)); props.type = BACKLIGHT_RAW; + props.brightness = dev_priv->backlight_level; props.max_brightness = _intel_panel_get_max_backlight(dev); if (props.max_brightness == 0) { DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n"); @@ -443,7 +451,6 @@ int intel_panel_setup_backlight(struct drm_connector *connector) dev_priv->backlight = NULL; return -ENODEV; } - dev_priv->backlight->props.brightness = intel_panel_get_backlight(dev); return 0; } |