瀏覽代碼

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>
Ulf Hansson 11 年之前
父節點
當前提交
207f1a2d29
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      drivers/amba/bus.c

+ 9 - 1
drivers/amba/bus.c

@@ -182,9 +182,15 @@ static int amba_probe(struct device *dev)
 	int ret;
 	int ret;
 
 
 	do {
 	do {
+		ret = dev_pm_domain_attach(dev, true);
+		if (ret == -EPROBE_DEFER)
+			break;
+
 		ret = amba_get_enable_pclk(pcdev);
 		ret = amba_get_enable_pclk(pcdev);
-		if (ret)
+		if (ret) {
+			dev_pm_domain_detach(dev, true);
 			break;
 			break;
+		}
 
 
 		pm_runtime_get_noresume(dev);
 		pm_runtime_get_noresume(dev);
 		pm_runtime_set_active(dev);
 		pm_runtime_set_active(dev);
@@ -199,6 +205,7 @@ static int amba_probe(struct device *dev)
 		pm_runtime_put_noidle(dev);
 		pm_runtime_put_noidle(dev);
 
 
 		amba_put_disable_pclk(pcdev);
 		amba_put_disable_pclk(pcdev);
+		dev_pm_domain_detach(dev, true);
 	} while (0);
 	} while (0);
 
 
 	return ret;
 	return ret;
@@ -220,6 +227,7 @@ static int amba_remove(struct device *dev)
 	pm_runtime_put_noidle(dev);
 	pm_runtime_put_noidle(dev);
 
 
 	amba_put_disable_pclk(pcdev);
 	amba_put_disable_pclk(pcdev);
+	dev_pm_domain_detach(dev, true);
 
 
 	return ret;
 	return ret;
 }
 }