@@ -797,7 +797,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
if (policy->cur < policy->max)
this_dbs_info->rate_mult =
dbs_tuners_ins.sampling_down_factor;
- dbs_freq_increase(policy, policy->max);
+ /* Before go to turbo, try P1 first */
+ if ((policy->max > policy->sec_max) &&
+ (policy->cur == policy->sec_max))
+ dbs_freq_increase(policy, policy->max);
+ else
+ dbs_freq_increase(policy, policy->sec_max);
return;
}
@@ -26,6 +26,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
{
unsigned int min_freq = ~0;
unsigned int max_freq = 0;
+ unsigned int sec_max_freq = 0;
unsigned int i;
for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
@@ -41,10 +42,18 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
min_freq = freq;
if (freq > max_freq)
max_freq = freq;
+ /* Find the second largest frequency */
+ if ((freq < max_freq) && (freq > sec_max_freq))
+ sec_max_freq = freq;
}
policy->min = policy->cpuinfo.min_freq = min_freq;
policy->max = policy->cpuinfo.max_freq = max_freq;
+ /* Check CPU turbo mode enabled */
+ if (max_freq - sec_max_freq == 1000)
+ policy->sec_max = sec_max_freq;
+ else
+ policy->sec_max = max_freq;
if (policy->min == ~0)
return -EINVAL;
@@ -92,6 +92,7 @@ struct cpufreq_policy {
unsigned int min; /* in kHz */
unsigned int max; /* in kHz */
+ unsigned int sec_max; /* in kHz*/
unsigned int cur; /* in kHz, only needed if cpufreq
* governors are used */
unsigned int policy; /* see above */