]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Rename i915_{save,restore}_state()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 5 Oct 2020 17:14:41 +0000 (20:14 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 9 Oct 2020 18:12:13 +0000 (21:12 +0300)
i915_{save,restore}_state() are actually all about the display.
Currently they are split into display part + SWF part. But since
the SWF part is also related to the display let's just move that
part into its own thing and flip the roles around so that the
current display part is the main function.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201005171441.26612-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_suspend.c
drivers/gpu/drm/i915/i915_suspend.h

index 6a3af0db86d2020a013aceb7fb391d8414e0d1ce..2641d7e16b5b7b1110acfd074190c47aba5e4405 100644 (file)
@@ -1119,7 +1119,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 
        i915_ggtt_suspend(&dev_priv->ggtt);
 
-       i915_save_state(dev_priv);
+       i915_save_display(dev_priv);
 
        opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
        intel_opregion_suspend(dev_priv, opregion_target_state);
@@ -1232,7 +1232,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
        intel_csr_ucode_resume(dev_priv);
 
-       i915_restore_state(dev_priv);
+       i915_restore_display(dev_priv);
        intel_pps_unlock_regs_wa(dev_priv);
 
        intel_init_pch_refclk(dev_priv);
index 7b64e713727002ab55dc989b981db0b24e297def..db2111fc809e16fda37537448005db34c14d686f 100644 (file)
 #include "i915_reg.h"
 #include "i915_suspend.h"
 
-static void i915_save_display(struct drm_i915_private *dev_priv)
-{
-       struct pci_dev *pdev = dev_priv->drm.pdev;
-
-       /* Display arbitration control */
-       if (INTEL_GEN(dev_priv) <= 4)
-               dev_priv->regfile.saveDSPARB = I915_READ(DSPARB);
-
-       if (IS_GEN(dev_priv, 4))
-               pci_read_config_word(pdev, GCDGMBUS,
-                                    &dev_priv->regfile.saveGCDGMBUS);
-}
-
-static void i915_restore_display(struct drm_i915_private *dev_priv)
-{
-       struct pci_dev *pdev = dev_priv->drm.pdev;
-
-       if (IS_GEN(dev_priv, 4))
-               pci_write_config_word(pdev, GCDGMBUS,
-                                     dev_priv->regfile.saveGCDGMBUS);
-
-       /* Display arbitration */
-       if (INTEL_GEN(dev_priv) <= 4)
-               I915_WRITE(DSPARB, dev_priv->regfile.saveDSPARB);
-
-       /* only restore FBC info on the platform that supports FBC*/
-       intel_fbc_global_disable(dev_priv);
-
-       intel_vga_redisable(dev_priv);
-
-       intel_gmbus_reset(dev_priv);
-}
-
-int i915_save_state(struct drm_i915_private *dev_priv)
+static void intel_save_swf(struct drm_i915_private *dev_priv)
 {
        int i;
 
-       i915_save_display(dev_priv);
-
        /* Scratch space */
        if (IS_GEN(dev_priv, 2) && IS_MOBILE(dev_priv)) {
                for (i = 0; i < 7; i++) {
@@ -90,16 +55,12 @@ int i915_save_state(struct drm_i915_private *dev_priv)
                for (i = 0; i < 3; i++)
                        dev_priv->regfile.saveSWF3[i] = I915_READ(SWF3(i));
        }
-
-       return 0;
 }
 
-int i915_restore_state(struct drm_i915_private *dev_priv)
+static void intel_restore_swf(struct drm_i915_private *dev_priv)
 {
        int i;
 
-       i915_restore_display(dev_priv);
-
        /* Scratch space */
        if (IS_GEN(dev_priv, 2) && IS_MOBILE(dev_priv)) {
                for (i = 0; i < 7; i++) {
@@ -119,6 +80,41 @@ int i915_restore_state(struct drm_i915_private *dev_priv)
                for (i = 0; i < 3; i++)
                        I915_WRITE(SWF3(i), dev_priv->regfile.saveSWF3[i]);
        }
+}
+
+void i915_save_display(struct drm_i915_private *dev_priv)
+{
+       struct pci_dev *pdev = dev_priv->drm.pdev;
+
+       /* Display arbitration control */
+       if (INTEL_GEN(dev_priv) <= 4)
+               dev_priv->regfile.saveDSPARB = I915_READ(DSPARB);
 
-       return 0;
+       if (IS_GEN(dev_priv, 4))
+               pci_read_config_word(pdev, GCDGMBUS,
+                                    &dev_priv->regfile.saveGCDGMBUS);
+
+       intel_save_swf(dev_priv);
+}
+
+void i915_restore_display(struct drm_i915_private *dev_priv)
+{
+       struct pci_dev *pdev = dev_priv->drm.pdev;
+
+       intel_restore_swf(dev_priv);
+
+       if (IS_GEN(dev_priv, 4))
+               pci_write_config_word(pdev, GCDGMBUS,
+                                     dev_priv->regfile.saveGCDGMBUS);
+
+       /* Display arbitration */
+       if (INTEL_GEN(dev_priv) <= 4)
+               I915_WRITE(DSPARB, dev_priv->regfile.saveDSPARB);
+
+       /* only restore FBC info on the platform that supports FBC*/
+       intel_fbc_global_disable(dev_priv);
+
+       intel_vga_redisable(dev_priv);
+
+       intel_gmbus_reset(dev_priv);
 }
index 3a36fb4ecc054c18133f9b61995bd40aeaaa7645..e5a611ee3d155016e044273fb4405116e6aac101 100644 (file)
@@ -8,7 +8,7 @@
 
 struct drm_i915_private;
 
-int i915_save_state(struct drm_i915_private *i915);
-int i915_restore_state(struct drm_i915_private *i915);
+void i915_save_display(struct drm_i915_private *i915);
+void i915_restore_display(struct drm_i915_private *i915);
 
 #endif /* __I915_SUSPEND_H__ */