cpuidle.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 char param_governor[];
  9. extern struct cpuidle_governor *cpuidle_curr_governor;
  10. extern struct cpuidle_governor *cpuidle_prev_governor;
  11. extern struct list_head cpuidle_governors;
  12. extern struct list_head cpuidle_detected_devices;
  13. extern struct mutex cpuidle_lock;
  14. extern spinlock_t cpuidle_driver_lock;
  15. extern int cpuidle_disabled(void);
  16. extern int cpuidle_enter_state(struct cpuidle_device *dev,
  17. struct cpuidle_driver *drv, int next_state);
  18. /* idle loop */
  19. extern void cpuidle_install_idle_handler(void);
  20. extern void cpuidle_uninstall_idle_handler(void);
  21. /* governors */
  22. extern struct cpuidle_governor *cpuidle_find_governor(const char *str);
  23. extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
  24. /* sysfs */
  25. struct device;
  26. extern int cpuidle_add_interface(struct device *dev);
  27. extern void cpuidle_remove_interface(struct device *dev);
  28. extern int cpuidle_add_device_sysfs(struct cpuidle_device *device);
  29. extern void cpuidle_remove_device_sysfs(struct cpuidle_device *device);
  30. extern int cpuidle_add_sysfs(struct cpuidle_device *dev);
  31. extern void cpuidle_remove_sysfs(struct cpuidle_device *dev);
  32. #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
  33. bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state);
  34. int cpuidle_coupled_state_verify(struct cpuidle_driver *drv);
  35. int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
  36. struct cpuidle_driver *drv, int next_state);
  37. int cpuidle_coupled_register_device(struct cpuidle_device *dev);
  38. void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
  39. #else
  40. static inline
  41. bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state)
  42. {
  43. return false;
  44. }
  45. static inline int cpuidle_coupled_state_verify(struct cpuidle_driver *drv)
  46. {
  47. return 0;
  48. }
  49. static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
  50. struct cpuidle_driver *drv, int next_state)
  51. {
  52. return -1;
  53. }
  54. static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
  55. {
  56. return 0;
  57. }
  58. static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
  59. {
  60. }
  61. #endif
  62. #endif /* __DRIVER_CPUIDLE_H */