diff --git a/src/i830_lvds.c b/src/i830_lvds.c index a3a56f7..47c5141 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -355,6 +355,14 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on) I830Ptr pI830 = I830PTR(pScrn); CARD32 pp_status; + /* We need to save current backlight level which can be different from + * the server start up so that we restore it correctly. + * We assume that if LVDS is turned on, it contains also correct backlight + * level. + */ + if (INREG(PP_CONTROL) & POWER_TARGET_ON) + dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); + if (on) { OUTREG(PP_CONTROL, INREG(PP_CONTROL) | POWER_TARGET_ON); do { @@ -399,12 +407,6 @@ i830_lvds_save (xf86OutputPtr output) pI830->savePP_CYCLE = INREG(PP_CYCLE); pI830->saveBLC_PWM_CTL = INREG(BLC_PWM_CTL); dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); - - /* - * If the light is off at server startup, just make it full brightness - */ - if (dev_priv->backlight_duty_cycle == 0) - dev_priv->backlight_duty_cycle = dev_priv->backlight_max; } static void @@ -1015,7 +1017,7 @@ i830_lvds_init(ScrnInfoPtr pScrn) break; } - dev_priv->backlight_duty_cycle = dev_priv->backlight_max; + dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); return;