diff options
author | Owain G. Ainsworth <oga@openbsd.org> | 2010-05-29 16:43:01 +0100 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2010-05-29 16:43:01 +0100 |
commit | 893bd522245c4e809d6912972f8baf581e052f94 (patch) | |
tree | b2343107110a594a795572f0b81580f30a9c9510 /src/i830_lvds.c | |
parent | 7585b82894a80e9deab0c22935f11e5839154c2a (diff) |
port over ironlake fdi/dpms code from 2.6.34 kernel
(cherry picked from commit 00e824b7cd59000e118dad55f563823b65148e01)
Conflicts:
src/i830_display.c
src/i830_lvds.c
from RHEL5 ironlake branch, courtesy of airlied.
Diffstat (limited to 'src/i830_lvds.c')
-rw-r--r-- | src/i830_lvds.c | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 34b3cbce..8f7044d9 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -510,68 +510,49 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on) struct i830_lvds_priv *dev_priv = intel_output->dev_priv; ScrnInfoPtr scrn = output->scrn; intel_screen_private *intel = intel_get_screen_private(scrn); - uint32_t pp_status, ctl_reg, status_reg; + uint32_t pp_status, ctl_reg, status_reg, lvds_reg; if (IS_IGDNG(intel)) { 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(intel)) { - 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 on->on, be aware to current level. */ - if ((INREG(ctl_reg) & POWER_TARGET_ON) && !dev_priv->dpmsoff) - dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); + OUTREG(lvds_reg, INREG(lvds_reg) | LVDS_PORT_EN); + INREG(lvds_reg); - /* - * 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. - */ if (!(INREG(ctl_reg) & POWER_TARGET_ON) && dev_priv->backlight_duty_cycle == 0 && intel->backlight_control_method < BCM_KERNEL) 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); dev_priv->dpmsoff = FALSE; } else { - /* - * Only save the current backlight value if we're going from - * on to off. - */ if ((INREG(ctl_reg) & POWER_TARGET_ON) && !dev_priv->dpmsoff) 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); dev_priv->dpmsoff = TRUE; } } |