summaryrefslogtreecommitdiff
path: root/include/linux/pm_runtime.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-05-10 23:09:30 +0200
committerRafael J. Wysocki <rjw@sisk.pl>2010-05-10 23:09:30 +0200
commit2f60ba706bd9af84c4eab704243b262e69556f2e (patch)
tree9e8b18893983e0dac392efa3642660c1c16ea17f /include/linux/pm_runtime.h
parented77134bfccf5e75b6cbadab268e559dbe6a4ebb (diff)
i2c: Fix bus-level power management callbacks
There are three issues with the i2c bus type's power management callbacks at the moment. First, they don't include any hibernate callbacks, although they should at least include the .restore() callback (there's no guarantee that the driver will be present in memory before loading the image kernel and we must restore the pre-hibernation state of the device). Second, the "legacy" callbacks are not going to be invoked by the PM core since the bus type's pm object is not NULL. Finally, the system sleep PM (ie. suspend/resume) callbacks don't check if the device has been already suspended at run time, in which case they should skip suspending it. Also, it looks like the i2c bus type can use the generic subsystem-level runtime PM callbacks. For these reasons, rework the system sleep PM callbacks provided by the i2c bus type to handle hibernation correctly and to invoke the "legacy" callbacks for drivers that provide them. In addition to that make the i2c bus type use the generic subsystem-level runtime PM callbacks. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include/linux/pm_runtime.h')
-rw-r--r--include/linux/pm_runtime.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index b776db737244..6e81888c6222 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -30,6 +30,9 @@ extern void pm_runtime_enable(struct device *dev);
extern void __pm_runtime_disable(struct device *dev, bool check_resume);
extern void pm_runtime_allow(struct device *dev);
extern void pm_runtime_forbid(struct device *dev);
+extern int pm_generic_runtime_idle(struct device *dev);
+extern int pm_generic_runtime_suspend(struct device *dev);
+extern int pm_generic_runtime_resume(struct device *dev);
static inline bool pm_children_suspended(struct device *dev)
{
@@ -96,6 +99,10 @@ static inline bool device_run_wake(struct device *dev) { return false; }
static inline void device_set_run_wake(struct device *dev, bool enable) {}
static inline bool pm_runtime_suspended(struct device *dev) { return false; }
+static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
+static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
+static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
+
#endif /* !CONFIG_PM_RUNTIME */
static inline int pm_runtime_get(struct device *dev)