Re: [PATCH 02/11] clk: scmi: Use new determine_rate clock operation
From: Brian Masney
Date: Mon Mar 02 2026 - 12:16:43 EST
On Sat, Feb 28, 2026 at 08:56:04AM +0800, Peng Fan wrote:
> On Fri, Feb 27, 2026 at 03:32:16PM +0000, Cristian Marussi wrote:
> >Use the Clock protocol layer determine_rate logic to calculate the closest
> >rate that can be supported by a specific clock.
> >
> >No functional change.
> >
> >Cc: Brian Masney <bmasney@xxxxxxxxxx>
> >Cc: Michael Turquette <mturquette@xxxxxxxxxxxx>
> >Cc: Stephen Boyd <sboyd@xxxxxxxxxx>
> >Cc: linux-clk@xxxxxxxxxxxxxxx
> >Signed-off-by: Cristian Marussi <cristian.marussi@xxxxxxx>
> >---
> >Note that the calculation logic in the protocol layer is exactly the same
> >as it wes here.
> >
> >@Brian I suppose once your CLK_ROUNDING_FW_MANAGED sereis is merged I can flag
> >such SCMI clocks.
>
> Per my reading of Brain's thread, if ->determine_rate exists,
> ->determine_rate() will be used.
>
> } else if (core->ops->determine_rate) {
> return core->ops->determine_rate(core->hw, req);
> + } else if (clk_is_rounding_fw_managed(core)) {
> + return 0;
>
> So unless update scmi_clk_determine_rate() to something:
> --------
> if (clk & CLK_ROUNDING_FW_MANAGED)
> return 0;
>
> return scmi_proto_clk_ops->determine_rate(clk->ph, clk->id, &req->rate);
> --------
>
> It maybe better to update Brain's patch to move clk_is_rounding_fw_managed()
> above the check of core->ops->determine_rate().
The clk framework has some basic sanity checks in place that are called
during device probe to ensure that various ops are configured properly. I
could add a check that if CLK_ROUNDING_FW_MANAGED [*] is set, and a
determine_rate() op is set, then it gives an error.
[*] Note: I am tentatively planning to rename that to CLK_ROUNDING_NOOP
in v2 in about a week.
Brian