[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <kiwkbr5rj5uu3hkfy37obsj4mky5fwmbseyntp4pxoez4e3yh2@t6jdjs456eal>
Date: Tue, 19 Sep 2023 08:50:07 +0200
From: Maxime Ripard <mripard@...nel.org>
To: Benjamin Bara <bbara93@...il.com>
Cc: Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Russell King <linux@...linux.org.uk>,
Abel Vesa <abelvesa@...nel.org>, Peng Fan <peng.fan@....com>,
Frank Oltmanns <frank@...manns.dev>,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
Benjamin Bara <benjamin.bara@...data.com>
Subject: Re: [PATCH 03/13] clk: implement clk_hw_set_rate()
Hi,
On Mon, Sep 18, 2023 at 12:39:59AM +0200, Benjamin Bara wrote:
> From: Benjamin Bara <benjamin.bara@...data.com>
>
> This function can be used to set the rate of a clock hardware from a
> driver, e.g. to adapt the rate to a clock change coming from the parent.
>
> Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>
> ---
> drivers/clk/clk.c | 15 +++++++++++++++
> include/linux/clk-provider.h | 1 +
> 2 files changed, 16 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index c249f9791ae8..3e222802b712 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2462,6 +2462,21 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
> return ret;
> }
>
> +int clk_hw_set_rate(struct clk_hw *hw, unsigned long req_rate)
> +{
> + /* A rate change is ongoing, so just target the required rate.
> + * Note: this does not work if one clock along the line has
> + * CLK_RECALC_NEW_RATES active, as this overwrites the new_rate again.
> + */
> + if (hw->core->new_rate != hw->core->rate) {
> + hw->core->new_rate = req_rate;
> + return 0;
> + }
> +
> + return clk_core_set_rate_nolock(hw->core, req_rate);
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_set_rate);
So, we discussed it recently, and it's non-obvious to see how it would
work if you're in a set_rate change that modifies the tree and the new
call to clk_hw_set_rate modifies the tree too. Some explanation on how
it's handled, and some unit tests are required here imo.
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists