From: Brian Masney <bmasney@xxxxxxxxxx> The round_rate() clk ops is deprecated, and determine_rate() should be used instead. We can't just simply convert this driver over initially since other drivers depend on this. So let's go ahead and add a determine_rate() clk ops. Once all of the drivers have been converted, then the round_rate() clk ops can be dropped. Signed-off-by: Brian Masney <bmasney@xxxxxxxxxx> --- drivers/clk/clk-fixed-factor.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index e62ae8794d445f685156276d5135448f340fca3f..79b9a8c57d4b84be990955d8bc3159b818f38d50 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -30,6 +30,23 @@ static unsigned long clk_factor_recalc_rate(struct clk_hw *hw, return (unsigned long)rate; } +static int clk_factor_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct clk_fixed_factor *fix = to_clk_fixed_factor(hw); + + if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { + unsigned long best_parent; + + best_parent = (req->rate / fix->mult) * fix->div; + req->best_parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), best_parent); + } + + req->rate = (req->best_parent_rate / fix->div) * fix->mult; + + return 0; +} + static long clk_factor_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { @@ -50,7 +67,7 @@ static int clk_factor_set_rate(struct clk_hw *hw, unsigned long rate, { /* * We must report success but we can do so unconditionally because - * clk_factor_round_rate returns values that ensure this call is a + * clk_factor_determine_rate returns values that ensure this call is a * nop. */ @@ -69,6 +86,7 @@ static unsigned long clk_factor_recalc_accuracy(struct clk_hw *hw, } const struct clk_ops clk_fixed_factor_ops = { + .determine_rate = clk_factor_determine_rate, .round_rate = clk_factor_round_rate, .set_rate = clk_factor_set_rate, .recalc_rate = clk_factor_recalc_rate, -- 2.50.1