]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clk: analogbits: Fix incorrect calculation of vco rate delta
authorBo Gan <ganboing@gmail.com>
Fri, 30 Aug 2024 06:16:39 +0000 (23:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:49:58 +0000 (12:49 +0100)
commit78eadb30f5cea97f4bac6925ea478afd417ffd0f
tree6c2539ff27364ccfc5cceb3180771689daa19e91
parent7d07de96990e68f2e69dd180e697501324d6a36e
clk: analogbits: Fix incorrect calculation of vco rate delta

[ Upstream commit d7f12857f095ef38523399d47e68787b357232f6 ]

In wrpll_configure_for_rate() we try to determine the best PLL
configuration for a target rate. However, in the loop where we try
values of R, we should compare the derived `vco` with `target_vco_rate`.
However, we were in fact comparing it with `target_rate`, which is
actually after Q shift. This is incorrect, and sometimes can result in
suboptimal clock rates. Fix it.

Fixes: 7b9487a9a5c4 ("clk: analogbits: add Wide-Range PLL library")
Signed-off-by: Bo Gan <ganboing@gmail.com>
Link: https://lore.kernel.org/r/20240830061639.2316-1-ganboing@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/analogbits/wrpll-cln28hpc.c