aboutsummaryrefslogtreecommitdiff
path: root/include/power-domain.h
diff options
context:
space:
mode:
authorMarek Vasut2022-04-13 00:42:52 +0200
committerStefano Babic2022-04-21 12:44:23 +0200
commit63c390a1eac72bcf46d0b61d69c570fe5e48177d (patch)
treef7f8c89368abe6f93e4df69f822dfd1573b057ac /include/power-domain.h
parent4eb82c2e56a7cd68b74c3a21de5c79ea80c5dcd6 (diff)
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 'include/power-domain.h')
-rw-r--r--include/power-domain.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/power-domain.h b/include/power-domain.h
index 113276b5119..2ff6c77cd76 100644
--- a/include/power-domain.h
+++ b/include/power-domain.h
@@ -108,6 +108,27 @@ int power_domain_get_by_index(struct udevice *dev,
#endif
/**
+ * power_domain_get_by_name - Get the named power domain for a device.
+ *
+ * @dev: The client device.
+ * @power_domain: A pointer to a power domain struct to initialize.
+ * @name: Power domain name to be powered on.
+ *
+ * Return: 0 if OK, or a negative error code.
+ */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
+int power_domain_get_by_name(struct udevice *dev,
+ struct power_domain *power_domain, const char *name);
+#else
+static inline
+int power_domain_get_by_name(struct udevice *dev,
+ struct power_domain *power_domain, const char *name)
+{
+ return -ENOSYS;
+}
+#endif
+
+/**
* power_domain_free - Free a previously requested power domain.
*
* @power_domain: A power domain struct that was previously successfully