clk: Change clk_ops->determine_rate to return a clk_hw as the best parent
This is in preparation for clock providers to not have to deal with struct clk. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Michael Turquette <mturquette@linaro.org>
This commit is contained in:

committad av
Michael Turquette

förälder
61c7cddfad
incheckning
646cafc6aa
@@ -702,7 +702,7 @@ struct clk *__clk_lookup(const char *name)
|
||||
*/
|
||||
long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *best_parent_rate,
|
||||
struct clk **best_parent_p)
|
||||
struct clk_hw **best_parent_p)
|
||||
{
|
||||
struct clk *clk = hw->clk, *parent, *best_parent = NULL;
|
||||
int i, num_parents;
|
||||
@@ -738,7 +738,7 @@ long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate,
|
||||
|
||||
out:
|
||||
if (best_parent)
|
||||
*best_parent_p = best_parent;
|
||||
*best_parent_p = best_parent->hw;
|
||||
*best_parent_rate = best;
|
||||
|
||||
return best;
|
||||
@@ -946,6 +946,7 @@ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = 0;
|
||||
struct clk *parent;
|
||||
struct clk_hw *parent_hw;
|
||||
|
||||
if (!clk)
|
||||
return 0;
|
||||
@@ -954,10 +955,11 @@ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
|
||||
if (parent)
|
||||
parent_rate = parent->rate;
|
||||
|
||||
if (clk->ops->determine_rate)
|
||||
if (clk->ops->determine_rate) {
|
||||
parent_hw = parent ? parent->hw : NULL;
|
||||
return clk->ops->determine_rate(clk->hw, rate, &parent_rate,
|
||||
&parent);
|
||||
else if (clk->ops->round_rate)
|
||||
&parent_hw);
|
||||
} else if (clk->ops->round_rate)
|
||||
return clk->ops->round_rate(clk->hw, rate, &parent_rate);
|
||||
else if (clk->flags & CLK_SET_RATE_PARENT)
|
||||
return __clk_round_rate(clk->parent, rate);
|
||||
@@ -1345,6 +1347,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
struct clk *top = clk;
|
||||
struct clk *old_parent, *parent;
|
||||
struct clk_hw *parent_hw;
|
||||
unsigned long best_parent_rate = 0;
|
||||
unsigned long new_rate;
|
||||
int p_index = 0;
|
||||
@@ -1360,9 +1363,11 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
|
||||
|
||||
/* find the closest rate and parent clk/rate */
|
||||
if (clk->ops->determine_rate) {
|
||||
parent_hw = parent ? parent->hw : NULL;
|
||||
new_rate = clk->ops->determine_rate(clk->hw, rate,
|
||||
&best_parent_rate,
|
||||
&parent);
|
||||
&parent_hw);
|
||||
parent = parent_hw->clk;
|
||||
} else if (clk->ops->round_rate) {
|
||||
new_rate = clk->ops->round_rate(clk->hw, rate,
|
||||
&best_parent_rate);
|
||||
|
Referens i nytt ärende
Block a user