From 9ab0e9dd32c997c04d094707a466bc4275065314 Mon Sep 17 00:00:00 2001 From: Yuan CHAO Date: Sat, 10 Sep 2016 03:37:43 +0800 Subject: [PATCH] intel i915 store extra regs for backlight MacBook Air 6,2 (2013) with intel integrated video controler. The backlight become totally dimmed (0-90%) or full brightness (>90%) after S3 suspend [1]. Similar symptron seen on other model too [2]. Here two extra registers values are stored and written back for S3 to get around the issue. [1] https://bugs.freedesktop.org/show_bug.cgi?id=67454 [2] https://bugs.freedesktop.org/show_bug.cgi?id=97486 --- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_suspend.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 20fe9d5..b67686a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1077,6 +1077,8 @@ struct i915_suspend_saved_registers { uint64_t saveFENCE[I915_MAX_NUM_FENCES]; u32 savePCH_PORT_HOTPLUG; u16 saveGCDGMBUS; + u32 savePWM_GRANULARITY; + u32 saveEDP_PPSFIXDIS; }; struct vlv_s0ix_state { diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 5cfe4c7..01a96a4 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c @@ -59,6 +59,11 @@ static void i915_save_display(struct drm_device *dev) /* save FBC interval */ if (HAS_FBC(dev) && INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev)) dev_priv->regfile.saveFBC_CONTROL = I915_READ(FBC_CONTROL); + + /* save PWM granularity */ + if (HAS_PCH_SPT(dev_priv)) + dev_priv->regfile.savePWM_GRANULARITY = I915_READ(SOUTH_CHICKEN1); + dev_priv->regfile.saveEDP_PPSFIXDIS = I915_READ(SOUTH_CHICKEN2); } static void i915_restore_display(struct drm_device *dev) @@ -99,6 +104,10 @@ static void i915_restore_display(struct drm_device *dev) I915_WRITE(FBC_CONTROL, dev_priv->regfile.saveFBC_CONTROL); i915_redisable_vga(dev); + + if (HAS_PCH_SPT(dev_priv)) + I915_WRITE(SOUTH_CHICKEN1, dev_priv->regfile.savePWM_GRANULARITY); + I915_WRITE(SOUTH_CHICKEN2, dev_priv->regfile.saveEDP_PPSFIXDIS); } int i915_save_state(struct drm_device *dev) -- 2.7.4