aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 18b016ea5f48..87299924e735 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -12,22 +12,11 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/smp.h>
16#include <linux/init.h> 15#include <linux/init.h>
17#include <linux/interrupt.h>
18#include <linux/ctype.h>
19#include <linux/cpufreq.h> 16#include <linux/cpufreq.h>
20#include <linux/sysctl.h>
21#include <linux/types.h>
22#include <linux/fs.h>
23#include <linux/sysfs.h>
24#include <linux/cpu.h> 17#include <linux/cpu.h>
25#include <linux/sched.h>
26#include <linux/kmod.h>
27#include <linux/workqueue.h>
28#include <linux/jiffies.h> 18#include <linux/jiffies.h>
29#include <linux/kernel_stat.h> 19#include <linux/kernel_stat.h>
30#include <linux/percpu.h>
31#include <linux/mutex.h> 20#include <linux/mutex.h>
32 21
33/* 22/*
@@ -79,8 +68,7 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */
79 * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock 68 * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock
80 * is recursive for the same process. -Venki 69 * is recursive for the same process. -Venki
81 */ 70 */
82static DEFINE_MUTEX (dbs_mutex); 71static DEFINE_MUTEX(dbs_mutex);
83static DECLARE_WORK (dbs_work, do_dbs_timer, NULL);
84 72
85static struct workqueue_struct *kondemand_wq; 73static struct workqueue_struct *kondemand_wq;
86 74
@@ -142,7 +130,7 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
142{ 130{
143 unsigned int input; 131 unsigned int input;
144 int ret; 132 int ret;
145 ret = sscanf (buf, "%u", &input); 133 ret = sscanf(buf, "%u", &input);
146 134
147 mutex_lock(&dbs_mutex); 135 mutex_lock(&dbs_mutex);
148 if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) { 136 if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) {
@@ -161,7 +149,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
161{ 149{
162 unsigned int input; 150 unsigned int input;
163 int ret; 151 int ret;
164 ret = sscanf (buf, "%u", &input); 152 ret = sscanf(buf, "%u", &input);
165 153
166 mutex_lock(&dbs_mutex); 154 mutex_lock(&dbs_mutex);
167 if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || 155 if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD ||
@@ -184,7 +172,7 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
184 172
185 unsigned int j; 173 unsigned int j;
186 174
187 ret = sscanf (buf, "%u", &input); 175 ret = sscanf(buf, "%u", &input);
188 if ( ret != 1 ) 176 if ( ret != 1 )
189 return -EINVAL; 177 return -EINVAL;
190 178
@@ -349,8 +337,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
349 337
350 switch (event) { 338 switch (event) {
351 case CPUFREQ_GOV_START: 339 case CPUFREQ_GOV_START:
352 if ((!cpu_online(cpu)) || 340 if ((!cpu_online(cpu)) || (!policy->cur))
353 (!policy->cur))
354 return -EINVAL; 341 return -EINVAL;
355 342
356 if (policy->cpuinfo.transition_latency > 343 if (policy->cpuinfo.transition_latency >
@@ -424,13 +411,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
424 lock_cpu_hotplug(); 411 lock_cpu_hotplug();
425 mutex_lock(&dbs_mutex); 412 mutex_lock(&dbs_mutex);
426 if (policy->max < this_dbs_info->cur_policy->cur) 413 if (policy->max < this_dbs_info->cur_policy->cur)
427 __cpufreq_driver_target( 414 __cpufreq_driver_target(this_dbs_info->cur_policy,
428 this_dbs_info->cur_policy, 415 policy->max,
429 policy->max, CPUFREQ_RELATION_H); 416 CPUFREQ_RELATION_H);
430 else if (policy->min > this_dbs_info->cur_policy->cur) 417 else if (policy->min > this_dbs_info->cur_policy->cur)
431 __cpufreq_driver_target( 418 __cpufreq_driver_target(this_dbs_info->cur_policy,
432 this_dbs_info->cur_policy, 419 policy->min,
433 policy->min, CPUFREQ_RELATION_L); 420 CPUFREQ_RELATION_L);
434 mutex_unlock(&dbs_mutex); 421 mutex_unlock(&dbs_mutex);
435 unlock_cpu_hotplug(); 422 unlock_cpu_hotplug();
436 break; 423 break;
@@ -439,9 +426,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
439} 426}
440 427
441static struct cpufreq_governor cpufreq_gov_dbs = { 428static struct cpufreq_governor cpufreq_gov_dbs = {
442 .name = "ondemand", 429 .name = "ondemand",
443 .governor = cpufreq_governor_dbs, 430 .governor = cpufreq_governor_dbs,
444 .owner = THIS_MODULE, 431 .owner = THIS_MODULE,
445}; 432};
446 433
447static int __init cpufreq_gov_dbs_init(void) 434static int __init cpufreq_gov_dbs_init(void)
@@ -455,10 +442,11 @@ static void __exit cpufreq_gov_dbs_exit(void)
455} 442}
456 443
457 444
458MODULE_AUTHOR ("Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>"); 445MODULE_AUTHOR("Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>");
459MODULE_DESCRIPTION ("'cpufreq_ondemand' - A dynamic cpufreq governor for " 446MODULE_AUTHOR("Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>");
460 "Low Latency Frequency Transition capable processors"); 447MODULE_DESCRIPTION("'cpufreq_ondemand' - A dynamic cpufreq governor for "
461MODULE_LICENSE ("GPL"); 448 "Low Latency Frequency Transition capable processors");
449MODULE_LICENSE("GPL");
462 450
463module_init(cpufreq_gov_dbs_init); 451module_init(cpufreq_gov_dbs_init);
464module_exit(cpufreq_gov_dbs_exit); 452module_exit(cpufreq_gov_dbs_exit);