diff options
author | Dave Airlie <airlied@airlied-rhel5.(none)> | 2010-05-27 14:51:36 +1000 |
---|---|---|
committer | Dave Airlie <airlied@airlied-rhel5.(none)> | 2010-05-27 14:53:15 +1000 |
commit | 00e824b7cd59000e118dad55f563823b65148e01 (patch) | |
tree | 1b4d3b5a44a8524a79c8e13723869699c265c70c /src/i830_lvds.c | |
parent | be4d641a889a1bb49ac66b8a95bbd6ff0872f22d (diff) |
Diffstat (limited to 'src/i830_lvds.c')
-rw-r--r-- | src/i830_lvds.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 4d9cb6be..ce6910fd 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -404,61 +404,47 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on) struct i830_lvds_priv *dev_priv = intel_output->dev_priv; ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 pp_status, ctl_reg, status_reg; + CARD32 pp_status, ctl_reg, status_reg, lvds_reg; if (IS_IGDNG(pI830)) { ctl_reg = PCH_PP_CONTROL; status_reg = PCH_PP_STATUS; + lvds_reg = PCH_LVDS; } else { ctl_reg = PP_CONTROL; status_reg = PP_STATUS; - } - - if (IS_IGDNG(pI830)) { - CARD32 temp; - if (on) { - temp = INREG(PCH_LVDS); - OUTREG(PCH_LVDS, temp | PORT_ENABLE); - temp = INREG(PCH_LVDS); - } else { - temp = INREG(PCH_LVDS); - OUTREG(PCH_LVDS, temp & ~PORT_ENABLE); - temp = INREG(PCH_LVDS); - } - usleep(100); + lvds_reg = LVDS; } if (on) { - /* - * If we're going from off->on we may need to turn on the backlight. - * We should use the saved value whenever possible, but on some - * machines 0 is a valid backlight value (due to an external backlight - * controller for example), so on them, when turning LVDS back on, - * they'll always re-maximize the brightness. - */ + OUTREG(lvds_reg, INREG(lvds_reg) | LVDS_PORT_EN); + INREG(lvds_reg); + if (!(INREG(ctl_reg) & POWER_TARGET_ON) && dev_priv->backlight_duty_cycle == 0) dev_priv->backlight_duty_cycle = dev_priv->backlight_max; OUTREG(ctl_reg, INREG(ctl_reg) | POWER_TARGET_ON); + INREG(ctl_reg); do { pp_status = INREG(status_reg); } while ((pp_status & PP_ON) == 0); + /* set backlight */ dev_priv->set_backlight(output, dev_priv->backlight_duty_cycle); } else { - /* - * Only save the current backlight value if we're going from - * on to off. - */ if (INREG(ctl_reg) & POWER_TARGET_ON) dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); dev_priv->set_backlight(output, 0); OUTREG(ctl_reg, INREG(ctl_reg) & ~POWER_TARGET_ON); + INREG(ctl_reg); do { pp_status = INREG(status_reg); } while (pp_status & PP_ON); + + OUTREG(lvds_reg, INREG(lvds_reg) & ~LVDS_PORT_EN); + INREG(lvds_reg); } } |