diff mbox series

[3/8] drm/i915/cdclk: Only compute squash waveform when necessary

Message ID 20240304183028.195057-4-gustavo.sousa@intel.com (mailing list archive)
State New, archived
Headers show
Series Enable LNL display | expand

Commit Message

Gustavo Sousa March 4, 2024, 6:30 p.m. UTC
It is no use computing the squash waveform if we are not going to use
it. Move the call to cdclk_squash_waveform() inside the block guarded by
HAS_CDCLK_SQUASH(dev_priv).

Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Matt Roper March 4, 2024, 10:04 p.m. UTC | #1
On Mon, Mar 04, 2024 at 03:30:22PM -0300, Gustavo Sousa wrote:
> It is no use computing the squash waveform if we are not going to use
> it. Move the call to cdclk_squash_waveform() inside the block guarded by
> HAS_CDCLK_SQUASH(dev_priv).
> 
> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>

You could also move the 'u32 waveform' declaration from the top of the
function inside the block too to help prevent any future mistakes of
using it unitialized.

Either way,

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index bf84bf27213f..cdf3ae766f9e 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -2023,10 +2023,11 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
>  	} else
>  		bxt_cdclk_pll_update(dev_priv, vco);
>  
> -	waveform = cdclk_squash_waveform(dev_priv, cdclk);
> +	if (HAS_CDCLK_SQUASH(dev_priv)) {
> +		waveform = cdclk_squash_waveform(dev_priv, cdclk);
>  
> -	if (HAS_CDCLK_SQUASH(dev_priv))
>  		dg2_cdclk_squash_program(dev_priv, waveform);
> +	}
>  
>  	intel_de_write(dev_priv, CDCLK_CTL, bxt_cdclk_ctl(dev_priv, cdclk_config, pipe));
>  
> -- 
> 2.44.0
>
Gustavo Sousa March 5, 2024, 2:42 p.m. UTC | #2
Quoting Matt Roper (2024-03-04 19:04:19-03:00)
>On Mon, Mar 04, 2024 at 03:30:22PM -0300, Gustavo Sousa wrote:
>> It is no use computing the squash waveform if we are not going to use
>> it. Move the call to cdclk_squash_waveform() inside the block guarded by
>> HAS_CDCLK_SQUASH(dev_priv).
>> 
>> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
>
>You could also move the 'u32 waveform' declaration from the top of the
>function inside the block too to help prevent any future mistakes of
>using it unitialized.

Yep, makes sense. Will do that in v2.

>
>Either way,
>
>Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

Thanks!

--
Gustavo Sousa

>
>> ---
>>  drivers/gpu/drm/i915/display/intel_cdclk.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
>> index bf84bf27213f..cdf3ae766f9e 100644
>> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
>> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
>> @@ -2023,10 +2023,11 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
>>          } else
>>                  bxt_cdclk_pll_update(dev_priv, vco);
>>  
>> -        waveform = cdclk_squash_waveform(dev_priv, cdclk);
>> +        if (HAS_CDCLK_SQUASH(dev_priv)) {
>> +                waveform = cdclk_squash_waveform(dev_priv, cdclk);
>>  
>> -        if (HAS_CDCLK_SQUASH(dev_priv))
>>                  dg2_cdclk_squash_program(dev_priv, waveform);
>> +        }
>>  
>>          intel_de_write(dev_priv, CDCLK_CTL, bxt_cdclk_ctl(dev_priv, cdclk_config, pipe));
>>  
>> -- 
>> 2.44.0
>> 
>
>-- 
>Matt Roper
>Graphics Software Engineer
>Linux GPU Platform Enablement
>Intel Corporation
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index bf84bf27213f..cdf3ae766f9e 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -2023,10 +2023,11 @@  static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
 	} else
 		bxt_cdclk_pll_update(dev_priv, vco);
 
-	waveform = cdclk_squash_waveform(dev_priv, cdclk);
+	if (HAS_CDCLK_SQUASH(dev_priv)) {
+		waveform = cdclk_squash_waveform(dev_priv, cdclk);
 
-	if (HAS_CDCLK_SQUASH(dev_priv))
 		dg2_cdclk_squash_program(dev_priv, waveform);
+	}
 
 	intel_de_write(dev_priv, CDCLK_CTL, bxt_cdclk_ctl(dev_priv, cdclk_config, pipe));