linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
To: <rjw@rjwysocki.net>, <viresh.kumar@linaro.org>,
	<Souvik.Chakravarty@arm.com>, <Thanu.Rangarajan@arm.com>
Cc: <Sudeep.Holla@arm.com>, <guohanjun@huawei.com>,
	<john.garry@huawei.com>, <jonathan.cameron@huawei.com>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<wangxiongfeng2@huawei.com>
Subject: [RFC PATCH 2/3] cpufreq: Add SW BOOST support for drivers without frequency table
Date: Fri, 8 May 2020 17:11:03 +0800	[thread overview]
Message-ID: <1588929064-30270-3-git-send-email-wangxiongfeng2@huawei.com> (raw)
In-Reply-To: <1588929064-30270-1-git-send-email-wangxiongfeng2@huawei.com>

Software-managed BOOST get the boost frequency by check the flag
CPUFREQ_BOOST_FREQ at driver's frequency table. But some cpufreq driver
don't have frequency table and use other methods to get the frequency
range, such CPPC cpufreq driver.

To add SW BOOST support for drivers without frequency table, we add
members in 'cpufreq_policy.cpufreq_cpuinfo' to record the max frequency
of boost mode and non-boost mode. The cpufreq driver initialize these two
members when probing.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/cpufreq/cpufreq.c | 23 +++++++++++++++--------
 include/linux/cpufreq.h   |  2 ++
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 475fb1b..a299426 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2508,15 +2508,22 @@ static int cpufreq_boost_set_sw(int state)
 	int ret = -EINVAL;
 
 	for_each_active_policy(policy) {
-		if (!policy->freq_table)
-			continue;
-
-		ret = cpufreq_frequency_table_cpuinfo(policy,
+		if (policy->freq_table) {
+			ret = cpufreq_frequency_table_cpuinfo(policy,
 						      policy->freq_table);
-		if (ret) {
-			pr_err("%s: Policy frequency update failed\n",
-			       __func__);
-			break;
+			if (ret) {
+				pr_err("%s: Policy frequency update failed\n",
+				       __func__);
+				break;
+			}
+		} else if (policy->cpuinfo.boost_max_freq) {
+			if (state)
+				policy->max = policy->cpuinfo.boost_max_freq;
+			else
+				policy->max = policy->cpuinfo.nonboost_max_freq;
+			policy->cpuinfo.max_freq = policy->max;
+		} else {
+			continue;
 		}
 
 		ret = freq_qos_update_request(policy->max_freq_req, policy->max);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 018dce8..c3449e6 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -43,6 +43,8 @@ enum cpufreq_table_sorting {
 struct cpufreq_cpuinfo {
 	unsigned int		max_freq;
 	unsigned int		min_freq;
+	unsigned int		boost_max_freq;
+	unsigned int		nonboost_max_freq;
 
 	/* in 10^(-9) s = nanoseconds */
 	unsigned int		transition_latency;
-- 
1.7.12.4


  parent reply	other threads:[~2020-05-08  9:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08  9:11 [RFC PATCH 0/3] add SW BOOST support for CPPC Xiongfeng Wang
2020-05-08  9:11 ` [RFC PATCH 1/3] cpufreq: fix the return value in 'cpufreq_boost_set_sw()' Xiongfeng Wang
2020-05-14 13:54   ` Rafael J. Wysocki
2020-05-15  1:28     ` Xiongfeng Wang
2020-05-08  9:11 ` Xiongfeng Wang [this message]
2020-05-14 14:16   ` [RFC PATCH 2/3] cpufreq: Add SW BOOST support for drivers without frequency table Rafael J. Wysocki
2020-05-15  1:49     ` Xiongfeng Wang
2020-05-18  7:53       ` Viresh Kumar
2020-05-19  1:04         ` Xiongfeng Wang
2020-05-08  9:11 ` [RFC PATCH 3/3] CPPC: add support for SW BOOST Xiongfeng Wang

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=1588929064-30270-3-git-send-email-wangxiongfeng2@huawei.com \
    --to=wangxiongfeng2@huawei.com \
    --cc=Souvik.Chakravarty@arm.com \
    --cc=Sudeep.Holla@arm.com \
    --cc=Thanu.Rangarajan@arm.com \
    --cc=guohanjun@huawei.com \
    --cc=john.garry@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).