Skip to content

Commit

Permalink
clk: sunxi-ng: mux: honor CLK_SET_RATE_NO_REPARENT flag
Browse files Browse the repository at this point in the history
This patch adds support for the CLK_SET_RATE_NO_REPARENT flag to the
mux determine_rate helper, based on examples from clk-composite and
clk-mux.

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 ed48205 commit 216abdc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/clk/sunxi-ng/ccu_mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
struct clk_hw *best_parent, *hw = &common->hw;
unsigned int i;

if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
unsigned long adj_parent_rate;

best_parent = clk_hw_get_parent(hw);
best_parent_rate = clk_hw_get_rate(best_parent);

adj_parent_rate = best_parent_rate;
ccu_mux_helper_adjust_parent_for_prediv(common, cm, -1,
&adj_parent_rate);

best_rate = round(cm, adj_parent_rate, req->rate, data);

goto out;
}

for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
unsigned long tmp_rate, parent_rate, adj_parent_rate;
struct clk_hw *parent;
Expand Down

0 comments on commit 216abdc

Please sign in to comment.