diff options
author | Jesse Barnes <jbarnes@hobbes.virtuousgeek.org> | 2008-01-04 15:01:25 -0800 |
---|---|---|
committer | Jesse Barnes <jbarnes@hobbes.virtuousgeek.org> | 2008-01-04 15:01:25 -0800 |
commit | 71143200ed66cb9dcc1f9edf98128be80b05619c (patch) | |
tree | 87e219f024afcc8b0ee4fccfa70f3d10553c3bd6 /src/i830_lvds.c | |
parent | b434bf4029d1a405216454629bcea717c779ae5a (diff) |
Don't modify low bit of BLC_PWM_CTL when using combo backlight control
On some platforms, the low bit of BLC_PWM_CTL is wired as a 'max brightness'
flag, rather than a regular part of the backlight duty cycle. So when in the
combo mode, divide the total number of backlight levels available by two
(tossing one bit) and adjust the programming in the set_brightness routine.
Note that platforms with this behavior may need quirks added so that they work
by default.
Diffstat (limited to 'src/i830_lvds.c')
-rw-r--r-- | src/i830_lvds.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/i830_lvds.c b/src/i830_lvds.c index c58a7e0a..cf0e3453 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -234,6 +234,12 @@ i830_lvds_set_backlight_combo(xf86OutputPtr output, int level) #endif } + /* + * Don't set the lowest bit in combo configs since it can act as a flag for + * max brightness. + */ + level <<= 1; + blc_pwm_ctl = INREG(BLC_PWM_CTL); blc_pwm_ctl &= ~BACKLIGHT_DUTY_CYCLE_MASK; OUTREG(BLC_PWM_CTL, blc_pwm_ctl | (level << BACKLIGHT_DUTY_CYCLE_SHIFT)); @@ -248,7 +254,17 @@ i830_lvds_get_backlight_combo(xf86OutputPtr output) blc_pwm_ctl = INREG(BLC_PWM_CTL); blc_pwm_ctl &= BACKLIGHT_DUTY_CYCLE_MASK; - return blc_pwm_ctl; + + /* Since we don't use the low bit when using combo, the value is halved */ + + return blc_pwm_ctl >> 1; +} + +static int +i830_lvds_get_backlight_max_combo(xf86OutputPtr output) +{ + /* Since we don't set the low bit when using combo, the range is halved */ + return i830_lvds_get_backlight_max_native(output) >> 1; } /* @@ -661,7 +677,7 @@ i830_lvds_set_backlight_control(xf86OutputPtr output) dev_priv->set_backlight = i830_lvds_set_backlight_combo; dev_priv->get_backlight = i830_lvds_get_backlight_combo; dev_priv->backlight_max = - i830_lvds_get_backlight_max_native(output); + i830_lvds_get_backlight_max_combo(output); break; case BCM_KERNEL: dev_priv->set_backlight = i830_lvds_set_backlight_kernel; @@ -1003,7 +1019,7 @@ i830_lvds_init(ScrnInfoPtr pScrn) case BCM_COMBO: dev_priv->set_backlight = i830_lvds_set_backlight_combo; dev_priv->get_backlight = i830_lvds_get_backlight_combo; - dev_priv->backlight_max = i830_lvds_get_backlight_max_native(output); + dev_priv->backlight_max = i830_lvds_get_backlight_max_combo(output); break; case BCM_KERNEL: dev_priv->set_backlight = i830_lvds_set_backlight_kernel; |