aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/governor_simpleondemand.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 15:45:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 15:45:35 -0500
commitbad73c5aa069f1f14cc07ce7bbae8d463635560c (patch)
treedb905bb3400e6fe70be95cd20158bed79b2b2c6c /drivers/devfreq/governor_simpleondemand.c
parentb58ed041a360ed051fab17e4d9b0f451c6fedba7 (diff)
parentf316fc56555a5c3bcf6350f3d5ac26dd2c55f4cb (diff)
Merge tag 'pm+acpi-for-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: - Introduction of device PM QoS flags. - ACPI device power management update allowing subsystems other than PCI to use it more easily. - ACPI device enumeration rework allowing additional kinds of devices to be enumerated via ACPI. From Mika Westerberg, Adrian Hunter, Mathias Nyman, Andy Shevchenko, and Rafael J. Wysocki. - ACPICA update to version 20121018 from Bob Moore and Lv Zheng. - ACPI memory hotplug update from Wen Congyang and Yasuaki Ishimatsu. - Introduction of acpi_handle_<level>() messaging macros and ACPI-based CPU hot-remove support from Toshi Kani. - ACPI EC updates from Feng Tang. - cpufreq updates from Viresh Kumar, Fabio Baltieri and others. - cpuidle changes to quickly notice governor prediction failure from Youquan Song. - Support for using multiple cpuidle drivers at the same time and cpuidle cleanups from Daniel Lezcano. - devfreq updates from Nishanth Menon and others. - cpupower update from Thomas Renninger. - Fixes and small cleanups all over the place. * tag 'pm+acpi-for-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (196 commits) mmc: sdhci-acpi: enable runtime-pm for device HID INT33C6 ACPI: add Haswell LPSS devices to acpi_platform_device_ids list ACPI: add documentation about ACPI 5 enumeration pnpacpi: fix incorrect TEST_ALPHA() test ACPI / PM: Fix header of acpi_dev_pm_detach() in acpi.h ACPI / video: ignore BIOS initial backlight value for HP Folio 13-2000 ACPI : do not use Lid and Sleep button for S5 wakeup ACPI / PNP: Do not crash due to stale pointer use during system resume ACPI / video: Add "Asus UL30VT" to ACPI video detect blacklist ACPI: do acpisleep dmi check when CONFIG_ACPI_SLEEP is set spi / ACPI: add ACPI enumeration support gpio / ACPI: add ACPI support PM / devfreq: remove compiler error with module governors (2) cpupower: IvyBridge (0x3a and 0x3e models) support cpupower: Provide -c param for cpupower monitor to schedule process on all cores cpupower tools: Fix warning and a bug with the cpu package count cpupower tools: Fix malloc of cpu_info structure cpupower tools: Fix issues with sysfs_topology_read_file cpupower tools: Fix minor warnings cpupower tools: Update .gitignore for files created in the debug directories ...
Diffstat (limited to 'drivers/devfreq/governor_simpleondemand.c')
-rw-r--r--drivers/devfreq/governor_simpleondemand.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c
index a2e3eae79011..0720ba84ca92 100644
--- a/drivers/devfreq/governor_simpleondemand.c
+++ b/drivers/devfreq/governor_simpleondemand.c
@@ -10,8 +10,10 @@
10 */ 10 */
11 11
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/module.h>
13#include <linux/devfreq.h> 14#include <linux/devfreq.h>
14#include <linux/math64.h> 15#include <linux/math64.h>
16#include "governor.h"
15 17
16/* Default constants for DevFreq-Simple-Ondemand (DFSO) */ 18/* Default constants for DevFreq-Simple-Ondemand (DFSO) */
17#define DFSO_UPTHRESHOLD (90) 19#define DFSO_UPTHRESHOLD (90)
@@ -88,7 +90,58 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
88 return 0; 90 return 0;
89} 91}
90 92
91const struct devfreq_governor devfreq_simple_ondemand = { 93static int devfreq_simple_ondemand_handler(struct devfreq *devfreq,
94 unsigned int event, void *data)
95{
96 switch (event) {
97 case DEVFREQ_GOV_START:
98 devfreq_monitor_start(devfreq);
99 break;
100
101 case DEVFREQ_GOV_STOP:
102 devfreq_monitor_stop(devfreq);
103 break;
104
105 case DEVFREQ_GOV_INTERVAL:
106 devfreq_interval_update(devfreq, (unsigned int *)data);
107 break;
108
109 case DEVFREQ_GOV_SUSPEND:
110 devfreq_monitor_suspend(devfreq);
111 break;
112
113 case DEVFREQ_GOV_RESUME:
114 devfreq_monitor_resume(devfreq);
115 break;
116
117 default:
118 break;
119 }
120
121 return 0;
122}
123
124static struct devfreq_governor devfreq_simple_ondemand = {
92 .name = "simple_ondemand", 125 .name = "simple_ondemand",
93 .get_target_freq = devfreq_simple_ondemand_func, 126 .get_target_freq = devfreq_simple_ondemand_func,
127 .event_handler = devfreq_simple_ondemand_handler,
94}; 128};
129
130static int __init devfreq_simple_ondemand_init(void)
131{
132 return devfreq_add_governor(&devfreq_simple_ondemand);
133}
134subsys_initcall(devfreq_simple_ondemand_init);
135
136static void __exit devfreq_simple_ondemand_exit(void)
137{
138 int ret;
139
140 ret = devfreq_remove_governor(&devfreq_simple_ondemand);
141 if (ret)
142 pr_err("%s: failed remove governor %d\n", __func__, ret);
143
144 return;
145}
146module_exit(devfreq_simple_ondemand_exit);
147MODULE_LICENSE("GPL");