summaryrefslogtreecommitdiff
path: root/drivers/power/domain/imx8-power-domain-legacy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power/domain/imx8-power-domain-legacy.c')
-rw-r--r--drivers/power/domain/imx8-power-domain-legacy.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/power/domain/imx8-power-domain-legacy.c b/drivers/power/domain/imx8-power-domain-legacy.c
index 6f01a60b34..2c479744d3 100644
--- a/drivers/power/domain/imx8-power-domain-legacy.c
+++ b/drivers/power/domain/imx8-power-domain-legacy.c
@@ -19,6 +19,34 @@ struct imx8_power_domain_priv {
bool state_on;
};
+int imx8_power_domain_lookup_name(const char *name,
+ struct power_domain *power_domain)
+{
+ struct udevice *dev;
+ struct power_domain_ops *ops;
+ int ret;
+
+ debug("%s(power_domain=%p name=%s)\n", __func__, power_domain, name);
+
+ ret = uclass_get_device_by_name(UCLASS_POWER_DOMAIN, name, &dev);
+ if (ret) {
+ printf("%s fail: %s, ret = %d\n", __func__, name, ret);
+ return ret;
+ }
+
+ ops = (struct power_domain_ops *)dev->driver->ops;
+ power_domain->dev = dev;
+ ret = ops->request(power_domain);
+ if (ret) {
+ debug("ops->request() failed: %d\n", ret);
+ return ret;
+ }
+
+ debug("%s ok: %s\n", __func__, dev->name);
+
+ return 0;
+}
+
static int imx8_power_domain_request(struct power_domain *power_domain)
{
debug("%s(power_domain=%p)\n", __func__, power_domain);