[Intel-gfx] [PATCH 3/8] drm/i915/cdclk: Remove the assumption that cd2x div==2 when using squashing

Ville Syrjala ville.syrjala at linux.intel.com
Tue Nov 28 11:51:33 UTC 2023


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Currently we have a hardcoded assumption that the cd2x divider
is always 2 when squahsing is used. While that is true for all
current platforms it might not hold in the future. So eliminate
the assumption and calculate the correct divider from the other
parameters.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 87d5e5b67c4e..d45071675629 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1899,10 +1899,8 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
 
 	waveform = cdclk_squash_waveform(dev_priv, cdclk);
 
-	if (waveform)
-		clock = vco / 2;
-	else
-		clock = cdclk;
+	clock = DIV_ROUND_CLOSEST(cdclk * cdclk_squash_len,
+				  cdclk_squash_divider(waveform));
 
 	if (HAS_CDCLK_SQUASH(dev_priv))
 		dg2_cdclk_squash_program(dev_priv, waveform);
-- 
2.41.0



More information about the Intel-gfx mailing list