Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 4d3f36c5 authored by Mike Looijmans's avatar Mike Looijmans Committed by Stephen Boyd
Browse files

clk-si544: Properly round requested frequency to nearest match



The si544 driver had a rounding problem that using the result of clk_round_rate
may set the clock to yet another rate, for example:
clk_round_rate(195000000) = 194999999
clk_round_rate(194999999) = 194999998

Clients would expect that after clk_set_rate(clk, freq2=clk_round_rate(clk, freq)) the
chip will be running at exactly freq2.

The problem was in the calculation of the feedback divider, it was always rounded
down instead of to the nearest possible VCO value.

After this change, the following holds true for any supported frequency:
actual_freq = clk_round_rate(clk, freq);
clk_set_rate(clk, actual_freq);
clk_round_rate(clk, actual_freq) == actual_freq && clk_get_rate(clk) == actual_freq

Signed-off-by: default avatarMike Looijmans <mike.looijmans@topic.nl>
Fixes: 953cc3e8 ("clk: Add driver for the si544 clock generator chip")
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 60cc43fc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment