]> git.baikalelectronics.ru Git - kernel.git/commit
clk: bcm-2835: Pick the closest clock rate
authorMaxime Ripard <maxime@cerno.tech>
Wed, 22 Sep 2021 12:54:15 +0000 (14:54 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Mon, 25 Oct 2021 13:33:39 +0000 (15:33 +0200)
commit24b78f7e00766f05bb69100ce45bec811851b202
tree4fbf60db80d484b2f2755bdab960556508e39afb
parent8b6d2c4a63648ab65f8b8640eed803ea5e9559cb
clk: bcm-2835: Pick the closest clock rate

The driver currently tries to pick the closest rate that is lower than
the rate being requested.

This causes an issue with clk_set_min_rate() since it actively checks
for the rounded rate to be above the minimum that was just set.

Let's change the logic a bit to pick the closest rate to the requested
rate, no matter if it's actually higher or lower.

Fixes: f286909076fe ("clk: bcm2835: Support for clock parent selection")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org> # boot and basic functionality
Tested-by: Michael Stapelberg <michael@stapelberg.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-2-maxime@cerno.tech
drivers/clk/bcm/clk-bcm2835.c