Skip to content

Commit

Permalink
clk: sunxi-ng: mux: Get closest parent rate possible with CLK_SET_RAT…
Browse files Browse the repository at this point in the history
…E_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>
  • Loading branch information
Chen-Yu Tsai authored and Maxime Ripard committed Jan 30, 2017
1 parent 216abdc commit 82aab51
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/clk/sunxi-ng/ccu_mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,18 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
if (!parent)
continue;

parent_rate = clk_hw_get_rate(parent);
if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
struct clk_rate_request parent_req = *req;
int ret = __clk_determine_rate(parent, &parent_req);

if (ret)
continue;

parent_rate = parent_req.rate;
} else {
parent_rate = clk_hw_get_rate(parent);
}

adj_parent_rate = parent_rate;
ccu_mux_helper_adjust_parent_for_prediv(common, cm, i,
&adj_parent_rate);
Expand Down

0 comments on commit 82aab51

Please sign in to comment.