power.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. enum {
  2. DEVICE_PM_ON,
  3. DEVICE_PM1,
  4. DEVICE_PM2,
  5. DEVICE_PM3,
  6. DEVICE_PM_OFF,
  7. };
  8. /*
  9. * shutdown.c
  10. */
  11. extern int device_detach_shutdown(struct device *);
  12. extern void device_shutdown(void);
  13. #ifdef CONFIG_PM
  14. /*
  15. * main.c
  16. */
  17. /*
  18. * Used to synchronize global power management operations.
  19. */
  20. extern struct semaphore dpm_sem;
  21. /*
  22. * Used to serialize changes to the dpm_* lists.
  23. */
  24. extern struct semaphore dpm_list_sem;
  25. /*
  26. * The PM lists.
  27. */
  28. extern struct list_head dpm_active;
  29. extern struct list_head dpm_off;
  30. extern struct list_head dpm_off_irq;
  31. static inline struct dev_pm_info * to_pm_info(struct list_head * entry)
  32. {
  33. return container_of(entry, struct dev_pm_info, entry);
  34. }
  35. static inline struct device * to_device(struct list_head * entry)
  36. {
  37. return container_of(to_pm_info(entry), struct device, power);
  38. }
  39. extern int device_pm_add(struct device *);
  40. extern void device_pm_remove(struct device *);
  41. /*
  42. * sysfs.c
  43. */
  44. extern int dpm_sysfs_add(struct device *);
  45. extern void dpm_sysfs_remove(struct device *);
  46. /*
  47. * resume.c
  48. */
  49. extern void dpm_resume(void);
  50. extern void dpm_power_up(void);
  51. extern int resume_device(struct device *);
  52. /*
  53. * suspend.c
  54. */
  55. extern int suspend_device(struct device *, pm_message_t);
  56. /*
  57. * runtime.c
  58. */
  59. extern int dpm_runtime_suspend(struct device *, pm_message_t);
  60. extern void dpm_runtime_resume(struct device *);
  61. #else /* CONFIG_PM */
  62. static inline int device_pm_add(struct device * dev)
  63. {
  64. return 0;
  65. }
  66. static inline void device_pm_remove(struct device * dev)
  67. {
  68. }
  69. static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
  70. {
  71. return 0;
  72. }
  73. static inline void dpm_runtime_resume(struct device * dev)
  74. {
  75. }
  76. #endif