diff options
Diffstat (limited to 'include/linux/pm_runtime.h')
-rw-r--r-- | include/linux/pm_runtime.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 8ca52f7c357e..99ed1aa8f933 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
@@ -12,12 +12,15 @@ | |||
12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
13 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
14 | 14 | ||
15 | #include <linux/jiffies.h> | ||
16 | |||
15 | /* Runtime PM flag argument bits */ | 17 | /* Runtime PM flag argument bits */ |
16 | #define RPM_ASYNC 0x01 /* Request is asynchronous */ | 18 | #define RPM_ASYNC 0x01 /* Request is asynchronous */ |
17 | #define RPM_NOWAIT 0x02 /* Don't wait for concurrent | 19 | #define RPM_NOWAIT 0x02 /* Don't wait for concurrent |
18 | state change */ | 20 | state change */ |
19 | #define RPM_GET_PUT 0x04 /* Increment/decrement the | 21 | #define RPM_GET_PUT 0x04 /* Increment/decrement the |
20 | usage_count */ | 22 | usage_count */ |
23 | #define RPM_AUTO 0x08 /* Use autosuspend_delay */ | ||
21 | 24 | ||
22 | #ifdef CONFIG_PM_RUNTIME | 25 | #ifdef CONFIG_PM_RUNTIME |
23 | 26 | ||
@@ -37,6 +40,9 @@ extern int pm_generic_runtime_idle(struct device *dev); | |||
37 | extern int pm_generic_runtime_suspend(struct device *dev); | 40 | extern int pm_generic_runtime_suspend(struct device *dev); |
38 | extern int pm_generic_runtime_resume(struct device *dev); | 41 | extern int pm_generic_runtime_resume(struct device *dev); |
39 | extern void pm_runtime_no_callbacks(struct device *dev); | 42 | extern void pm_runtime_no_callbacks(struct device *dev); |
43 | extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); | ||
44 | extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); | ||
45 | extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); | ||
40 | 46 | ||
41 | static inline bool pm_children_suspended(struct device *dev) | 47 | static inline bool pm_children_suspended(struct device *dev) |
42 | { | 48 | { |
@@ -74,6 +80,11 @@ static inline bool pm_runtime_suspended(struct device *dev) | |||
74 | return dev->power.runtime_status == RPM_SUSPENDED; | 80 | return dev->power.runtime_status == RPM_SUSPENDED; |
75 | } | 81 | } |
76 | 82 | ||
83 | static inline void pm_runtime_mark_last_busy(struct device *dev) | ||
84 | { | ||
85 | ACCESS_ONCE(dev->power.last_busy) = jiffies; | ||
86 | } | ||
87 | |||
77 | #else /* !CONFIG_PM_RUNTIME */ | 88 | #else /* !CONFIG_PM_RUNTIME */ |
78 | 89 | ||
79 | static inline int __pm_runtime_idle(struct device *dev, int rpmflags) | 90 | static inline int __pm_runtime_idle(struct device *dev, int rpmflags) |
@@ -113,6 +124,14 @@ static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } | |||
113 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } | 124 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } |
114 | static inline void pm_runtime_no_callbacks(struct device *dev) {} | 125 | static inline void pm_runtime_no_callbacks(struct device *dev) {} |
115 | 126 | ||
127 | static inline void pm_runtime_mark_last_busy(struct device *dev) {} | ||
128 | static inline void __pm_runtime_use_autosuspend(struct device *dev, | ||
129 | bool use) {} | ||
130 | static inline void pm_runtime_set_autosuspend_delay(struct device *dev, | ||
131 | int delay) {} | ||
132 | static inline unsigned long pm_runtime_autosuspend_expiration( | ||
133 | struct device *dev) { return 0; } | ||
134 | |||
116 | #endif /* !CONFIG_PM_RUNTIME */ | 135 | #endif /* !CONFIG_PM_RUNTIME */ |
117 | 136 | ||
118 | static inline int pm_runtime_idle(struct device *dev) | 137 | static inline int pm_runtime_idle(struct device *dev) |
@@ -125,6 +144,11 @@ static inline int pm_runtime_suspend(struct device *dev) | |||
125 | return __pm_runtime_suspend(dev, 0); | 144 | return __pm_runtime_suspend(dev, 0); |
126 | } | 145 | } |
127 | 146 | ||
147 | static inline int pm_runtime_autosuspend(struct device *dev) | ||
148 | { | ||
149 | return __pm_runtime_suspend(dev, RPM_AUTO); | ||
150 | } | ||
151 | |||
128 | static inline int pm_runtime_resume(struct device *dev) | 152 | static inline int pm_runtime_resume(struct device *dev) |
129 | { | 153 | { |
130 | return __pm_runtime_resume(dev, 0); | 154 | return __pm_runtime_resume(dev, 0); |
@@ -155,11 +179,22 @@ static inline int pm_runtime_put(struct device *dev) | |||
155 | return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC); | 179 | return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC); |
156 | } | 180 | } |
157 | 181 | ||
182 | static inline int pm_runtime_put_autosuspend(struct device *dev) | ||
183 | { | ||
184 | return __pm_runtime_suspend(dev, | ||
185 | RPM_GET_PUT | RPM_ASYNC | RPM_AUTO); | ||
186 | } | ||
187 | |||
158 | static inline int pm_runtime_put_sync(struct device *dev) | 188 | static inline int pm_runtime_put_sync(struct device *dev) |
159 | { | 189 | { |
160 | return __pm_runtime_idle(dev, RPM_GET_PUT); | 190 | return __pm_runtime_idle(dev, RPM_GET_PUT); |
161 | } | 191 | } |
162 | 192 | ||
193 | static inline int pm_runtime_put_sync_autosuspend(struct device *dev) | ||
194 | { | ||
195 | return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO); | ||
196 | } | ||
197 | |||
163 | static inline int pm_runtime_set_active(struct device *dev) | 198 | static inline int pm_runtime_set_active(struct device *dev) |
164 | { | 199 | { |
165 | return __pm_runtime_set_status(dev, RPM_ACTIVE); | 200 | return __pm_runtime_set_status(dev, RPM_ACTIVE); |
@@ -175,4 +210,14 @@ static inline void pm_runtime_disable(struct device *dev) | |||
175 | __pm_runtime_disable(dev, true); | 210 | __pm_runtime_disable(dev, true); |
176 | } | 211 | } |
177 | 212 | ||
213 | static inline void pm_runtime_use_autosuspend(struct device *dev) | ||
214 | { | ||
215 | __pm_runtime_use_autosuspend(dev, true); | ||
216 | } | ||
217 | |||
218 | static inline void pm_runtime_dont_use_autosuspend(struct device *dev) | ||
219 | { | ||
220 | __pm_runtime_use_autosuspend(dev, false); | ||
221 | } | ||
222 | |||
178 | #endif | 223 | #endif |