Skip to content

Commit 207f1a2

Browse files
Ulf Hanssonrafaeljw
authored andcommitted
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>
1 parent 676e7c2 commit 207f1a2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎drivers/amba/bus.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,15 @@ static int amba_probe(struct device *dev)
182182
int ret;
183183

184184
do {
185+
ret = dev_pm_domain_attach(dev, true);
186+
if (ret == -EPROBE_DEFER)
187+
break;
188+
185189
ret = amba_get_enable_pclk(pcdev);
186-
if (ret)
190+
if (ret) {
191+
dev_pm_domain_detach(dev, true);
187192
break;
193+
}
188194

189195
pm_runtime_get_noresume(dev);
190196
pm_runtime_set_active(dev);
@@ -199,6 +205,7 @@ static int amba_probe(struct device *dev)
199205
pm_runtime_put_noidle(dev);
200206

201207
amba_put_disable_pclk(pcdev);
208+
dev_pm_domain_detach(dev, true);
202209
} while (0);
203210

204211
return ret;
@@ -220,6 +227,7 @@ static int amba_remove(struct device *dev)
220227
pm_runtime_put_noidle(dev);
221228

222229
amba_put_disable_pclk(pcdev);
230+
dev_pm_domain_detach(dev, true);
223231

224232
return ret;
225233
}

0 commit comments

Comments
 (0)