Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: sunxi-ng: mux: Get closest parent rate possible with CLK_SET_RATE_PARENT

If the CLK_SET_RATE_PARENT flag is set, we want to try getting the
closest parent rate.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

authored by

Chen-Yu Tsai and committed by
Maxime Ripard
82aab516 216abdcc

+12 -1
+12 -1
drivers/clk/sunxi-ng/ccu_mux.c
··· 93 93 if (!parent) 94 94 continue; 95 95 96 - parent_rate = clk_hw_get_rate(parent); 96 + if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { 97 + struct clk_rate_request parent_req = *req; 98 + int ret = __clk_determine_rate(parent, &parent_req); 99 + 100 + if (ret) 101 + continue; 102 + 103 + parent_rate = parent_req.rate; 104 + } else { 105 + parent_rate = clk_hw_get_rate(parent); 106 + } 107 + 97 108 adj_parent_rate = parent_rate; 98 109 ccu_mux_helper_adjust_parent_for_prediv(common, cm, i, 99 110 &adj_parent_rate);