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.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 5cfb07648eca..7897cf500c51 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -219,7 +219,9 @@ typedef struct pm_message {
219 219
220struct dev_pm_info { 220struct dev_pm_info {
221 pm_message_t power_state; 221 pm_message_t power_state;
222 unsigned can_wakeup:1;
222#ifdef CONFIG_PM 223#ifdef CONFIG_PM
224 unsigned should_wakeup:1;
223 pm_message_t prev_state; 225 pm_message_t prev_state;
224 void * saved_state; 226 void * saved_state;
225 atomic_t pm_users; 227 atomic_t pm_users;
@@ -236,13 +238,35 @@ extern void device_resume(void);
236 238
237#ifdef CONFIG_PM 239#ifdef CONFIG_PM
238extern int device_suspend(pm_message_t state); 240extern int device_suspend(pm_message_t state);
239#else 241
242#define device_set_wakeup_enable(dev,val) \
243 ((dev)->power.should_wakeup = !!(val))
244#define device_may_wakeup(dev) \
245 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
246
247#else /* !CONFIG_PM */
248
240static inline int device_suspend(pm_message_t state) 249static inline int device_suspend(pm_message_t state)
241{ 250{
242 return 0; 251 return 0;
243} 252}
253
254#define device_set_wakeup_enable(dev,val) do{}while(0)
255#define device_may_wakeup(dev) (0)
256
244#endif 257#endif
245 258
259/* changes to device_may_wakeup take effect on the next pm state change.
260 * by default, devices should wakeup if they can.
261 */
262#define device_can_wakeup(dev) \
263 ((dev)->power.can_wakeup)
264#define device_init_wakeup(dev,val) \
265 do { \
266 device_can_wakeup(dev) = !!(val); \
267 device_set_wakeup_enable(dev,val); \
268 } while(0)
269
246#endif /* __KERNEL__ */ 270#endif /* __KERNEL__ */
247 271
248#endif /* _LINUX_PM_H */ 272#endif /* _LINUX_PM_H */