2 * Copyright (C) 2011 Google, Inc.
5 * Colin Cross <ccross@android.com>
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #ifndef _LINUX_CPU_PM_H
19 #define _LINUX_CPU_PM_H
21 #include <linux/kernel.h>
22 #include <linux/notifier.h>
25 * When a CPU goes to a low power state that turns off power to the CPU's
26 * power domain, the contents of some blocks (floating point coprocessors,
27 * interrupt controllers, caches, timers) in the same power domain can
28 * be lost. The cpm_pm notifiers provide a method for platform idle, suspend,
29 * and hotplug implementations to notify the drivers for these blocks that
32 * All cpu_pm notifications must be called with interrupts disabled.
34 * The notifications are split into two classes: CPU notifications and CPU
35 * cluster notifications.
37 * CPU notifications apply to a single CPU and must be called on the affected
38 * CPU. They are used to save per-cpu context for affected blocks.
40 * CPU cluster notifications apply to all CPUs in a single power domain. They
41 * are used to save any global context for affected blocks, and must be called
42 * after all the CPUs in the power domain have been notified of the low power
47 * Event codes passed as unsigned long val to notifier calls
50 /* A single cpu is entering a low power state */
53 /* A single cpu failed to enter a low power state */
56 /* A single cpu is exiting a low power state */
59 /* A cpu power domain is entering a low power state */
62 /* A cpu power domain failed to enter a low power state */
63 CPU_CLUSTER_PM_ENTER_FAILED
,
65 /* A cpu power domain is exiting a low power state */
70 int cpu_pm_register_notifier(struct notifier_block
*nb
);
71 int cpu_pm_unregister_notifier(struct notifier_block
*nb
);
72 int cpu_pm_enter(void);
73 int cpu_pm_exit(void);
74 int cpu_cluster_pm_enter(void);
75 int cpu_cluster_pm_exit(void);
79 static inline int cpu_pm_register_notifier(struct notifier_block
*nb
)
84 static inline int cpu_pm_unregister_notifier(struct notifier_block
*nb
)
89 static inline int cpu_pm_enter(void)
94 static inline int cpu_pm_exit(void)
99 static inline int cpu_cluster_pm_enter(void)
104 static inline int cpu_cluster_pm_exit(void)