From cb978754b052f209cd8e80e09ed1e7fd5b878e3c Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Mon, 10 Sep 2012 15:17:33 +0300 Subject: [PATCH] drm/i915: always use LBPC 0xff in combination/legacy mode LBPC value 0xff means it's not used for duty cycle multiplication per gen2 and gen4 display register specs. Keep LBPC at 0xff at all times and drop the brightness range multiplication in combination/legacy mode to hopefully avoid backlight issues and simplify code. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/intel_panel.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 3df4f5f..8704947 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -183,9 +183,6 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev) max >>= 17; else max >>= 16; - - if (is_backlight_combination_mode(dev)) - max *= 0xff; } DRM_DEBUG_DRIVER("max backlight PWM = %d\n", max); @@ -229,7 +226,8 @@ static u32 intel_panel_get_backlight(struct drm_device *dev) u8 lbpc; pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); - val *= lbpc; + if (lbpc != 0xff) + val = val * lbpc / 0xfe; } } @@ -256,14 +254,8 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level if (HAS_PCH_SPLIT(dev)) return intel_pch_panel_set_backlight(dev, level); - if (is_backlight_combination_mode(dev)) { - u32 max = intel_panel_get_max_backlight(dev); - u8 lbpc; - - lbpc = level * 0xfe / max + 1; - level /= lbpc; - pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc); - } + if (is_backlight_combination_mode(dev)) + pci_write_config_byte(dev->pdev, PCI_LBPC, 0xff); tmp = I915_READ(BLC_PWM_CTL); if (INTEL_INFO(dev)->gen < 4) -- 1.7.9.5