aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElias Oltmanns <eo@nebensachen.de>2007-10-22 03:50:13 -0400
committerDave Jones <davej@redhat.com>2007-10-22 16:34:39 -0400
commita8d7c3bc2396aff14f9e920677072cb55b016040 (patch)
treea962a7dbbe578abeaa69ce3f76cd3eb3d59643bc
parentc5829cd07ec4c08daa7ff91c821af9b2ac7748df (diff)
[CPUFREQ] Make cpufreq_conservative handle out-of-sync events properly
Make cpufreq_conservative handle out-of-sync events properly Currently, the cpufreq_conservative governor doesn't get notified when the actual frequency the cpu is running at differs from what cpufreq thought it was. As a result the cpu may stay at the maximum frequency after a s2ram / resume cycle even though the system is idle. Signed-off-by: Elias Oltmanns <eo@nebensachen.de> Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 4bd33ce8a6f3..57d02e990af3 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -116,6 +116,27 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu)
116 return ret; 116 return ret;
117} 117}
118 118
119/* keep track of frequency transitions */
120static int
121dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
122 void *data)
123{
124 struct cpufreq_freqs *freq = data;
125 struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info,
126 freq->cpu);
127
128 if (!this_dbs_info->enable)
129 return 0;
130
131 this_dbs_info->requested_freq = freq->new;
132
133 return 0;
134}
135
136static struct notifier_block dbs_cpufreq_notifier_block = {
137 .notifier_call = dbs_cpufreq_notifier
138};
139
119/************************** sysfs interface ************************/ 140/************************** sysfs interface ************************/
120static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) 141static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
121{ 142{
@@ -511,6 +532,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
511 dbs_tuners_ins.sampling_rate = def_sampling_rate; 532 dbs_tuners_ins.sampling_rate = def_sampling_rate;
512 533
513 dbs_timer_init(); 534 dbs_timer_init();
535 cpufreq_register_notifier(
536 &dbs_cpufreq_notifier_block,
537 CPUFREQ_TRANSITION_NOTIFIER);
514 } 538 }
515 539
516 mutex_unlock(&dbs_mutex); 540 mutex_unlock(&dbs_mutex);
@@ -525,9 +549,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
525 * Stop the timerschedule work, when this governor 549 * Stop the timerschedule work, when this governor
526 * is used for first time 550 * is used for first time
527 */ 551 */
528 if (dbs_enable == 0) 552 if (dbs_enable == 0) {
529 dbs_timer_exit(); 553 dbs_timer_exit();
530 554 cpufreq_unregister_notifier(
555 &dbs_cpufreq_notifier_block,
556 CPUFREQ_TRANSITION_NOTIFIER);
557 }
558
531 mutex_unlock(&dbs_mutex); 559 mutex_unlock(&dbs_mutex);
532 560
533 break; 561 break;