[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bpiqx2ouerihm4jvrt6cv4yhd7d2pthryn22debqjeg4suz2x4@eod5ibcj54ld>
Date: Wed, 26 Nov 2025 02:25:35 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
To: Prahlad Valluru <venkata.valluru@....qualcomm.com>
Cc: Rob Clark <robin.clark@....qualcomm.com>,
Dmitry Baryshkov <lumag@...nel.org>,
Abhinav Kumar <abhinav.kumar@...ux.dev>,
Jessica Zhang <jesszhan0024@...il.com>, Sean Paul <sean@...rly.run>,
Marijn Suijten <marijn.suijten@...ainline.org>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
linux-arm-msm@...r.kernel.org, dri-devel@...ts.freedesktop.org,
freedreno@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/msm/dsi/phy_7nm: fix rounding error in recalc_rate
On Tue, Nov 25, 2025 at 08:55:07PM +0530, Prahlad Valluru wrote:
> 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.
Should the same fix be applied to other generations too?
>
> Signed-off-by: Prahlad Valluru <venkata.valluru@....qualcomm.com>
> ---
> drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> index 32f06edd21a9..00f20c5a7c73 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> @@ -598,6 +598,12 @@ static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw,
> pll_freq += div_u64(tmp64, multiplier);
>
> vco_rate = pll_freq;
> + /*
> + * Recalculating the rate from dec and frac doesn't end up the rate
> + * we originally set. Convert the freq to KHz, round it up and
> + * convert it back to Hz.
> + */
> + vco_rate = DIV_ROUND_UP_ULL(vco_rate, 1000) * 1000;
> pll_7nm->vco_current_rate = vco_rate;
>
> DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x",
>
> ---
> base-commit: 63c971af40365ee706c7e24f6a7900d693518f09
> change-id: 20251125-msm-dsi-phy-7nm-clk-rate-26723a3b686c
>
> Best regards,
> --
> Prahlad Valluru <venkata.valluru@....qualcomm.com>
>
--
With best wishes
Dmitry
Powered by blists - more mailing lists