Skip to content

Commit e1a914a

Browse files
committed
drm/i915/cdclk: Remove the assumption that cdclk divider==2 when using squashing
Currently we have a hardcoded assumption that the cdclk divider (2*cd2x divider) is always 2 when squashing 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. v2: s/cd2x divider/cdclk divider/ (Gustavo) s/clock/unsquashed_cdclk/ (Gustavo) Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231211221636.29658-1-ville.syrjala@linux.intel.com
1 parent 2581547 commit e1a914a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

drivers/gpu/drm/i915/display/intel_cdclk.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,9 +1880,9 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
18801880
{
18811881
int cdclk = cdclk_config->cdclk;
18821882
int vco = cdclk_config->vco;
1883-
u32 val;
1883+
int unsquashed_cdclk;
18841884
u16 waveform;
1885-
int clock;
1885+
u32 val;
18861886

18871887
if (HAS_CDCLK_CRAWL(dev_priv) && dev_priv->display.cdclk.hw.vco > 0 && vco > 0 &&
18881888
!cdclk_pll_is_unknown(dev_priv->display.cdclk.hw.vco)) {
@@ -1899,15 +1899,13 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
18991899

19001900
waveform = cdclk_squash_waveform(dev_priv, cdclk);
19011901

1902-
if (waveform)
1903-
clock = vco / 2;
1904-
else
1905-
clock = cdclk;
1902+
unsquashed_cdclk = DIV_ROUND_CLOSEST(cdclk * cdclk_squash_len,
1903+
cdclk_squash_divider(waveform));
19061904

19071905
if (HAS_CDCLK_SQUASH(dev_priv))
19081906
dg2_cdclk_squash_program(dev_priv, waveform);
19091907

1910-
val = bxt_cdclk_cd2x_div_sel(dev_priv, clock, vco) |
1908+
val = bxt_cdclk_cd2x_div_sel(dev_priv, unsquashed_cdclk, vco) |
19111909
bxt_cdclk_cd2x_pipe(dev_priv, pipe);
19121910

19131911
/*

0 commit comments

Comments
 (0)