diff options
author | Marek Vasut <marex@denx.de> | 2022-04-13 00:42:52 +0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2022-04-21 12:44:23 +0200 |
commit | 63c390a1eac72bcf46d0b61d69c570fe5e48177d (patch) | |
tree | f7f8c89368abe6f93e4df69f822dfd1573b057ac /drivers/power | |
parent | 4eb82c2e56a7cd68b74c3a21de5c79ea80c5dcd6 (diff) | |
download | u-boot-63c390a1eac72bcf46d0b61d69c570fe5e48177d.tar.gz |
power_domain: Add power_domain_get_by_name()
Implement power_domain_get_by_name() convenience function which parses
DT property 'power-domain-names' and looks up power domain by matching
name.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/domain/power-domain-uclass.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c index 0c5823cedd..74c33d4e2e 100644 --- a/drivers/power/domain/power-domain-uclass.c +++ b/drivers/power/domain/power-domain-uclass.c @@ -80,6 +80,20 @@ int power_domain_get_by_index(struct udevice *dev, return 0; } +int power_domain_get_by_name(struct udevice *dev, + struct power_domain *power_domain, const char *name) +{ + int index; + + index = dev_read_stringlist_search(dev, "power-domain-names", name); + if (index < 0) { + debug("fdt_stringlist_search() failed: %d\n", index); + return index; + } + + return power_domain_get_by_index(dev, power_domain, index); +} + int power_domain_get(struct udevice *dev, struct power_domain *power_domain) { return power_domain_get_by_index(dev, power_domain, 0); |