Re: [PATCH v7 0/4] qcom-cpufreq-hw: Add CPU clock provider support

From: Sudeep Holla
Date: Thu Nov 17 2022 - 08:23:33 EST


On Thu, Nov 17, 2022 at 06:08:41PM +0530, Manivannan Sadhasivam wrote:

[...]
>
> AFAIK, OPP framework needs to know the current frequency of the device it is
> dealing with for setting the device's OPP. So it uses clk_get_rate() of the
> first clock of the device. If the clock is not available, then it uses the
> frequency in the first entry of the OPP table (since it is going to be the
> minimum freq of the device).
>

It has been a while since I followed OPP. Thanks for all the info, helped me
get updated without looking at the code in detail.

> As you can see, the clk_get_rate() is eminent for switching the OPPs and since
> OPP framework doesn't know what device it is dealing with, it cannot use
> cpufreq_get().
>

Agreed. I had assumed the qcom-cpufreq-hw as setting cpufreq directly pocking
the hardware but now I see it is using opp library to set some additional
policy.

> Is SCMI node itself has the OPP tables? Or the consumer nodes of the SCMI?
>

No, OPPs are read from the f/w and we just use OPP APIs to register them.
But we don't use OPP library to set the performance.

> TLDR; If you tell OPP framework to set a new OPP for a device, it needs to the
> know the current frequency of the device. And it is not manadatory now, but in
> the future maybe.
>

Hmm, good to know. I prefer it is not coupled with clocks and have some
alternative mechanism that is suitable for performance domains and don't
enforce the use of clock bindings and clk framework unnecessarily.

--
Regards,
Sudeep`