Skip to content

Commit 1f7d1ba

Browse files
committed
cpufreq: Introduce policy->boost_supported flag
It is possible to have a scenario where not all cpufreq policies support boost frequencies. And letting sysfs (or other parts of the kernel) enable boost feature for that policy isn't correct. Add a new flag, boost_supported, which will be set to true by the cpufreq core only if the freq table contains valid boost frequencies. Some cpufreq drivers though don't have boost frequencies in the freq-table, they can set this flag from their ->init() callbacks. Once all the drivers are updated to set the flag correctly, we can check it before enabling boost feature for a policy. Signed-off-by: Viresh Kumar <[email protected]>
1 parent 9a23eb8 commit 1f7d1ba

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/cpufreq/freq_table.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy)
359359
if (ret)
360360
return ret;
361361

362+
/* Driver's may have set this field already */
363+
if (policy_has_boost_freq(policy))
364+
policy->boost_supported = true;
365+
362366
return set_freq_table_sorted(policy);
363367
}
364368

include/linux/cpufreq.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ struct cpufreq_policy {
144144
/* Per policy boost enabled flag. */
145145
bool boost_enabled;
146146

147+
/* Per policy boost supported flag. */
148+
bool boost_supported;
149+
147150
/* Cached frequency lookup from cpufreq_driver_resolve_freq. */
148151
unsigned int cached_target_freq;
149152
unsigned int cached_resolved_idx;

0 commit comments

Comments
 (0)