cpuidle.h 2.0 KB

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