Commit 134999da authored by Dave Jones's avatar Dave Jones

[CPUFREQ] Add the "performance" and "powersave" governors as modules.

Also add a config option so that the default governor [which is loaded
and enabled at boot] is started. Note that if you select "performance"
here, the CPU will be set to the highest possible frequency even if
the CPU was booted at a lower frequency. If you select "userspace",
the frequency will stay the same.
parent e804252b
...@@ -10,9 +10,54 @@ config CPU_FREQ_PROC_INTF ...@@ -10,9 +10,54 @@ config CPU_FREQ_PROC_INTF
If in doubt, say N. If in doubt, say N.
choice
prompt "Default CPUFreq governor"
depends on CPU_FREQ
default CPU_FREQ_DEFAULT_GOV_PERFORMANCE
help
This option sets which CPUFreq governor shall be loaded at
startup. If in doubt, select 'performance'.
config CPU_FREQ_DEFAULT_GOV_PERFORMANCE
bool "performance"
select CPU_FREQ_GOV_PERFORMANCE
help
Use the CPUFreq governor 'performance' as default. This sets
the frequency statically to the highest frequency supported by
the CPU.
config CPU_FREQ_DEFAULT_GOV_USERSPACE
bool "userspace"
select CPU_FREQ_GOV_USERSPACE
help
Use the CPUFreq governor 'userspace' as default. This allows
you to set the CPU frequency manually or when an userspace
programm shall be able to set the CPU dynamically without having
to enable the userspace governor manually.
endchoice
config CPU_FREQ_GOV_PERFORMANCE
tristate "'powersave' governor"
depends on CPU_FREQ
help
This cpufreq governors set the frequency statically to the
highest available CPU frequency.
If in doubt, say Y.
config CPU_FREQ_GOV_POWERSAVE
tristate "'powersave' governor"
depends on CPU_FREQ
help
Theis cpufreq governors set the frequency statically to the
lowest available CPU frequency.
If in doubt, say Y.
config CPU_FREQ_GOV_USERSPACE config CPU_FREQ_GOV_USERSPACE
tristate "'userspace' governor for userspace frequency scaling" tristate "'userspace' governor for userspace frequency scaling"
depends on CPU_FREQ depends on CPU_FREQ
help help
Enable this cpufreq governor when you either want to set the Enable this cpufreq governor when you either want to set the
CPU frequency manually or when an userspace programm shall CPU frequency manually or when an userspace programm shall
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o
# CPUfreq governors # CPUfreq governors
obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o
obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o
obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o
# CPUfreq cross-arch helpers # CPUfreq cross-arch helpers
......
/*
* linux/drivers/cpufreq/cpufreq_performance.c
*
* Copyright (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/cpufreq.h>
#include <linux/init.h>
static int cpufreq_governor_performance(struct cpufreq_policy *policy,
unsigned int event)
{
switch (event) {
case CPUFREQ_GOV_START:
case CPUFREQ_GOV_LIMITS:
__cpufreq_driver_target(policy, policy->max, CPUFREQ_RELATION_H);
break;
default:
break;
}
return 0;
}
struct cpufreq_governor cpufreq_gov_performance = {
.name = "performance",
.governor = cpufreq_governor_performance,
.owner = THIS_MODULE,
};
EXPORT_SYMBOL(cpufreq_gov_performance);
static int __init cpufreq_gov_performance_init(void)
{
return cpufreq_register_governor(&cpufreq_gov_performance);
}
static void __exit cpufreq_gov_performance_exit(void)
{
cpufreq_unregister_governor(&cpufreq_gov_performance);
}
MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
MODULE_DESCRIPTION("CPUfreq policy governor 'performance'");
MODULE_LICENSE("GPL");
fs_initcall(cpufreq_gov_performance_init);
module_exit(cpufreq_gov_performance_exit);
/*
* linux/drivers/cpufreq/cpufreq_powersave.c
*
* Copyright (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/cpufreq.h>
#include <linux/init.h>
static int cpufreq_governor_powersave(struct cpufreq_policy *policy,
unsigned int event)
{
switch (event) {
case CPUFREQ_GOV_START:
case CPUFREQ_GOV_LIMITS:
__cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L);
break;
default:
break;
}
return 0;
}
static struct cpufreq_governor cpufreq_gov_powersave = {
.name = "powersave",
.governor = cpufreq_governor_powersave,
.owner = THIS_MODULE,
};
static int __init cpufreq_gov_powersave_init(void)
{
return cpufreq_register_governor(&cpufreq_gov_powersave);
}
static void __exit cpufreq_gov_powersave_exit(void)
{
cpufreq_unregister_governor(&cpufreq_gov_powersave);
}
MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
MODULE_DESCRIPTION("CPUfreq policy governor 'powersave'");
MODULE_LICENSE("GPL");
module_init(cpufreq_gov_powersave_init);
module_exit(cpufreq_gov_powersave_exit);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment