diff mbox

[1/6] drm/i915: don't restore LVDS enable state blindly v2

Message ID 1361304703-2869-2-git-send-email-jbarnes@virtuousgeek.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jesse Barnes Feb. 19, 2013, 8:11 p.m. UTC
We still rely on a few LVDS bits, but restoring the enable bit can cause
trouble at this point, so don't.

v2: use the right mask to prevent restore (Daniel)
    conditionalize on KMS support (Denial)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_suspend.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Paulo Zanoni Feb. 19, 2013, 8:39 p.m. UTC | #1
Hi

2013/2/19 Jesse Barnes <jbarnes@virtuousgeek.org>:
> We still rely on a few LVDS bits, but restoring the enable bit can cause
> trouble at this point, so don't.
>
> v2: use the right mask to prevent restore (Daniel)
>     conditionalize on KMS support (Denial)
>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Briefly tested on SNB, and it still works.

> ---
>  drivers/gpu/drm/i915/i915_suspend.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
> index 2135f21..c1e02b0 100644
> --- a/drivers/gpu/drm/i915/i915_suspend.c
> +++ b/drivers/gpu/drm/i915/i915_suspend.c
> @@ -255,6 +255,7 @@ static void i915_save_display(struct drm_device *dev)
>  static void i915_restore_display(struct drm_device *dev)
>  {
>         struct drm_i915_private *dev_priv = dev->dev_private;
> +       u32 mask = 0xffffffff;
>
>         /* Display arbitration */
>         if (INTEL_INFO(dev)->gen <= 4)
> @@ -267,10 +268,13 @@ static void i915_restore_display(struct drm_device *dev)
>         if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
>                 I915_WRITE(BLC_PWM_CTL2, dev_priv->regfile.saveBLC_PWM_CTL2);
>
> +       if (drm_core_check_feature(dev, DRIVER_MODESET))
> +               mask = ~LVDS_PORT_EN;
> +
>         if (HAS_PCH_SPLIT(dev)) {
> -               I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS);
> +               I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
>         } else if (IS_MOBILE(dev) && !IS_I830(dev))
> -               I915_WRITE(LVDS, dev_priv->regfile.saveLVDS);
> +               I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
>
>         if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))
>                 I915_WRITE(PFIT_CONTROL, dev_priv->regfile.savePFIT_CONTROL);
> --
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter Feb. 19, 2013, 9:35 p.m. UTC | #2
On Tue, Feb 19, 2013 at 05:39:49PM -0300, Paulo Zanoni wrote:
> Hi
> 
> 2013/2/19 Jesse Barnes <jbarnes@virtuousgeek.org>:
> > We still rely on a few LVDS bits, but restoring the enable bit can cause
> > trouble at this point, so don't.
> >
> > v2: use the right mask to prevent restore (Daniel)
> >     conditionalize on KMS support (Denial)
> >
> > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> Briefly tested on SNB, and it still works.
Queued for -next, thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 2135f21..c1e02b0 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -255,6 +255,7 @@  static void i915_save_display(struct drm_device *dev)
 static void i915_restore_display(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 mask = 0xffffffff;
 
 	/* Display arbitration */
 	if (INTEL_INFO(dev)->gen <= 4)
@@ -267,10 +268,13 @@  static void i915_restore_display(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
 		I915_WRITE(BLC_PWM_CTL2, dev_priv->regfile.saveBLC_PWM_CTL2);
 
+	if (drm_core_check_feature(dev, DRIVER_MODESET))
+		mask = ~LVDS_PORT_EN;
+
 	if (HAS_PCH_SPLIT(dev)) {
-		I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS);
+		I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
 	} else if (IS_MOBILE(dev) && !IS_I830(dev))
-		I915_WRITE(LVDS, dev_priv->regfile.saveLVDS);
+		I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
 
 	if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))
 		I915_WRITE(PFIT_CONTROL, dev_priv->regfile.savePFIT_CONTROL);