]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915/pps: move pps code over from intel_display.c and refactor
authorJani Nikula <jani.nikula@intel.com>
Wed, 20 Jan 2021 10:18:32 +0000 (12:18 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 21 Jan 2021 11:26:19 +0000 (13:26 +0200)
intel_display.c has some pps functions that belong to intel_pps.c. Move
them over.

While at it, refactor the duplicate intel_pps_init() in intel_display.c
into an orthogonal intel_pps_setup() in intel_pps.c, and call it earlier
in intel_modeset_init_nogem().

Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210120101834.19813-2-jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/i915/display/intel_pps.c
drivers/gpu/drm/i915/display/intel_pps.h
drivers/gpu/drm/i915/i915_drv.c

index 32ff9d201aeb605bd0e905eb368b51da9ac064bf..16f3f475a6a4a56a50751e355dd9c3cb758c3bbf 100644 (file)
@@ -83,6 +83,7 @@
 #include "intel_overlay.h"
 #include "intel_pipe_crc.h"
 #include "intel_pm.h"
+#include "intel_pps.h"
 #include "intel_psr.h"
 #include "intel_quirks.h"
 #include "intel_sideband.h"
@@ -13795,48 +13796,12 @@ static bool intel_ddi_crt_present(struct drm_i915_private *dev_priv)
        return true;
 }
 
-void intel_pps_unlock_regs_wa(struct drm_i915_private *dev_priv)
-{
-       int pps_num;
-       int pps_idx;
-
-       if (HAS_DDI(dev_priv))
-               return;
-       /*
-        * This w/a is needed at least on CPT/PPT, but to be sure apply it
-        * everywhere where registers can be write protected.
-        */
-       if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-               pps_num = 2;
-       else
-               pps_num = 1;
-
-       for (pps_idx = 0; pps_idx < pps_num; pps_idx++) {
-               u32 val = intel_de_read(dev_priv, PP_CONTROL(pps_idx));
-
-               val = (val & ~PANEL_UNLOCK_MASK) | PANEL_UNLOCK_REGS;
-               intel_de_write(dev_priv, PP_CONTROL(pps_idx), val);
-       }
-}
-
-static void intel_pps_init(struct drm_i915_private *dev_priv)
-{
-       if (HAS_PCH_SPLIT(dev_priv) || IS_GEN9_LP(dev_priv))
-               dev_priv->pps_mmio_base = PCH_PPS_BASE;
-       else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-               dev_priv->pps_mmio_base = VLV_PPS_BASE;
-       else
-               dev_priv->pps_mmio_base = PPS_BASE;
-
-       intel_pps_unlock_regs_wa(dev_priv);
-}
-
 static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 {
        struct intel_encoder *encoder;
        bool dpd_is_edp = false;
 
-       intel_pps_init(dev_priv);
+       intel_pps_unlock_regs_wa(dev_priv);
 
        if (!HAS_DISPLAY(dev_priv))
                return;
@@ -14848,6 +14813,8 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915)
 
        intel_panel_sanitize_ssc(i915);
 
+       intel_pps_setup(i915);
+
        intel_gmbus_setup(i915);
 
        drm_dbg_kms(&i915->drm, "%d display pipe%s available.\n",
index bb72de1529494b1e50fd9d933dd89c628dc4d73e..64ffa34544a7d4d181550ef80b5a9168c7a5b374 100644 (file)
@@ -546,7 +546,6 @@ unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info
 unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info);
 bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv);
 int intel_display_suspend(struct drm_device *dev);
-void intel_pps_unlock_regs_wa(struct drm_i915_private *dev_priv);
 void intel_encoder_destroy(struct drm_encoder *encoder);
 struct drm_display_mode *
 intel_encoder_current_mode(struct intel_encoder *encoder);
index da6ee0b527419045692ff375ca4953eb1a40a87c..69d9d41b6d226a1ca4723d37e41239d3a3f5c448 100644 (file)
@@ -1370,3 +1370,37 @@ void intel_pps_init(struct intel_dp *intel_dp)
 
        intel_pps_encoder_reset(intel_dp);
 }
+
+void intel_pps_unlock_regs_wa(struct drm_i915_private *dev_priv)
+{
+       int pps_num;
+       int pps_idx;
+
+       if (HAS_DDI(dev_priv))
+               return;
+       /*
+        * This w/a is needed at least on CPT/PPT, but to be sure apply it
+        * everywhere where registers can be write protected.
+        */
+       if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
+               pps_num = 2;
+       else
+               pps_num = 1;
+
+       for (pps_idx = 0; pps_idx < pps_num; pps_idx++) {
+               u32 val = intel_de_read(dev_priv, PP_CONTROL(pps_idx));
+
+               val = (val & ~PANEL_UNLOCK_MASK) | PANEL_UNLOCK_REGS;
+               intel_de_write(dev_priv, PP_CONTROL(pps_idx), val);
+       }
+}
+
+void intel_pps_setup(struct drm_i915_private *i915)
+{
+       if (HAS_PCH_SPLIT(i915) || IS_GEN9_LP(i915))
+               i915->pps_mmio_base = PCH_PPS_BASE;
+       else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
+               i915->pps_mmio_base = VLV_PPS_BASE;
+       else
+               i915->pps_mmio_base = PPS_BASE;
+}
index 22045c5cdc864ea1a3de5e66d88b23d332cadf1e..fbbcca782e7b6f8e5fe2e693d2d4db9cfc1b5ab2 100644 (file)
@@ -46,4 +46,7 @@ void intel_pps_reset_all(struct drm_i915_private *i915);
 void vlv_pps_init(struct intel_encoder *encoder,
                  const struct intel_crtc_state *crtc_state);
 
+void intel_pps_unlock_regs_wa(struct drm_i915_private *i915);
+void intel_pps_setup(struct drm_i915_private *i915);
+
 #endif /* __INTEL_PPS_H__ */
index f5666b44ea9dac8b64a46d15be6be9f5b1d27edb..b37b189e219c4eecacd445ce68db721b73257241 100644 (file)
@@ -58,6 +58,7 @@
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pipe_crc.h"
+#include "display/intel_pps.h"
 #include "display/intel_sprite.h"
 #include "display/intel_vga.h"