summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2018-08-27 15:57:44 +0530
committerTom Rini <trini@konsulko.com>2018-09-11 08:32:55 -0400
commit2618cf365770fbccd6e6281d10005ddc7e392087 (patch)
tree2c7967f6be1f488f9c2b8a5c9867cc4b32c67a66 /drivers/power
parente585bef17f9cc22ff82398654e8dfed8e5f39100 (diff)
power domain: Add support for multiple powerdomains per device
There are cases where there are more than one power domain attached to the device inorder to get the device functional. So add support for enabling power domain based on the index. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/domain/power-domain-uclass.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c
index 9e9ec4f419..2ea0ff24c7 100644
--- a/drivers/power/domain/power-domain-uclass.c
+++ b/drivers/power/domain/power-domain-uclass.c
@@ -28,7 +28,8 @@ static int power_domain_of_xlate_default(struct power_domain *power_domain,
return 0;
}
-int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
+int power_domain_get_by_index(struct udevice *dev,
+ struct power_domain *power_domain, int index)
{
struct ofnode_phandle_args args;
int ret;
@@ -38,7 +39,8 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
debug("%s(dev=%p, power_domain=%p)\n", __func__, dev, power_domain);
ret = dev_read_phandle_with_args(dev, "power-domains",
- "#power-domain-cells", 0, 0, &args);
+ "#power-domain-cells", 0, index,
+ &args);
if (ret) {
debug("%s: dev_read_phandle_with_args failed: %d\n",
__func__, ret);
@@ -73,6 +75,11 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
return 0;
}
+int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
+{
+ return power_domain_get_by_index(dev, power_domain, 0);
+}
+
int power_domain_free(struct power_domain *power_domain)
{
struct power_domain_ops *ops = power_domain_dev_ops(power_domain->dev);