diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-15 08:23:15 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-15 08:23:15 +0100 |
commit | abad1451586d8e8b36f86ef2772cef81d4ce2651 (patch) | |
tree | adcda19040f7e6069dd710eb999d6d54354cf7c1 /drivers/regulator/core.c | |
parent | 57dbf9dea12d3810aa0d9db1680c09cbe9ecc588 (diff) | |
parent | 5777d0e351433da7deaa8b39ebc1671dfe8645f0 (diff) | |
download | barebox-abad1451586d8e8b36f86ef2772cef81d4ce2651.tar.gz barebox-abad1451586d8e8b36f86ef2772cef81d4ce2651.tar.xz |
Merge branch 'for-next/imx'
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 7eb849cd31..4cf6e34de8 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -188,7 +188,7 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c { char *propname; struct regulator_internal *ri; - struct device_node *node; + struct device_node *node, *node_parent; int ret; propname = basprintf("%s-supply", supply); @@ -222,8 +222,24 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c } ret = of_device_ensure_probed(node); - if (ret) + if (ret) { + /* + * If "barebox,allow-dummy-supply" property is set for regulator + * provider allow use of dummy regulator (NULL is returned). + * Check regulator node and its parent if this setting is set + * PMIC wide. + */ + node_parent = of_get_parent(node); + if (of_get_property(node, "barebox,allow-dummy-supply", NULL) || + of_get_property(node_parent, "barebox,allow-dummy-supply", NULL)) { + dev_dbg(dev, "Allow use of dummy regulator for " \ + "%s-supply\n", supply); + ri = NULL; + goto out; + } + return ERR_PTR(ret); + } list_for_each_entry(ri, ®ulator_list, list) { if (ri->node == node) { |