Re: [PATCH v3 4/6] clk: qcom: clk-rcg2: don't re-search config on rcg2_set_rate

From: Stephen Boyd
Date: Wed Mar 29 2023 - 15:52:56 EST


Quoting Christian Marangi (2023-01-17 05:54:57)
> Currently the rcg2 driver search the rate to apply 2 times.
> - In _freq_tbl_determine_rate for the determine_rate function used by
> core clk to understand the best rate to set with set_rate
> - In rcg2_set_rate where the suggested rate is not trusted and searched
> another time using a CEIL or FLOOR policy.
>
> This is fundamentally wrong as we are ignoring what core clock is
> deciding and just setting whatever clock configuration we want for the
> suggested clock. The problem is in the fact that the correct clock
> should have already be searched and selected with the determine_rate
> function and set_rate should just apply whatever clock was provided.

It sounds like you're assuming the rate coming into the set_rate clk_op
is rounded? Don't make that assumption. The set_rate clk_op should round
the rate again. The parent rate could have changed.