diff mbox series

[11/15] cpufreq: scmi: Set .set_boost directly

Message ID ec27aef491c1b71ef5f1240480c52d051cdd821d.1737707712.git.viresh.kumar@linaro.org (mailing list archive)
State New
Delegated to: viresh kumar
Headers show
Series cpufreq: simplify boost handling | expand

Commit Message

Viresh Kumar Jan. 24, 2025, 8:58 a.m. UTC
The boost feature can be controlled at two levels currently, driver
level (applies to all policies) and per-policy.

Currently the driver enables driver level boost support from the
per-policy ->init() callback, which isn't really efficient as that gets
called for each policy and then there is online/offline path too where
this gets done unnecessarily.

Instead set the .set_boost field directly and always enable the boost
support. If a policy doesn't support boost feature, the core will not
enable it for that policy.

Keep the initial state of driver level boost to disabled and let the
user enable it if required as ideally the boost frequencies must be used
only when really required.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/scmi-cpufreq.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Sudeep Holla Jan. 28, 2025, 11:27 a.m. UTC | #1
On Fri, Jan 24, 2025 at 02:28:15PM +0530, Viresh Kumar wrote:
> The boost feature can be controlled at two levels currently, driver
> level (applies to all policies) and per-policy.
> 
> Currently the driver enables driver level boost support from the
> per-policy ->init() callback, which isn't really efficient as that gets
> called for each policy and then there is online/offline path too where
> this gets done unnecessarily.
> 
> Instead set the .set_boost field directly and always enable the boost
> support. If a policy doesn't support boost feature, the core will not
> enable it for that policy.
> 
> Keep the initial state of driver level boost to disabled and let the
> user enable it if required as ideally the boost frequencies must be used
> only when really required.
>

Acked-by: Sudeep Holla <sudeep.holla@arm.com>
diff mbox series

Patch

diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index 4a3ee59cb771..ff2897789797 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -297,16 +297,6 @@  static int scmi_cpufreq_init(struct cpufreq_policy *policy)
 	policy->transition_delay_us =
 		scmi_get_rate_limit(domain, policy->fast_switch_possible);
 
-	if (policy_has_boost_freq(policy)) {
-		ret = cpufreq_enable_boost_support();
-		if (ret) {
-			dev_warn(cpu_dev, "failed to enable boost: %d\n", ret);
-			goto out_free_table;
-		} else {
-			scmi_cpufreq_driver.boost_enabled = true;
-		}
-	}
-
 	ret = freq_qos_add_request(&policy->constraints, &priv->limits_freq_req, FREQ_QOS_MAX,
 				   FREQ_QOS_MAX_DEFAULT_VALUE);
 	if (ret < 0) {
@@ -394,6 +384,7 @@  static struct cpufreq_driver scmi_cpufreq_driver = {
 	.init	= scmi_cpufreq_init,
 	.exit	= scmi_cpufreq_exit,
 	.register_em	= scmi_cpufreq_register_em,
+	.set_boost	= cpufreq_boost_set_sw,
 };
 
 static int scmi_cpufreq_probe(struct scmi_device *sdev)