summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2013-07-30 14:25:23 -0400
committerJason Liu <r64343@freescale.com>2013-10-30 09:53:58 +0800
commitfc325e614c6815e387d995df58c80d4979624810 (patch)
tree752586907cbd5de1bc4c7bb509339d6cd035b81f /kernel
parentdcb7e61054b959dc4d601a96cce5cc85ad1568ef (diff)
ENGR00273073-1 arm: add cpu idle notification callback
Some modules may need to know cpu idle status and take actions before and after cpu idle, so we can add notification callback when enter/exit cpu idle, then modules only need to register this notification callback, everytime cpu enter/exit idle, the callback chain will be executed. Currently only cpufreq interactive governor use this notification, as it wants to save power, the timers of interactive governor are only enabled when cpu is not in idle. Signed-off-by: Anson Huang <b20788@freescale.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 198a38883e64..6e995438287a 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -726,3 +726,22 @@ void init_cpu_online(const struct cpumask *src)
{
cpumask_copy(to_cpumask(cpu_online_bits), src);
}
+
+static ATOMIC_NOTIFIER_HEAD(idle_notifier);
+void idle_notifier_register(struct notifier_block *n)
+{
+ atomic_notifier_chain_register(&idle_notifier, n);
+}
+EXPORT_SYMBOL_GPL(idle_notifier_register);
+
+void idle_notifier_unregister(struct notifier_block *n)
+{
+ atomic_notifier_chain_unregister(&idle_notifier, n);
+}
+EXPORT_SYMBOL_GPL(idle_notifier_unregister);
+
+void idle_notifier_call_chain(unsigned long val)
+{
+ atomic_notifier_call_chain(&idle_notifier, val, NULL);
+}
+EXPORT_SYMBOL_GPL(idle_notifier_call_chain);