From: Viresh Kumar <viresh.kumar@linaro.org>
To: Natanael Copa <ncopa@alpinelinux.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
"Nishanth Menon" <nm@ti.com>, "Stephen Boyd" <sboyd@kernel.org>,
"Milan P . Stanić" <mps@arvanta.net>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Yixun Lan" <dlan@kernel.org>,
"Troy Mitchell" <troy.mitchell@linux.spacemit.com>,
"Shuwei Wu" <shuwei.wu@mailbox.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
spacemit@lists.linux.dev, linux-riscv@lists.infradead.org,
stable@vger.kernel.org
Subject: Re: [PATCH] cpufreq: dt: Set the initial OPP to apply its voltage constraints
Date: Tue, 17 Nov 2026 16:36:38 +0530 [thread overview]
Message-ID: <avw1Pos5Je8piwvU@vireshk-B250M-D3H> (raw)
In-Reply-To: <20261111130430.10359-1-ncopa@alpinelinux.org>
On 11-11-26, 14:04, Natanael Copa wrote:
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> index eb15650f99bf..2646dda10aac 100644
> --- a/drivers/cpufreq/cpufreq-dt.c
> +++ b/drivers/cpufreq/cpufreq-dt.c
> @@ -153,6 +153,30 @@ static struct cpufreq_driver dt_cpufreq_driver = {
> .suspend = cpufreq_generic_suspend,
> };
>
> +/*
> + * Set the OPP for the current clock rate, so that its voltage constraints
> + * apply before any policy can change frequency. Otherwise another policy
> + * sharing the supply could lower the voltage below what this one needs.
> + */
I think the problem is valid and must be solved somewhere.
> +static void dt_cpufreq_set_initial_opp(struct device *cpu_dev)
> +{
> + struct clk *clk = clk_get(cpu_dev, NULL);
> + unsigned long rate;
> + int ret;
> +
> + if (IS_ERR(clk))
> + return;
> +
> + rate = clk_get_rate(clk);
> + clk_put(clk);
> + if (!rate)
> + return;
> +
> + ret = dev_pm_opp_set_rate(cpu_dev, rate);
I think this works accidentally for now as OPP core could have
rejected a switch to the same OPP in this case too.
- We should add a new flag to `struct cpufreq_dt_platform_data` to run
this code only for the affected platforms and not everyone.
- Perhaps we need a new OPP API, which configures the hardware,
forcefully, to the current OPP.
--
viresh
prev parent reply other threads:[~2026-11-17 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 13:04 Natanael Copa
2026-11-12 12:54 ` Zhongqiu Han
2026-11-17 11:06 ` Viresh Kumar [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=avw1Pos5Je8piwvU@vireshk-B250M-D3H \
--to=viresh.kumar@linaro.org \
--cc=aurelien@aurel32.net \
--cc=dlan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mps@arvanta.net \
--cc=ncopa@alpinelinux.org \
--cc=nm@ti.com \
--cc=rafael@kernel.org \
--cc=sboyd@kernel.org \
--cc=shuwei.wu@mailbox.org \
--cc=spacemit@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=troy.mitchell@linux.spacemit.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®