diff mbox series

[03/11] drm/i915: Polish some RMWs

Message ID 20231106211915.13406-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Audio fastset, and some fixes | expand

Commit Message

Ville Syrjälä Nov. 6, 2023, 9:19 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

Comments

Jani Nikula Nov. 13, 2023, 3:34 p.m. UTC | #1
On Mon, 06 Nov 2023, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> 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.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index dad8dac0ebbe..ec76006b1756 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -194,12 +194,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 */
> @@ -207,10 +204,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 */
> @@ -218,7 +214,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);
>  }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index dad8dac0ebbe..ec76006b1756 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -194,12 +194,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 */
@@ -207,10 +204,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 */
@@ -218,7 +214,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);
 }