Skip to content

Commit a8e949d

Browse files
Sibi Sankarvireshk
authored andcommitted
cpufreq: scmi: Enable boost support
Certain platforms host a number of higher OPPs that are exclusive to CPUs within specific CPUfreq policies and not all CPUs within that CPUfreq policy are able to achieve those higher OPPs due to power constraints. These OPPs are marked as turbo in the freq_table and in the presence of such OPPs, let's enable boost by default. Reviewed-by: Sudeep Holla <[email protected]> Signed-off-by: Sibi Sankar <[email protected]> Reviewed-by: Dhruva Gole <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent a897575 commit a8e949d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

drivers/cpufreq/scmi-cpufreq.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct scmi_data {
3030

3131
static struct scmi_protocol_handle *ph;
3232
static const struct scmi_perf_proto_ops *perf_ops;
33+
static struct cpufreq_driver scmi_cpufreq_driver;
3334

3435
static unsigned int scmi_cpufreq_get_rate(unsigned int cpu)
3536
{
@@ -167,6 +168,12 @@ scmi_get_rate_limit(u32 domain, bool has_fast_switch)
167168
return rate_limit;
168169
}
169170

171+
static struct freq_attr *scmi_cpufreq_hw_attr[] = {
172+
&cpufreq_freq_attr_scaling_available_freqs,
173+
NULL,
174+
NULL,
175+
};
176+
170177
static int scmi_cpufreq_init(struct cpufreq_policy *policy)
171178
{
172179
int ret, nr_opp, domain;
@@ -276,6 +283,17 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
276283
policy->transition_delay_us =
277284
scmi_get_rate_limit(domain, policy->fast_switch_possible);
278285

286+
if (policy_has_boost_freq(policy)) {
287+
ret = cpufreq_enable_boost_support();
288+
if (ret) {
289+
dev_warn(cpu_dev, "failed to enable boost: %d\n", ret);
290+
goto out_free_opp;
291+
} else {
292+
scmi_cpufreq_hw_attr[1] = &cpufreq_freq_attr_scaling_boost_freqs;
293+
scmi_cpufreq_driver.boost_enabled = true;
294+
}
295+
}
296+
279297
return 0;
280298

281299
out_free_opp:
@@ -334,7 +352,7 @@ static struct cpufreq_driver scmi_cpufreq_driver = {
334352
CPUFREQ_NEED_INITIAL_FREQ_CHECK |
335353
CPUFREQ_IS_COOLING_DEV,
336354
.verify = cpufreq_generic_frequency_table_verify,
337-
.attr = cpufreq_generic_attr,
355+
.attr = scmi_cpufreq_hw_attr,
338356
.target_index = scmi_cpufreq_set_target,
339357
.fast_switch = scmi_cpufreq_fast_switch,
340358
.get = scmi_cpufreq_get_rate,

0 commit comments

Comments
 (0)