From: Christian Marangi <ansuelsmth@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Lorenzo Bianconi <lorenzo@kernel.org>,
upstream@airoha.com, ulf.hansson@linaro.org
Subject: Re: [PATCH v2] cpufreq: airoha: Add EN7581 Cpufreq SMC driver
Date: Mon, 2 Dec 2024 16:18:01 +0100 [thread overview]
Message-ID: <674dcfae.df0a0220.2cb93b.c1bd@mx.google.com> (raw)
In-Reply-To: <20241129040234.enfb2vpehpzhmtmc@vireshk-i7>
On Fri, Nov 29, 2024 at 09:32:34AM +0530, Viresh Kumar wrote:
> On 25-11-24, 13:43, Christian Marangi wrote:
> > sorry for the delay... I checked the example and other cpufreq driver
> > that register a simple cpufreq-dt. None of the current driver implements
> > a full clk provider internally
>
> Yeah, that may be done from platform code for those drivers instead of the
> cpufreq driver.
>
> > and I have some fear it might be
> > problematic to have mixed stuff, eventually I feel I should implement a
> > small clk driver that implements determine_rate, set_rate, a compatible
> > and all sort. And still we would have the double reference of OPP
> > Index->Freq Clock->OPP index.
>
> One way to avoid that would be to use performance-state stuff and model this as
> a genpd. In that case, opp->level field (which you can set as index only in your
> case) will be programmed as is by the genpd core. That's why I cc'd Ulf earlier
> as it looked more suited to your case.
>
Hi I just sent v4 that exactly implement that. It was hard but at the
end I manage to make use of it :D
> > I wonder if a much easier and better solution for this is (similar to
> > how we do with suspend and resume) add entry in the struct
> > cpufreq_dt_platform_data, to permit to define simple .target_index and
> > .get and overwrite the default one cpufreq-dt.
>
> Easier, sure. Better, I doubt that :(
>
> The OPP core currently configures a lot of stuff from set-opp API, like clk,
> regulators, genpd (performance state), bandwidth, etc and I really want to use
> that infrastructure for everyone instead of starting to open code that in
> drivers. The suspend/resume callbacks are special as the OPP core doesn't know
> what to do in that case and so it was left for the drivers to handle that.
>
Yep, totally understandable and i can see the problem in open coding it.
Easier fort devs but leaves space for random implementation that can be
implemented with OPP and PD
> > This permits to both reduce greatly the airoha-cpufreq driver, register
> > a simple cpufreq-dt and prevent any kind of overhead. After all the
> > .target_index and .get doesn't do anything fancy, they just call the OPP
> > set and clk get rate.
>
> Yeah, clk-get is pretty simple but opp-set isn't and then there is scope of
> further enhancements / improvements in the future which can be best handled if
> we keep that code common for everyone.
>
> > What do you think? Changes are really trivial since this is already
> > implemented for suspend and resume.
>
> I think you can model it as a performance state (which lot of platforms are
> doing as well), and then you won't have the index->clk->index issue anymore.
>
Hope you can check v4 if everything is OK. A dedicated node was required
for the clk provider and the PD provider but that is O.K. if that means
transparent handling for cpufreq-dt.
Thanks a lot on the hint on how to correctly implement this!
--
Ansuel
prev parent reply other threads:[~2024-12-02 15:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 19:07 [PATCH v2] cpufreq: airoha: Add EN7581 Cpufreq SMC driver Christian Marangi
2024-11-13 15:55 ` Christian Marangi
2024-11-19 7:20 ` Viresh Kumar
2024-11-19 9:04 ` Christian Marangi
2024-11-19 10:44 ` Viresh Kumar
2024-11-25 12:43 ` Christian Marangi
2024-11-29 4:02 ` Viresh Kumar
2024-12-02 15:18 ` Christian Marangi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=674dcfae.df0a0220.2cb93b.c1bd@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=rafael@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=upstream@airoha.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.