diff options
author | Mike Chan <mike@android.com> | 2010-01-26 20:06:47 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2010-08-03 13:47:04 -0400 |
commit | 00e299fff3cc2745847b03eebcc9e9362db9366d (patch) | |
tree | a58558a9df98f3c42e132dabb73765e010655bb0 | |
parent | 298decfbc44e9a4cb7862ae1b7dfc4e1ba3551b9 (diff) |
[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>
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index e1314212d8d4..fecfcdda6ddd 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -459,6 +459,17 @@ static struct attribute_group dbs_attr_group_old = { | |||
459 | 459 | ||
460 | /************************** sysfs end ************************/ | 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 | static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | 473 | static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) |
463 | { | 474 | { |
464 | unsigned int max_load_freq; | 475 | unsigned int max_load_freq; |
@@ -551,19 +562,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
551 | 562 | ||
552 | /* Check for frequency increase */ | 563 | /* Check for frequency increase */ |
553 | if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) { | 564 | if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) { |
554 | /* if we are already at full speed then break out early */ | 565 | dbs_freq_increase(policy, policy->max); |
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 | } | ||
567 | return; | 566 | return; |
568 | } | 567 | } |
569 | 568 | ||