Skip to content

Commit 679ec2c

Browse files
Prahlad Valluruquic-botlagun
authored andcommitted
FROMLIST: drm/msm/dsi/phy: fix rounding error in recalc_rate
Required vco rate is set by programming decimal and fraction from 64 bit calculation. This programmed rate is not exactly matching the requested rate and corresponding recalc_rate is having rounding error due to this delta. When setting byte_clk and byte_intf_clk from this pll, set_rate on byte_intf_clk resulting in dividers getting reprogrammed, which are already set from byte_clk. Convert this recalc_rate to KHz and back to Hz to round up this delta in calculation. Signed-off-by: Prahlad Valluru <venkata.valluru@oss.qualcomm.com> Link: https://lore.kernel.org/all/20251125-msm-dsi-phy-7nm-clk-rate-v1-1-17141806e3a0@oss.qualcomm.com/
1 parent 48e2c89 commit 679ec2c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,12 @@ static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw,
595595
pll_freq += div_u64(tmp64, multiplier);
596596

597597
vco_rate = pll_freq;
598+
/*
599+
* Recalculating the rate from dec and frac doesn't end up the rate
600+
* we originally set. Convert the freq to KHz, round it up and
601+
* convert it back to Hz.
602+
*/
603+
vco_rate = DIV_ROUND_UP_ULL(vco_rate, 1000) * 1000;
598604
pll_7nm->vco_current_rate = vco_rate;
599605

600606
DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x",

0 commit comments

Comments
 (0)