[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOLZvyHqkBA_=xFSXFrnWX9O_82LV0xi9UEeSSA3ZgDXaNTpAg@mail.gmail.com>
Date: Mon, 11 Aug 2025 09:50:58 +0200
From: Manuel Lauss <manuel.lauss@...il.com>
To: Brian Masney <bmasney@...hat.com>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>, Maxime Ripard <mripard@...nel.org>,
Stephen Boyd <sboyd@...nel.org>, linux-clk@...r.kernel.org, linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] MIPS: Alchemy: convert from round_rate() to determine_rate()
Hello,
On Mon, Aug 11, 2025 at 12:30 AM Brian Masney <bmasney@...hat.com> wrote:
[...]
> arch/mips/alchemy/common/clock.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
> index 6c8996e20a7ddc4ddaf924fc43a98c882c4110f7..551b0d21d9dc4b67d9909c0305db659daa8e84d9 100644
> --- a/arch/mips/alchemy/common/clock.c
> +++ b/arch/mips/alchemy/common/clock.c
> @@ -211,30 +211,34 @@ static int alchemy_clk_aux_setr(struct clk_hw *hw,
> return 0;
> }
>
> -static long alchemy_clk_aux_roundr(struct clk_hw *hw,
> - unsigned long rate,
> - unsigned long *parent_rate)
> +static int alchemy_clk_aux_determine_rate(struct clk_hw *hw,
> + struct clk_rate_request *req)
> {
> struct alchemy_auxpll_clk *a = to_auxpll_clk(hw);
> unsigned long mult;
>
> - if (!rate || !*parent_rate)
> + if (!req->rate || !req->best_parent_rate) {
> + req->rate = 0;
> +
> return 0;
> + }
>
> - mult = rate / (*parent_rate);
> + mult = req->rate / req->best_parent_rate;
>
> if (mult && (mult < 7))
> mult = 7;
> if (mult > a->maxmult)
> mult = a->maxmult;
>
> - return (*parent_rate) * mult;
> + req->rate = req->best_parent_rate * mult;
> +
> + return 0;
> }
>
> static const struct clk_ops alchemy_clkops_aux = {
> .recalc_rate = alchemy_clk_aux_recalc,
> .set_rate = alchemy_clk_aux_setr,
> - .round_rate = alchemy_clk_aux_roundr,
> + .determine_rate = alchemy_clk_aux_determine_rate,
> };
>
> static struct clk __init *alchemy_clk_setup_aux(const char *parent_name,
>
> ---
I've run-tested this on an Alchemy DB1300 board, and it works just fine.
In case it matters:
Tested-by: Manuel Lauss <manuel.lauss@...il.com>
Thanks!
Manuel
Powered by blists - more mailing lists