clk: sunxi-ng: nkm: consider alternative parent rates when determining rate
authorFrank Oltmanns <frank@oltmanns.dev>
Mon, 7 Aug 2023 12:43:35 +0000 (14:43 +0200)
committerChen-Yu Tsai <wens@csie.org>
Wed, 9 Aug 2023 15:33:58 +0000 (23:33 +0800)
commit3492e4f6db5f6814869a4639d70ea025385f4cb6
tree79c3e0752c75f164de7b386b3ed25232b59441d4
parent80c439cd1f011e8c6bb4c6c65987e235f686d9ee
clk: sunxi-ng: nkm: consider alternative parent rates when determining rate

In case the CLK_SET_RATE_PARENT flag is set, consider using a different
parent rate when determining a new rate.

To find the best match for the requested rate, perform the following
steps for each NKM combination:
 - calculate the optimal parent rate,
 - find the best parent rate that the parent clock actually supports
 - use that parent rate to calculate the effective rate.

In case the clk does not support setting the parent rate, use the same
algorithm as before.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20230807-pll-mipi_set_rate_parent-v6-2-f173239a4b59@oltmanns.dev
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
drivers/clk/sunxi-ng/ccu_nkm.c