summaryrefslogtreecommitdiff
path: root/drivers/amba/bus.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-09-19 22:27:42 +0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-22 17:57:40 +0400
commit207f1a2d294e3781b56d1acecd48aaa3b4b7b2ad (patch)
treee056e2f1e8638fadd81c7b0cca87a7348a3026b3 /drivers/amba/bus.c
parent676e7c257a339b44b8a613be145b22b85cf2ffc4 (diff)
downloadlinux-207f1a2d294e3781b56d1acecd48aaa3b4b7b2ad.tar.xz
amba: Add support for attach/detach of PM domains
AMBA devices may on some SoCs resides in PM domains. To be able to manage these devices from there, let's try to attach devices to their corresponding PM domain during the probe phase. To reverse these actions at the remove phase, we try to detach the device from its PM domain. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> 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 'drivers/amba/bus.c')
-rw-r--r--drivers/amba/bus.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 3cf61a127ee5..8f5239377f91 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -182,9 +182,15 @@ static int amba_probe(struct device *dev)
int ret;
do {
+ ret = dev_pm_domain_attach(dev, true);
+ if (ret == -EPROBE_DEFER)
+ break;
+
ret = amba_get_enable_pclk(pcdev);
- if (ret)
+ if (ret) {
+ dev_pm_domain_detach(dev, true);
break;
+ }
pm_runtime_get_noresume(dev);
pm_runtime_set_active(dev);
@@ -199,6 +205,7 @@ static int amba_probe(struct device *dev)
pm_runtime_put_noidle(dev);
amba_put_disable_pclk(pcdev);
+ dev_pm_domain_detach(dev, true);
} while (0);
return ret;
@@ -220,6 +227,7 @@ static int amba_remove(struct device *dev)
pm_runtime_put_noidle(dev);
amba_put_disable_pclk(pcdev);
+ dev_pm_domain_detach(dev, true);
return ret;
}