Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame^] | 1 | |
| 2 | |
| 3 | enum { |
| 4 | DEVICE_PM_ON, |
| 5 | DEVICE_PM1, |
| 6 | DEVICE_PM2, |
| 7 | DEVICE_PM3, |
| 8 | DEVICE_PM_OFF, |
| 9 | }; |
| 10 | |
| 11 | /* |
| 12 | * shutdown.c |
| 13 | */ |
| 14 | |
| 15 | extern int device_detach_shutdown(struct device *); |
| 16 | extern void device_shutdown(void); |
| 17 | |
| 18 | |
| 19 | #ifdef CONFIG_PM |
| 20 | |
| 21 | /* |
| 22 | * main.c |
| 23 | */ |
| 24 | |
| 25 | /* |
| 26 | * Used to synchronize global power management operations. |
| 27 | */ |
| 28 | extern struct semaphore dpm_sem; |
| 29 | |
| 30 | /* |
| 31 | * Used to serialize changes to the dpm_* lists. |
| 32 | */ |
| 33 | extern struct semaphore dpm_list_sem; |
| 34 | |
| 35 | /* |
| 36 | * The PM lists. |
| 37 | */ |
| 38 | extern struct list_head dpm_active; |
| 39 | extern struct list_head dpm_off; |
| 40 | extern struct list_head dpm_off_irq; |
| 41 | |
| 42 | |
| 43 | static inline struct dev_pm_info * to_pm_info(struct list_head * entry) |
| 44 | { |
| 45 | return container_of(entry, struct dev_pm_info, entry); |
| 46 | } |
| 47 | |
| 48 | static inline struct device * to_device(struct list_head * entry) |
| 49 | { |
| 50 | return container_of(to_pm_info(entry), struct device, power); |
| 51 | } |
| 52 | |
| 53 | extern int device_pm_add(struct device *); |
| 54 | extern void device_pm_remove(struct device *); |
| 55 | |
| 56 | /* |
| 57 | * sysfs.c |
| 58 | */ |
| 59 | |
| 60 | extern int dpm_sysfs_add(struct device *); |
| 61 | extern void dpm_sysfs_remove(struct device *); |
| 62 | |
| 63 | /* |
| 64 | * resume.c |
| 65 | */ |
| 66 | |
| 67 | extern void dpm_resume(void); |
| 68 | extern void dpm_power_up(void); |
| 69 | extern int resume_device(struct device *); |
| 70 | |
| 71 | /* |
| 72 | * suspend.c |
| 73 | */ |
| 74 | extern int suspend_device(struct device *, pm_message_t); |
| 75 | |
| 76 | |
| 77 | /* |
| 78 | * runtime.c |
| 79 | */ |
| 80 | |
| 81 | extern int dpm_runtime_suspend(struct device *, pm_message_t); |
| 82 | extern void dpm_runtime_resume(struct device *); |
| 83 | |
| 84 | #else /* CONFIG_PM */ |
| 85 | |
| 86 | |
| 87 | static inline int device_pm_add(struct device * dev) |
| 88 | { |
| 89 | return 0; |
| 90 | } |
| 91 | static inline void device_pm_remove(struct device * dev) |
| 92 | { |
| 93 | |
| 94 | } |
| 95 | |
| 96 | static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state) |
| 97 | { |
| 98 | return 0; |
| 99 | } |
| 100 | |
| 101 | static inline void dpm_runtime_resume(struct device * dev) |
| 102 | { |
| 103 | |
| 104 | } |
| 105 | |
| 106 | #endif |