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

From: Dmitry Baryshkov
Date: Wed Mar 29 2023 - 18:02:03 EST


On 29/03/2023 22:52, Stephen Boyd wrote:
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.

My fault, I suggested this some time ago on the basis that... "CCF switching the parent rate during the clk_set_rate() call. Then the second lookup might end up selecting different parent/mnd configuration."

--
With best wishes
Dmitry