clk: fixed-factor: add determine_rate() ops

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@redhat.com>
This commit is contained in:
Brian Masney 2025-08-11 11:17:55 -04:00
parent 9236145ffb
commit 582de809b0

View File

@ -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,