aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_panel.c')
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 67e2c1f1c9a8..5950888ae1d0 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -497,8 +497,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max)
497 goto out; 497 goto out;
498 } 498 }
499 499
500 /* scale to hardware */ 500 /* scale to hardware, but be careful to not overflow */
501 level = level * freq / max; 501 if (freq < max)
502 level = level * freq / max;
503 else
504 level = freq / max * level;
502 505
503 dev_priv->backlight.level = level; 506 dev_priv->backlight.level = level;
504 if (dev_priv->backlight.device) 507 if (dev_priv->backlight.device)
@@ -515,6 +518,17 @@ void intel_panel_disable_backlight(struct drm_device *dev)
515 struct drm_i915_private *dev_priv = dev->dev_private; 518 struct drm_i915_private *dev_priv = dev->dev_private;
516 unsigned long flags; 519 unsigned long flags;
517 520
521 /*
522 * Do not disable backlight on the vgaswitcheroo path. When switching
523 * away from i915, the other client may depend on i915 to handle the
524 * backlight. This will leave the backlight on unnecessarily when
525 * another client is not activated.
526 */
527 if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) {
528 DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");
529 return;
530 }
531
518 spin_lock_irqsave(&dev_priv->backlight.lock, flags); 532 spin_lock_irqsave(&dev_priv->backlight.lock, flags);
519 533
520 dev_priv->backlight.enabled = false; 534 dev_priv->backlight.enabled = false;