diff options
Diffstat (limited to 'include/linux/pm_wakeup.h')
| -rw-r--r-- | include/linux/pm_wakeup.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 9cff00dd6b63..a32da962d693 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
| @@ -62,18 +62,11 @@ struct wakeup_source { | |||
| 62 | * Changes to device_may_wakeup take effect on the next pm state change. | 62 | * Changes to device_may_wakeup take effect on the next pm state change. |
| 63 | */ | 63 | */ |
| 64 | 64 | ||
| 65 | static inline void device_set_wakeup_capable(struct device *dev, bool capable) | ||
| 66 | { | ||
| 67 | dev->power.can_wakeup = capable; | ||
| 68 | } | ||
| 69 | |||
| 70 | static inline bool device_can_wakeup(struct device *dev) | 65 | static inline bool device_can_wakeup(struct device *dev) |
| 71 | { | 66 | { |
| 72 | return dev->power.can_wakeup; | 67 | return dev->power.can_wakeup; |
| 73 | } | 68 | } |
| 74 | 69 | ||
| 75 | |||
| 76 | |||
| 77 | static inline bool device_may_wakeup(struct device *dev) | 70 | static inline bool device_may_wakeup(struct device *dev) |
| 78 | { | 71 | { |
| 79 | return dev->power.can_wakeup && !!dev->power.wakeup; | 72 | return dev->power.can_wakeup && !!dev->power.wakeup; |
| @@ -88,6 +81,7 @@ extern struct wakeup_source *wakeup_source_register(const char *name); | |||
| 88 | extern void wakeup_source_unregister(struct wakeup_source *ws); | 81 | extern void wakeup_source_unregister(struct wakeup_source *ws); |
| 89 | extern int device_wakeup_enable(struct device *dev); | 82 | extern int device_wakeup_enable(struct device *dev); |
| 90 | extern int device_wakeup_disable(struct device *dev); | 83 | extern int device_wakeup_disable(struct device *dev); |
| 84 | extern void device_set_wakeup_capable(struct device *dev, bool capable); | ||
| 91 | extern int device_init_wakeup(struct device *dev, bool val); | 85 | extern int device_init_wakeup(struct device *dev, bool val); |
| 92 | extern int device_set_wakeup_enable(struct device *dev, bool enable); | 86 | extern int device_set_wakeup_enable(struct device *dev, bool enable); |
| 93 | extern void __pm_stay_awake(struct wakeup_source *ws); | 87 | extern void __pm_stay_awake(struct wakeup_source *ws); |
| @@ -109,11 +103,6 @@ static inline bool device_can_wakeup(struct device *dev) | |||
| 109 | return dev->power.can_wakeup; | 103 | return dev->power.can_wakeup; |
| 110 | } | 104 | } |
| 111 | 105 | ||
| 112 | static inline bool device_may_wakeup(struct device *dev) | ||
| 113 | { | ||
| 114 | return false; | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline struct wakeup_source *wakeup_source_create(const char *name) | 106 | static inline struct wakeup_source *wakeup_source_create(const char *name) |
| 118 | { | 107 | { |
| 119 | return NULL; | 108 | return NULL; |
| @@ -134,24 +123,32 @@ static inline void wakeup_source_unregister(struct wakeup_source *ws) {} | |||
| 134 | 123 | ||
| 135 | static inline int device_wakeup_enable(struct device *dev) | 124 | static inline int device_wakeup_enable(struct device *dev) |
| 136 | { | 125 | { |
| 137 | return -EINVAL; | 126 | dev->power.should_wakeup = true; |
| 127 | return 0; | ||
| 138 | } | 128 | } |
| 139 | 129 | ||
| 140 | static inline int device_wakeup_disable(struct device *dev) | 130 | static inline int device_wakeup_disable(struct device *dev) |
| 141 | { | 131 | { |
| 132 | dev->power.should_wakeup = false; | ||
| 142 | return 0; | 133 | return 0; |
| 143 | } | 134 | } |
| 144 | 135 | ||
| 145 | static inline int device_init_wakeup(struct device *dev, bool val) | 136 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) |
| 146 | { | 137 | { |
| 147 | dev->power.can_wakeup = val; | 138 | dev->power.should_wakeup = enable; |
| 148 | return val ? -EINVAL : 0; | 139 | return 0; |
| 149 | } | 140 | } |
| 150 | 141 | ||
| 142 | static inline int device_init_wakeup(struct device *dev, bool val) | ||
| 143 | { | ||
| 144 | device_set_wakeup_capable(dev, val); | ||
| 145 | device_set_wakeup_enable(dev, val); | ||
| 146 | return 0; | ||
| 147 | } | ||
| 151 | 148 | ||
| 152 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) | 149 | static inline bool device_may_wakeup(struct device *dev) |
| 153 | { | 150 | { |
| 154 | return -EINVAL; | 151 | return dev->power.can_wakeup && dev->power.should_wakeup; |
| 155 | } | 152 | } |
| 156 | 153 | ||
| 157 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} | 154 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} |
