diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_panel.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index cb058408c70e..cb8cfb7e0974 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -492,6 +492,7 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level, | |||
492 | enum pipe pipe = intel_get_pipe_from_connector(connector); | 492 | enum pipe pipe = intel_get_pipe_from_connector(connector); |
493 | u32 freq; | 493 | u32 freq; |
494 | unsigned long flags; | 494 | unsigned long flags; |
495 | u64 n; | ||
495 | 496 | ||
496 | if (!panel->backlight.present || pipe == INVALID_PIPE) | 497 | if (!panel->backlight.present || pipe == INVALID_PIPE) |
497 | return; | 498 | return; |
@@ -502,10 +503,9 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level, | |||
502 | 503 | ||
503 | /* scale to hardware max, but be careful to not overflow */ | 504 | /* scale to hardware max, but be careful to not overflow */ |
504 | freq = panel->backlight.max; | 505 | freq = panel->backlight.max; |
505 | if (freq < max) | 506 | n = (u64)level * freq; |
506 | level = level * freq / max; | 507 | do_div(n, max); |
507 | else | 508 | level = n; |
508 | level = freq / max * level; | ||
509 | 509 | ||
510 | panel->backlight.level = level; | 510 | panel->backlight.level = level; |
511 | if (panel->backlight.device) | 511 | if (panel->backlight.device) |
@@ -1065,6 +1065,11 @@ int intel_panel_setup_backlight(struct drm_connector *connector) | |||
1065 | unsigned long flags; | 1065 | unsigned long flags; |
1066 | int ret; | 1066 | int ret; |
1067 | 1067 | ||
1068 | if (!dev_priv->vbt.backlight.present) { | ||
1069 | DRM_DEBUG_KMS("native backlight control not available per VBT\n"); | ||
1070 | return 0; | ||
1071 | } | ||
1072 | |||
1068 | /* set level and max in panel struct */ | 1073 | /* set level and max in panel struct */ |
1069 | spin_lock_irqsave(&dev_priv->backlight_lock, flags); | 1074 | spin_lock_irqsave(&dev_priv->backlight_lock, flags); |
1070 | ret = dev_priv->display.setup_backlight(intel_connector); | 1075 | ret = dev_priv->display.setup_backlight(intel_connector); |