aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq_ondemand.c
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2007-10-02 16:28:12 -0400
committerDave Jones <davej@redhat.com>2007-10-04 18:40:57 -0400
commit1c2562459faedc35927546cfa5273ec6c2884cce (patch)
treea6133aa5c0ac2b4a8cb12fa37c28e755a458aef0 /drivers/cpufreq/cpufreq_ondemand.c
parent8122c6cea033e8034e99d3b10a4e3f377ce23994 (diff)
[CPUFREQ] allow ondemand and conservative cpufreq governors to be used as default
Depending on the transition latency of the HW for cpufreq switches, the ondemand or conservative governor cannot be used with certain cpufreq drivers. Still the ondemand should be the default governor on a wide range of systems. This patch allows this and lets the governor fallback to the performance governor at cpufreq driver load time, if the driver does not support fast enough frequency switching. Main benefit is that on e.g. installation or other systems without userspace support a working dynamic cpufreq support can be achieved on most systems by simply loading the cpufreq driver. This is especially essential for recent x86(_64) laptop hardware which may rely on working dynamic cpufreq OS support. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Bryan Wu <bryan.wu@analog.com> Cc: Andi Kleen <ak@suse.de> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_ondemand.c')
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index e794527e492..369f4459515 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -47,7 +47,7 @@ static unsigned int def_sampling_rate;
47 (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) 47 (def_sampling_rate / MIN_SAMPLING_RATE_RATIO)
48#define MAX_SAMPLING_RATE (500 * def_sampling_rate) 48#define MAX_SAMPLING_RATE (500 * def_sampling_rate)
49#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) 49#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)
50#define TRANSITION_LATENCY_LIMIT (10 * 1000) 50#define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000)
51 51
52static void do_dbs_timer(struct work_struct *work); 52static void do_dbs_timer(struct work_struct *work);
53 53
@@ -508,12 +508,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
508 if ((!cpu_online(cpu)) || (!policy->cur)) 508 if ((!cpu_online(cpu)) || (!policy->cur))
509 return -EINVAL; 509 return -EINVAL;
510 510
511 if (policy->cpuinfo.transition_latency >
512 (TRANSITION_LATENCY_LIMIT * 1000)) {
513 printk(KERN_WARNING "ondemand governor failed to load "
514 "due to too long transition latency\n");
515 return -EINVAL;
516 }
517 if (this_dbs_info->enable) /* Already enabled */ 511 if (this_dbs_info->enable) /* Already enabled */
518 break; 512 break;
519 513
@@ -585,11 +579,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
585 return 0; 579 return 0;
586} 580}
587 581
588static struct cpufreq_governor cpufreq_gov_dbs = { 582struct cpufreq_governor cpufreq_gov_ondemand = {
589 .name = "ondemand", 583 .name = "ondemand",
590 .governor = cpufreq_governor_dbs, 584 .governor = cpufreq_governor_dbs,
591 .owner = THIS_MODULE, 585 .max_transition_latency = TRANSITION_LATENCY_LIMIT,
586 .owner = THIS_MODULE,
592}; 587};
588EXPORT_SYMBOL(cpufreq_gov_ondemand);
593 589
594static int __init cpufreq_gov_dbs_init(void) 590static int __init cpufreq_gov_dbs_init(void)
595{ 591{
@@ -598,12 +594,12 @@ static int __init cpufreq_gov_dbs_init(void)
598 printk(KERN_ERR "Creation of kondemand failed\n"); 594 printk(KERN_ERR "Creation of kondemand failed\n");
599 return -EFAULT; 595 return -EFAULT;
600 } 596 }
601 return cpufreq_register_governor(&cpufreq_gov_dbs); 597 return cpufreq_register_governor(&cpufreq_gov_ondemand);
602} 598}
603 599
604static void __exit cpufreq_gov_dbs_exit(void) 600static void __exit cpufreq_gov_dbs_exit(void)
605{ 601{
606 cpufreq_unregister_governor(&cpufreq_gov_dbs); 602 cpufreq_unregister_governor(&cpufreq_gov_ondemand);
607 destroy_workqueue(kondemand_wq); 603 destroy_workqueue(kondemand_wq);
608} 604}
609 605