diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 31da77f..0d06053 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -50,6 +50,8 @@ struct intel_lvds { u32 pfit_control; u32 pfit_pgm_ratios; bool pfit_dirty; + unsigned backlight_off_delay; + unsigned backlight_on_delay; struct drm_display_mode *fixed_mode; }; @@ -107,6 +109,8 @@ static void intel_lvds_enable(struct intel_lvds *intel_lvds) if (wait_for((I915_READ(stat_reg) & PP_ON) != 0, 1000)) DRM_ERROR("timed out waiting for panel to power on\n"); + msleep(intel_lvds->backlight_on_delay); + intel_panel_enable_backlight(dev); } @@ -128,6 +132,8 @@ static void intel_lvds_disable(struct intel_lvds *intel_lvds) intel_panel_disable_backlight(dev); + msleep(intel_lvds->backlight_off_delay); + I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON); if (wait_for((I915_READ(stat_reg) & PP_ON) == 0, 1000)) DRM_ERROR("timed out waiting for panel to power off\n"); @@ -1018,6 +1024,10 @@ out: */ I915_WRITE(PCH_PP_CONTROL, I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS); + intel_lvds->backlight_off_delay + = (I915_READ(PCH_PP_OFF_DELAYS) & 0x1fff) / 10 + 1; + intel_lvds->backlight_on_delay + = (I915_READ(PCH_PP_ON_DELAYS) & 0x1fff) / 10 + 1; } else { /* * Unlock registers and just @@ -1025,6 +1035,10 @@ out: */ I915_WRITE(PP_CONTROL, I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); + intel_lvds->backlight_off_delay + = (I915_READ(PP_OFF_DELAYS) & 0x1fff) / 10 + 1; + intel_lvds->backlight_on_delay + = (I915_READ(PP_ON_DELAYS) & 0x1fff) / 10 + 1; } dev_priv->lid_notifier.notifier_call = intel_lid_notify; if (acpi_lid_notifier_register(&dev_priv->lid_notifier)) {