aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm.h
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2005-09-12 22:39:34 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:50 -0400
commit0ac85241ebc7bf6b86ab498960cc121d53ef69ae (patch)
tree8b5d9d5a3e475c49d771d1a4bd597ea561331ff7 /include/linux/pm.h
parent2a7ff1feda9f5cd6463744239ec5e661ee7d5f01 (diff)
[PATCH] driver model wakeup flags
This is a refresh of an earlier patch to add "wakeup" support to the PM core model. This provides per-device bus-neutral control of the use of wakeup events. * "struct device_pm_info" has two bits that are initialized as part of setting up the enclosing struct device: - "can_wakeup", reflecting hardware capabilities - "may_wakeup", the policy setting (when CONFIG_PM) * There's a writeable sysfs "wakeup" file, with one of two values: - "enabled", when the policy is to allow wakeup - "disabled", when the policy is not to allow it - "" if the device can't currently issue wakeups By default, wakeup is enabled on all devices that support it. If its driver doesn't support it ... treat it as a bug. :) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 */