clk: Take into account uncached clocks in clk_set_rate_range()
authorMaxime Ripard <maxime@cerno.tech>
Tue, 16 Aug 2022 11:25:17 +0000 (13:25 +0200)
committerStephen Boyd <sboyd@kernel.org>
Thu, 15 Sep 2022 16:31:05 +0000 (09:31 -0700)
commit3afb07231d603d51dca6a5d5e16d9d8f422f9b5f
tree3432f40470f753ff7a1383379902168e5b4fc881
parent2e9cad1abc7149c5e6aeee7e76a6c363d392da8b
clk: Take into account uncached clocks in clk_set_rate_range()

clk_set_rate_range() will use the last requested rate for the clock when
it calls into the driver set_rate hook.

However, if CLK_GET_RATE_NOCACHE is set on that clock, the last
requested rate might not be matching the current rate of the clock. In
such a case, let's read out the rate from the hardware and use that in
our set_rate instead.

Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # imx8mp
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> # exynos4210, meson g12b
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220816112530.1837489-13-maxime@cerno.tech
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk.c
drivers/clk/clk_test.c