xref: /openbmc/linux/drivers/cpuidle/cpuidle.h (revision 8f3e9953e1e4ae5c11e2e880e7d85c03c0180613)
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 
84f86d3a8SLen Brown /* For internal use only */
94f86d3a8SLen Brown extern struct cpuidle_governor *cpuidle_curr_governor;
104f86d3a8SLen Brown extern struct list_head cpuidle_governors;
114f86d3a8SLen Brown extern struct list_head cpuidle_detected_devices;
124f86d3a8SLen Brown extern struct mutex cpuidle_lock;
134f86d3a8SLen Brown extern spinlock_t cpuidle_driver_lock;
1462027aeaSLen Brown extern int cpuidle_disabled(void);
1556cfbf74SColin Cross extern int cpuidle_enter_state(struct cpuidle_device *dev,
1656cfbf74SColin Cross 		struct cpuidle_driver *drv, int next_state);
174f86d3a8SLen Brown 
184f86d3a8SLen Brown /* idle loop */
194f86d3a8SLen Brown extern void cpuidle_install_idle_handler(void);
204f86d3a8SLen Brown extern void cpuidle_uninstall_idle_handler(void);
214f86d3a8SLen Brown 
224f86d3a8SLen Brown /* governors */
234f86d3a8SLen Brown extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
244f86d3a8SLen Brown 
254f86d3a8SLen Brown /* sysfs */
26*8f3e9953SDaniel Lezcano 
27*8f3e9953SDaniel Lezcano struct device;
28*8f3e9953SDaniel Lezcano 
298a25a2fdSKay Sievers extern int cpuidle_add_interface(struct device *dev);
308a25a2fdSKay Sievers extern void cpuidle_remove_interface(struct device *dev);
314f86d3a8SLen Brown extern int cpuidle_add_state_sysfs(struct cpuidle_device *device);
324f86d3a8SLen Brown extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device);
331aef40e2SDaniel Lezcano extern int cpuidle_add_sysfs(struct cpuidle_device *dev);
341aef40e2SDaniel Lezcano extern void cpuidle_remove_sysfs(struct cpuidle_device *dev);
354f86d3a8SLen Brown 
364126c019SColin Cross #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
374126c019SColin Cross bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
384126c019SColin Cross 		struct cpuidle_driver *drv, int state);
394126c019SColin Cross int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
404126c019SColin Cross 		struct cpuidle_driver *drv, int next_state);
414126c019SColin Cross int cpuidle_coupled_register_device(struct cpuidle_device *dev);
424126c019SColin Cross void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
434126c019SColin Cross #else
444126c019SColin Cross static inline bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
454126c019SColin Cross 		struct cpuidle_driver *drv, int state)
464126c019SColin Cross {
474126c019SColin Cross 	return false;
484126c019SColin Cross }
494126c019SColin Cross 
504126c019SColin Cross static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
514126c019SColin Cross 		struct cpuidle_driver *drv, int next_state)
524126c019SColin Cross {
534126c019SColin Cross 	return -1;
544126c019SColin Cross }
554126c019SColin Cross 
564126c019SColin Cross static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
574126c019SColin Cross {
584126c019SColin Cross 	return 0;
594126c019SColin Cross }
604126c019SColin Cross 
614126c019SColin Cross static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
624126c019SColin Cross {
634126c019SColin Cross }
644126c019SColin Cross #endif
654126c019SColin Cross 
664f86d3a8SLen Brown #endif /* __DRIVER_CPUIDLE_H */
67