drm/i915: Polish some RMWs
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 21 Nov 2023 05:43:16 +0000 (07:43 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 23 Nov 2023 12:33:10 +0000 (14:33 +0200)
Doing the if-else around RMWs is kinda silly. Just set/clear the
apporiate bits with a single RMW.

Also unify the coding style a bit icl_wa_cursorclkgating() while at it.

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

index 6adc32e2f477440c7987498ce2635afb7c93686f..98ea3591665fd6ddb55b5a2d9d2401e475ab32e9 100644 (file)
@@ -193,12 +193,9 @@ static bool is_hdr_mode(const struct intel_crtc_state *crtc_state)
 static void
 skl_wa_827(struct drm_i915_private *dev_priv, enum pipe pipe, bool enable)
 {
-       if (enable)
-               intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe),
-                            0, DUPS1_GATING_DIS | DUPS2_GATING_DIS);
-       else
-               intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe),
-                            DUPS1_GATING_DIS | DUPS2_GATING_DIS, 0);
+       intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe),
+                    DUPS1_GATING_DIS | DUPS2_GATING_DIS,
+                    enable ? DUPS1_GATING_DIS | DUPS2_GATING_DIS : 0);
 }
 
 /* Wa_2006604312:icl,ehl */
@@ -206,10 +203,9 @@ static void
 icl_wa_scalerclkgating(struct drm_i915_private *dev_priv, enum pipe pipe,
                       bool enable)
 {
-       if (enable)
-               intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe), 0, DPFR_GATING_DIS);
-       else
-               intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe), DPFR_GATING_DIS, 0);
+       intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe),
+                    DPFR_GATING_DIS,
+                    enable ? DPFR_GATING_DIS : 0);
 }
 
 /* Wa_1604331009:icl,jsl,ehl */
@@ -217,7 +213,8 @@ static void
 icl_wa_cursorclkgating(struct drm_i915_private *dev_priv, enum pipe pipe,
                       bool enable)
 {
-       intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe), CURSOR_GATING_DIS,
+       intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe),
+                    CURSOR_GATING_DIS,
                     enable ? CURSOR_GATING_DIS : 0);
 }