Skip to content

Commit d7f1285

Browse files
ganboingbebarino
authored andcommitted
clk: analogbits: Fix incorrect calculation of vco rate delta
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: 7b9487a ("clk: analogbits: add Wide-Range PLL library") Signed-off-by: Bo Gan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent ab9f0d0 commit d7f1285

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/analogbits/wrpll-cln28hpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate,
292292
vco = vco_pre * f;
293293
}
294294

295-
delta = abs(target_rate - vco);
295+
delta = abs(target_vco_rate - vco);
296296
if (delta < best_delta) {
297297
best_delta = delta;
298298
best_r = r;

0 commit comments

Comments
 (0)