Re: [PATCH v3] clk: set initial best mux parent to current parent with CLK_MUX_ROUND_CLOSEST
From: Yang Xiwen
Date: Thu Mar 07 2024 - 06:18:22 EST
On 3/7/2024 4:48 PM, Maxime Ripard wrote:
Hi,
On Thu, Mar 07, 2024 at 10:03:50AM +0800, Yang Xiwen via B4 Relay wrote:
From: Yang Xiwen <forbidden405@xxxxxxxxxxx>
Originally, the initial clock rate is hardcoded to 0, this can lead to
some problem when setting a very small rate with CLK_MUX_ROUND_CLOSEST.
For example, if the lowest possible rate provided by the mux is 1000Hz,
setting a rate below 500Hz will fail, because no clock can provide a
better rate than the non-existant 0Hz. But it should succeed with 1000Hz
being set.
Setting the initial best parent to current parent could solve this bug.
Signed-off-by: Yang Xiwen <forbidden405@xxxxxxxxxxx>
I don't think it would be the way to go. The biggest issue to me is that
it's inconsistent, and only changing the behaviour for a given flag
doesn't solve that.
I think the current behavior is odd but conforms to the document if
CLK_MUX_ROUND_CLOSEST is not specified. If i understand correctly, the
default behavior of mux clocks is to select the closest rate lower than
requested rate, and CLK_MUX_ROUND_CLOSEST removes the "lower than"
limitation, which is what this version tries to accomplish.
And again, either way, we should document it. And run it through kernelci.
Maxime
--
Regards,
Yang Xiwen