@@ -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);
@@ -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;
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(-)