--- Begin Message ---
- To: Maxime Ripard <maxime@xxxxxxxxxx>
- Subject: Re: [PATCH v3 14/65] clk: lochnagar: Add a determine_rate hook
- From: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 4 May 2023 13:39:23 +0000
- Cc: Michael Turquette <mturquette@xxxxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Andreas Färber <afaerber@xxxxxxx>, Manivannan Sadhasivam <mani@xxxxxxxxxx>, Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>, Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>, Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>, Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>, Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>, David Lechner <david@xxxxxxxxxxxxxx>, Sekhar Nori <nsekhar@xxxxxx>, Abel Vesa <abelvesa@xxxxxxxxxx>, Shawn Guo <shawnguo@xxxxxxxxxx>, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>, Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>, Fabio Estevam <festevam@xxxxxxxxx>, NXP Linux Team <linux-imx@xxxxxxx>, Matthias Brugger <matthias.bgg@xxxxxxxxx>, Geert Uytterhoeven <geert+renesas@xxxxxxxxx>, Dinh Nguyen <dinguyen@xxxxxxxxxx>, Peter De Schrijver <pdeschrijver@xxxxxxxxxx>, Prashant Gaikwad <pgaikwad@xxxxxxxxxx>, Thierry Reding <thierry.reding@xxxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>, Daniel Vetter <daniel@xxxxxxxx>, Vinod Koul <vkoul@xxxxxxxxxx>, Kishon Vijay Abraham I <kishon@xxxxxxxxxx>, Alessandro Zummo <a.zummo@xxxxxxxxxxxx>, Chen-Yu Tsai <wens@xxxxxxxx>, Jernej Skrabec <jernej.skrabec@xxxxxxxxx>, Samuel Holland <samuel@xxxxxxxxxxxx>, Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Takashi Iwai <tiwai@xxxxxxxx>, Paul Cercueil <paul@xxxxxxxxxxxxxxx>, Orson Zhai <orsonzhai@xxxxxxxxx>, Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>, Chunyan Zhang <zhang.lyra@xxxxxxxxx>, linux-clk@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-actions@xxxxxxxxxxxxxxxxxxx, patches@xxxxxxxxxxxxxxxxxxxxx, linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, linux-mediatek@xxxxxxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx, linux-tegra@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-phy@xxxxxxxxxxxxxxxxxxx, linux-rtc@xxxxxxxxxxxxxxx, linux-sunxi@xxxxxxxxxxxxxxx, alsa-devel@xxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx
- In-reply-to: <20221018-clk-range-checks-fixes-v3-14-9a1358472d52@cerno.tech>
- References: <20221018-clk-range-checks-fixes-v3-0-9a1358472d52@cerno.tech> <20221018-clk-range-checks-fixes-v3-14-9a1358472d52@cerno.tech>
- User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Apr 04, 2023 at 12:11:04PM +0200, Maxime Ripard wrote:
> The lochnagar clocks implement a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
> ---
Tested-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Thanks,
Charles
--- End Message ---