summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2021-05-20 01:12:23 +0300
committerMark Brown <broonie@kernel.org>2021-05-20 22:00:11 +0100
commit98e48cd9283dbac0e1445ee780889f10b3d1db6a (patch)
tree22e798561c4f6b618a6cb86db7f5c46d701b8827 /drivers/regulator/core.c
parent855bfff9d623e7aff6556bfb6831d324dec8d96a (diff)
downloadlinux-98e48cd9283dbac0e1445ee780889f10b3d1db6a.tar.gz
linux-98e48cd9283dbac0e1445ee780889f10b3d1db6a.tar.bz2
linux-98e48cd9283dbac0e1445ee780889f10b3d1db6a.zip
regulator: core: resolve supply for boot-on/always-on regulators
For the boot-on/always-on regulators the set_machine_constrainst() is called before resolving rdev->supply. Thus the code would try to enable rdev before enabling supplying regulator. Enforce resolving supply regulator before enabling rdev. Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator") Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20210519221224.2868496-1-dmitry.baryshkov@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f192bf19492e..e20e77e4c159 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1425,6 +1425,12 @@ static int set_machine_constraints(struct regulator_dev *rdev)
* and we have control then make sure it is enabled.
*/
if (rdev->constraints->always_on || rdev->constraints->boot_on) {
+ /* If we want to enable this regulator, make sure that we know
+ * the supplying regulator.
+ */
+ if (rdev->supply_name && !rdev->supply)
+ return -EPROBE_DEFER;
+
if (rdev->supply) {
ret = regulator_enable(rdev->supply);
if (ret < 0) {