drm/i915: unify remaining register save/restore code a bit
authorJani Nikula <jani.nikula@intel.com>
Wed, 12 Nov 2014 15:01:10 +0000 (17:01 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 14 Nov 2014 09:29:28 +0000 (10:29 +0100)
Use the same conditions, group by features, add comments.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_suspend.c

index 3c1fccfacac118dcd3ee9376a919ab1b771c6ae1..dfe661743398b1c90e0f9dc4b25ff6e9d551985c 100644 (file)
@@ -203,21 +203,19 @@ static void i915_save_display(struct drm_device *dev)
                i915_save_display_reg(dev);
 
        /* LVDS state */
-       if (HAS_PCH_SPLIT(dev)) {
-               dev_priv->regfile.savePP_CONTROL = I915_READ(PCH_PP_CONTROL);
-               if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
-                       dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
-       } else if (!IS_VALLEYVIEW(dev)) {
-               dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL);
-               if (IS_MOBILE(dev) && !IS_I830(dev))
-                       dev_priv->regfile.saveLVDS = I915_READ(LVDS);
-       }
+       if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
+               dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
+       else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
+               dev_priv->regfile.saveLVDS = I915_READ(LVDS);
 
+       /* Panel power sequencer */
        if (HAS_PCH_SPLIT(dev)) {
+               dev_priv->regfile.savePP_CONTROL = I915_READ(PCH_PP_CONTROL);
                dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS);
                dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS);
                dev_priv->regfile.savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR);
        } else if (!IS_VALLEYVIEW(dev)) {
+               dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL);
                dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS);
                dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS);
                dev_priv->regfile.savePP_DIVISOR = I915_READ(PP_DIVISOR);
@@ -246,11 +244,13 @@ static void i915_restore_display(struct drm_device *dev)
        if (drm_core_check_feature(dev, DRIVER_MODESET))
                mask = ~LVDS_PORT_EN;
 
+       /* LVDS state */
        if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
                I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
        else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
                I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
 
+       /* Panel power sequencer */
        if (HAS_PCH_SPLIT(dev)) {
                I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS);
                I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS);