cpuidle.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * cpuidle.h - The internal header file
  4. */
  5. #ifndef __DRIVER_CPUIDLE_H
  6. #define __DRIVER_CPUIDLE_H
  7. /* For internal use only */
  8. extern struct cpuidle_governor *cpuidle_curr_governor;
  9. extern struct list_head cpuidle_governors;
  10. extern struct list_head cpuidle_detected_devices;
  11. extern struct mutex cpuidle_lock;
  12. extern spinlock_t cpuidle_driver_lock;
  13. extern int cpuidle_disabled(void);
  14. extern int cpuidle_enter_state(struct cpuidle_device *dev,
  15. struct cpuidle_driver *drv, int next_state);
  16. /* idle loop */
  17. extern void cpuidle_install_idle_handler(void);
  18. extern void cpuidle_uninstall_idle_handler(void);
  19. /* governors */
  20. extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
  21. /* sysfs */
  22. struct device;
  23. extern int cpuidle_add_interface(struct device *dev);
  24. extern void cpuidle_remove_interface(struct device *dev);
  25. extern int cpuidle_add_device_sysfs(struct cpuidle_device *device);
  26. extern void cpuidle_remove_device_sysfs(struct cpuidle_device *device);
  27. extern int cpuidle_add_sysfs(struct cpuidle_device *dev);
  28. extern void cpuidle_remove_sysfs(struct cpuidle_device *dev);
  29. #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
  30. bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state);
  31. int cpuidle_coupled_state_verify(struct cpuidle_driver *drv);
  32. int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
  33. struct cpuidle_driver *drv, int next_state);
  34. int cpuidle_coupled_register_device(struct cpuidle_device *dev);
  35. void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
  36. #else
  37. static inline
  38. bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state)
  39. {
  40. return false;
  41. }
  42. static inline int cpuidle_coupled_state_verify(struct cpuidle_driver *drv)
  43. {
  44. return 0;
  45. }
  46. static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
  47. struct cpuidle_driver *drv, int next_state)
  48. {
  49. return -1;
  50. }
  51. static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
  52. {
  53. return 0;
  54. }
  55. static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
  56. {
  57. }
  58. #endif
  59. #endif /* __DRIVER_CPUIDLE_H */