aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq_conservative.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq_conservative.c')
-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;