xref: /openbmc/linux/drivers/cpuidle/cpuidle.h (revision 4126c0197bc8c58a0bb7fcda07b01b596b6fb4c5)
14f86d3a8SLen Brown /*
24f86d3a8SLen Brown  * cpuidle.h - The internal header file
34f86d3a8SLen Brown  */
44f86d3a8SLen Brown 
54f86d3a8SLen Brown #ifndef __DRIVER_CPUIDLE_H
64f86d3a8SLen Brown #define __DRIVER_CPUIDLE_H
74f86d3a8SLen Brown 
88a25a2fdSKay Sievers #include <linux/device.h>
94f86d3a8SLen Brown 
104f86d3a8SLen Brown /* For internal use only */
114f86d3a8SLen Brown extern struct cpuidle_governor *cpuidle_curr_governor;
124f86d3a8SLen Brown extern struct list_head cpuidle_governors;
134f86d3a8SLen Brown extern struct list_head cpuidle_detected_devices;
144f86d3a8SLen Brown extern struct mutex cpuidle_lock;
154f86d3a8SLen Brown extern spinlock_t cpuidle_driver_lock;
1662027aeaSLen Brown extern int cpuidle_disabled(void);
1756cfbf74SColin Cross extern int cpuidle_enter_state(struct cpuidle_device *dev,
1856cfbf74SColin Cross 		struct cpuidle_driver *drv, int next_state);
194f86d3a8SLen Brown 
204f86d3a8SLen Brown /* idle loop */
214f86d3a8SLen Brown extern void cpuidle_install_idle_handler(void);
224f86d3a8SLen Brown extern void cpuidle_uninstall_idle_handler(void);
234f86d3a8SLen Brown 
244f86d3a8SLen Brown /* governors */
254f86d3a8SLen Brown extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
264f86d3a8SLen Brown 
274f86d3a8SLen Brown /* sysfs */
288a25a2fdSKay Sievers extern int cpuidle_add_interface(struct device *dev);
298a25a2fdSKay Sievers extern void cpuidle_remove_interface(struct device *dev);
304f86d3a8SLen Brown extern int cpuidle_add_state_sysfs(struct cpuidle_device *device);
314f86d3a8SLen Brown extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device);
328a25a2fdSKay Sievers extern int cpuidle_add_sysfs(struct device *dev);
338a25a2fdSKay Sievers extern void cpuidle_remove_sysfs(struct device *dev);
344f86d3a8SLen Brown 
35*4126c019SColin Cross #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
36*4126c019SColin Cross bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
37*4126c019SColin Cross 		struct cpuidle_driver *drv, int state);
38*4126c019SColin Cross int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
39*4126c019SColin Cross 		struct cpuidle_driver *drv, int next_state);
40*4126c019SColin Cross int cpuidle_coupled_register_device(struct cpuidle_device *dev);
41*4126c019SColin Cross void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
42*4126c019SColin Cross #else
43*4126c019SColin Cross static inline bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
44*4126c019SColin Cross 		struct cpuidle_driver *drv, int state)
45*4126c019SColin Cross {
46*4126c019SColin Cross 	return false;
47*4126c019SColin Cross }
48*4126c019SColin Cross 
49*4126c019SColin Cross static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
50*4126c019SColin Cross 		struct cpuidle_driver *drv, int next_state)
51*4126c019SColin Cross {
52*4126c019SColin Cross 	return -1;
53*4126c019SColin Cross }
54*4126c019SColin Cross 
55*4126c019SColin Cross static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
56*4126c019SColin Cross {
57*4126c019SColin Cross 	return 0;
58*4126c019SColin Cross }
59*4126c019SColin Cross 
60*4126c019SColin Cross static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
61*4126c019SColin Cross {
62*4126c019SColin Cross }
63*4126c019SColin Cross #endif
64*4126c019SColin Cross 
654f86d3a8SLen Brown #endif /* __DRIVER_CPUIDLE_H */
66