cpuidle.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * cpuidle.h - The internal header file
  3. */
  4. #ifndef __DRIVER_CPUIDLE_H
  5. #define __DRIVER_CPUIDLE_H
  6. #include <linux/device.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. extern int cpuidle_add_interface(struct device *dev);
  23. extern void cpuidle_remove_interface(struct device *dev);
  24. extern int cpuidle_add_state_sysfs(struct cpuidle_device *device);
  25. extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device);
  26. extern int cpuidle_add_sysfs(struct device *dev);
  27. extern void cpuidle_remove_sysfs(struct device *dev);
  28. #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
  29. bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
  30. struct cpuidle_driver *drv, int state);
  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 bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
  37. struct cpuidle_driver *drv, int state)
  38. {
  39. return false;
  40. }
  41. static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
  42. struct cpuidle_driver *drv, int next_state)
  43. {
  44. return -1;
  45. }
  46. static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
  47. {
  48. return 0;
  49. }
  50. static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
  51. {
  52. }
  53. #endif
  54. #endif /* __DRIVER_CPUIDLE_H */