aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm.h
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-09-19 20:27:37 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-22 15:57:40 +0200
commit46420dd73b800f87a19af13af5883855cf38cb08 (patch)
treebe10bd4b1d36b76fb776cc000a71c1f09ea96a42 /include/linux/pm.h
parentPM / Domains: Add generic OF-based PM domain look-up (diff)
downloadlinux-dev-46420dd73b800f87a19af13af5883855cf38cb08.tar.xz
linux-dev-46420dd73b800f87a19af13af5883855cf38cb08.zip
PM / Domains: Add APIs to attach/detach a PM domain for a device
To maintain scalability let's add common methods to attach and detach a PM domain for a device, dev_pm_domain_attach|detach(). Typically dev_pm_domain_attach() shall be invoked from subsystem level code at the probe phase to try to attach a device to its PM domain. The reversed actions may be done a the remove phase and then by invoking dev_pm_domain_detach(). When attachment succeeds, the attach function should assign its corresponding detach function to a new ->detach() callback added in the struct dev_pm_domain. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Kevin Hilman <khilman@linaro.org> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r--include/linux/pm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 1022ba1eb4de..c4cbf485a5d6 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -622,6 +622,17 @@ struct dev_pm_domain {
void (*detach)(struct device *dev, bool power_off);
};
+#ifdef CONFIG_PM
+extern int dev_pm_domain_attach(struct device *dev, bool power_on);
+extern void dev_pm_domain_detach(struct device *dev, bool power_off);
+#else
+static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
+{
+ return -ENODEV;
+}
+static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
+#endif
+
/*
* The PM_EVENT_ messages are also used by drivers implementing the legacy
* suspend framework, based on the ->suspend() and ->resume() callbacks common