Commit 00e299fff3cc2745847b03eebcc9e9362db9366d

Authored by Mike Chan
Committed by Dave Jones
1 parent 298decfbc4

[CPUFREQ] ondemand: Refactor frequency increase code

Make simpler to read and call.

*** v3 - Always call when powersave_bias is enabled.

Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Mike Chan <mike@android.com>
Signed-off-by: Dave Jones <davej@redhat.com>

Showing 1 changed file with 12 additions and 13 deletions Side-by-side Diff

drivers/cpufreq/cpufreq_ondemand.c
... ... @@ -459,6 +459,17 @@
459 459  
460 460 /************************** sysfs end ************************/
461 461  
  462 +static void dbs_freq_increase(struct cpufreq_policy *p, unsigned int freq)
  463 +{
  464 + if (dbs_tuners_ins.powersave_bias)
  465 + freq = powersave_bias_target(p, freq, CPUFREQ_RELATION_H);
  466 + else if (p->cur == p->max)
  467 + return;
  468 +
  469 + __cpufreq_driver_target(p, freq, dbs_tuners_ins.powersave_bias ?
  470 + CPUFREQ_RELATION_L : CPUFREQ_RELATION_H);
  471 +}
  472 +
462 473 static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
463 474 {
464 475 unsigned int max_load_freq;
... ... @@ -551,19 +562,7 @@
551 562  
552 563 /* Check for frequency increase */
553 564 if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) {
554   - /* if we are already at full speed then break out early */
555   - if (!dbs_tuners_ins.powersave_bias) {
556   - if (policy->cur == policy->max)
557   - return;
558   -
559   - __cpufreq_driver_target(policy, policy->max,
560   - CPUFREQ_RELATION_H);
561   - } else {
562   - int freq = powersave_bias_target(policy, policy->max,
563   - CPUFREQ_RELATION_H);
564   - __cpufreq_driver_target(policy, freq,
565   - CPUFREQ_RELATION_L);
566   - }
  565 + dbs_freq_increase(policy, policy->max);
567 566 return;
568 567 }
569 568