Skip to content

Commit 0e8d856

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: Preserve policy's boost state after resume
If the global boost flag was enabled and policy boost flag was disabled before a suspend resume cycle, cpufreq_online() will enable the policy boost flag on resume. While it is important for the policy boost flag to mirror the global boost flag when a policy is first created, it should be avoided when the policy is reinitialized (for example after a suspend resume cycle). Though, if the global boost flag is disabled at this point of time, we want to make sure policy boost flag is disabled too. Reviewed-by: Lifeng Zheng <[email protected]> Signed-off-by: Viresh Kumar <[email protected]> Link: https://patch.msgid.link/de5c72a0af101049204305c73cd30eb3a3e7b4a0.1745511526.git.viresh.kumar@linaro.org Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 27241c8 commit 0e8d856

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,8 +1623,13 @@ static int cpufreq_online(unsigned int cpu)
16231623
if (new_policy && cpufreq_thermal_control_enabled(cpufreq_driver))
16241624
policy->cdev = of_cpufreq_cooling_register(policy);
16251625

1626-
/* Let the per-policy boost flag mirror the cpufreq_driver boost during init */
1627-
if (cpufreq_driver->set_boost && policy->boost_supported) {
1626+
/*
1627+
* Let the per-policy boost flag mirror the cpufreq_driver boost during
1628+
* initialization for a new policy. For an existing policy, maintain the
1629+
* previous boost value unless global boost is disabled.
1630+
*/
1631+
if (cpufreq_driver->set_boost && policy->boost_supported &&
1632+
(new_policy || !cpufreq_boost_enabled())) {
16281633
ret = policy_set_boost(policy, cpufreq_boost_enabled());
16291634
if (ret) {
16301635
/* If the set_boost fails, the online operation is not affected */

0 commit comments

Comments
 (0)