1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2011 Google, Inc.
6 * Colin Cross <ccross@android.com>
9 #ifndef _LINUX_CPU_PM_H
10 #define _LINUX_CPU_PM_H
12 #include <linux/kernel.h>
13 #include <linux/notifier.h>
16 * When a CPU goes to a low power state that turns off power to the CPU's
17 * power domain, the contents of some blocks (floating point coprocessors,
18 * interrupt controllers, caches, timers) in the same power domain can
19 * be lost. The cpm_pm notifiers provide a method for platform idle, suspend,
20 * and hotplug implementations to notify the drivers for these blocks that
23 * All cpu_pm notifications must be called with interrupts disabled.
25 * The notifications are split into two classes: CPU notifications and CPU
26 * cluster notifications.
28 * CPU notifications apply to a single CPU and must be called on the affected
29 * CPU. They are used to save per-cpu context for affected blocks.
31 * CPU cluster notifications apply to all CPUs in a single power domain. They
32 * are used to save any global context for affected blocks, and must be called
33 * after all the CPUs in the power domain have been notified of the low power
38 * Event codes passed as unsigned long val to notifier calls
41 /* A single cpu is entering a low power state */
44 /* A single cpu failed to enter a low power state */
47 /* A single cpu is exiting a low power state */
50 /* A cpu power domain is entering a low power state */
53 /* A cpu power domain failed to enter a low power state */
54 CPU_CLUSTER_PM_ENTER_FAILED,
56 /* A cpu power domain is exiting a low power state */
61 int cpu_pm_register_notifier(struct notifier_block *nb);
62 int cpu_pm_unregister_notifier(struct notifier_block *nb);
63 int cpu_pm_enter(void);
64 int cpu_pm_exit(void);
65 int cpu_cluster_pm_enter(void);
66 int cpu_cluster_pm_exit(void);
70 static inline int cpu_pm_register_notifier(struct notifier_block *nb)
75 static inline int cpu_pm_unregister_notifier(struct notifier_block *nb)
80 static inline int cpu_pm_enter(void)
85 static inline int cpu_pm_exit(void)
90 static inline int cpu_cluster_pm_enter(void)
95 static inline int cpu_cluster_pm_exit(void)