clk: imx: pfd: convert from round_rate() to determine_rate()

The round_rate() clk ops is deprecated, so migrate this driver from
round_rate() to determine_rate() using the Coccinelle semantic patch
on the cover letter of this series.

Signed-off-by: Brian Masney <bmasney@redhat.com>
Link: https://lore.kernel.org/r/20250710-clk-imx-round-rate-v1-8-5726f98e6d8d@redhat.com
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
Brian Masney 2025-07-10 17:10:40 -04:00 committed by Stephen Boyd
parent 6d50f953f7
commit 341bdb9cf5
No known key found for this signature in database
GPG key ID: AD028897C6E49525

View file

@ -62,24 +62,26 @@ static unsigned long clk_pfd_recalc_rate(struct clk_hw *hw,
return tmp;
}
static long clk_pfd_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
static int clk_pfd_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
u64 tmp = *prate;
u64 tmp = req->best_parent_rate;
u8 frac;
tmp = tmp * 18 + rate / 2;
do_div(tmp, rate);
tmp = tmp * 18 + req->rate / 2;
do_div(tmp, req->rate);
frac = tmp;
if (frac < 12)
frac = 12;
else if (frac > 35)
frac = 35;
tmp = *prate;
tmp = req->best_parent_rate;
tmp *= 18;
do_div(tmp, frac);
return tmp;
req->rate = tmp;
return 0;
}
static int clk_pfd_set_rate(struct clk_hw *hw, unsigned long rate,
@ -117,7 +119,7 @@ static const struct clk_ops clk_pfd_ops = {
.enable = clk_pfd_enable,
.disable = clk_pfd_disable,
.recalc_rate = clk_pfd_recalc_rate,
.round_rate = clk_pfd_round_rate,
.determine_rate = clk_pfd_determine_rate,
.set_rate = clk_pfd_set_rate,
.is_enabled = clk_pfd_is_enabled,
};