aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r--include/linux/pm.h90
1 files changed, 39 insertions, 51 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 5cfb07648eca..5be87ba3b7ac 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -94,55 +94,6 @@ struct pm_dev
94 struct list_head entry; 94 struct list_head entry;
95}; 95};
96 96
97#ifdef CONFIG_PM
98
99extern int pm_active;
100
101#define PM_IS_ACTIVE() (pm_active != 0)
102
103/*
104 * Register a device with power management
105 */
106struct pm_dev __deprecated *
107pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
108
109/*
110 * Unregister a device with power management
111 */
112void __deprecated pm_unregister(struct pm_dev *dev);
113
114/*
115 * Unregister all devices with matching callback
116 */
117void __deprecated pm_unregister_all(pm_callback callback);
118
119/*
120 * Send a request to all devices
121 */
122int __deprecated pm_send_all(pm_request_t rqst, void *data);
123
124#else /* CONFIG_PM */
125
126#define PM_IS_ACTIVE() 0
127
128static inline struct pm_dev *pm_register(pm_dev_t type,
129 unsigned long id,
130 pm_callback callback)
131{
132 return NULL;
133}
134
135static inline void pm_unregister(struct pm_dev *dev) {}
136
137static inline void pm_unregister_all(pm_callback callback) {}
138
139static inline int pm_send_all(pm_request_t rqst, void *data)
140{
141 return 0;
142}
143
144#endif /* CONFIG_PM */
145
146/* Functions above this comment are list-based old-style power 97/* Functions above this comment are list-based old-style power
147 * managment. Please avoid using them. */ 98 * managment. Please avoid using them. */
148 99
@@ -170,6 +121,7 @@ typedef int __bitwise suspend_disk_method_t;
170 121
171struct pm_ops { 122struct pm_ops {
172 suspend_disk_method_t pm_disk_mode; 123 suspend_disk_method_t pm_disk_mode;
124 int (*valid)(suspend_state_t state);
173 int (*prepare)(suspend_state_t state); 125 int (*prepare)(suspend_state_t state);
174 int (*enter)(suspend_state_t state); 126 int (*enter)(suspend_state_t state);
175 int (*finish)(suspend_state_t state); 127 int (*finish)(suspend_state_t state);
@@ -219,10 +171,11 @@ typedef struct pm_message {
219 171
220struct dev_pm_info { 172struct dev_pm_info {
221 pm_message_t power_state; 173 pm_message_t power_state;
174 unsigned can_wakeup:1;
222#ifdef CONFIG_PM 175#ifdef CONFIG_PM
176 unsigned should_wakeup:1;
223 pm_message_t prev_state; 177 pm_message_t prev_state;
224 void * saved_state; 178 void * saved_state;
225 atomic_t pm_users;
226 struct device * pm_parent; 179 struct device * pm_parent;
227 struct list_head entry; 180 struct list_head entry;
228#endif 181#endif
@@ -236,13 +189,48 @@ extern void device_resume(void);
236 189
237#ifdef CONFIG_PM 190#ifdef CONFIG_PM
238extern int device_suspend(pm_message_t state); 191extern int device_suspend(pm_message_t state);
239#else 192
193#define device_set_wakeup_enable(dev,val) \
194 ((dev)->power.should_wakeup = !!(val))
195#define device_may_wakeup(dev) \
196 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
197
198extern int dpm_runtime_suspend(struct device *, pm_message_t);
199extern void dpm_runtime_resume(struct device *);
200
201#else /* !CONFIG_PM */
202
240static inline int device_suspend(pm_message_t state) 203static inline int device_suspend(pm_message_t state)
241{ 204{
242 return 0; 205 return 0;
243} 206}
207
208#define device_set_wakeup_enable(dev,val) do{}while(0)
209#define device_may_wakeup(dev) (0)
210
211static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
212{
213 return 0;
214}
215
216static inline void dpm_runtime_resume(struct device * dev)
217{
218
219}
220
244#endif 221#endif
245 222
223/* changes to device_may_wakeup take effect on the next pm state change.
224 * by default, devices should wakeup if they can.
225 */
226#define device_can_wakeup(dev) \
227 ((dev)->power.can_wakeup)
228#define device_init_wakeup(dev,val) \
229 do { \
230 device_can_wakeup(dev) = !!(val); \
231 device_set_wakeup_enable(dev,val); \
232 } while(0)
233
246#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
247 235
248#endif /* _LINUX_PM_H */ 236#endif /* _LINUX_PM_H */