blob: 2965ab32a583f769ea919c30427eb7255b04909a [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Len Brown4f86d3a2007-10-03 18:58:00 -04002/*
3 * cpuidle.h - The internal header file
4 */
5
6#ifndef __DRIVER_CPUIDLE_H
7#define __DRIVER_CPUIDLE_H
8
Len Brown4f86d3a2007-10-03 18:58:00 -04009/* For internal use only */
10extern struct cpuidle_governor *cpuidle_curr_governor;
Len Brown4f86d3a2007-10-03 18:58:00 -040011extern struct list_head cpuidle_governors;
12extern struct list_head cpuidle_detected_devices;
13extern struct mutex cpuidle_lock;
14extern spinlock_t cpuidle_driver_lock;
Len Brown62027ae2011-04-01 18:13:10 -040015extern int cpuidle_disabled(void);
Colin Cross56cfbf72012-05-07 17:57:39 -070016extern int cpuidle_enter_state(struct cpuidle_device *dev,
17 struct cpuidle_driver *drv, int next_state);
Len Brown4f86d3a2007-10-03 18:58:00 -040018
19/* idle loop */
20extern void cpuidle_install_idle_handler(void);
21extern void cpuidle_uninstall_idle_handler(void);
22
23/* governors */
24extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
25
26/* sysfs */
Daniel Lezcano8f3e9952012-10-31 01:09:02 +010027
28struct device;
29
Kay Sievers8a25a2f2011-12-21 14:29:42 -080030extern int cpuidle_add_interface(struct device *dev);
31extern void cpuidle_remove_interface(struct device *dev);
Daniel Lezcanobf4d1b52012-10-31 16:44:48 +000032extern int cpuidle_add_device_sysfs(struct cpuidle_device *device);
33extern void cpuidle_remove_device_sysfs(struct cpuidle_device *device);
Daniel Lezcano1aef40e2012-10-26 12:26:24 +020034extern int cpuidle_add_sysfs(struct cpuidle_device *dev);
35extern void cpuidle_remove_sysfs(struct cpuidle_device *dev);
Len Brown4f86d3a2007-10-03 18:58:00 -040036
Colin Cross4126c012012-05-07 17:57:41 -070037#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
Xunlei Pang4c1ed5a2015-08-04 13:48:56 +080038bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state);
Xunlei Pangabceaa92015-08-31 11:34:05 +080039int cpuidle_coupled_state_verify(struct cpuidle_driver *drv);
Colin Cross4126c012012-05-07 17:57:41 -070040int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
41 struct cpuidle_driver *drv, int next_state);
42int cpuidle_coupled_register_device(struct cpuidle_device *dev);
43void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
44#else
Xunlei Pang4c1ed5a2015-08-04 13:48:56 +080045static inline
46bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state)
Colin Cross4126c012012-05-07 17:57:41 -070047{
48 return false;
49}
50
Xunlei Pangabceaa92015-08-31 11:34:05 +080051static inline int cpuidle_coupled_state_verify(struct cpuidle_driver *drv)
52{
53 return 0;
54}
55
Colin Cross4126c012012-05-07 17:57:41 -070056static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
57 struct cpuidle_driver *drv, int next_state)
58{
59 return -1;
60}
61
62static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
63{
64 return 0;
65}
66
67static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
68{
69}
70#endif
71
Len Brown4f86d3a2007-10-03 18:58:00 -040072#endif /* __DRIVER_CPUIDLE_H */