All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: core: resolve supply for boot-on/always-on regulators
@ 2021-05-19 22:12 Dmitry Baryshkov
  2021-05-19 22:12 ` [PATCH 2/2] regulator: core: always use enable_delay when enabling regulators Dmitry Baryshkov
  2021-05-20 21:08 ` (subset) [PATCH 1/2] regulator: core: resolve supply for boot-on/always-on regulators Mark Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2021-05-19 22:12 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Michał Mirosław, linux-kernel

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>
---
 drivers/regulator/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

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) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-03 10:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 22:12 [PATCH 1/2] regulator: core: resolve supply for boot-on/always-on regulators Dmitry Baryshkov
2021-05-19 22:12 ` [PATCH 2/2] regulator: core: always use enable_delay when enabling regulators Dmitry Baryshkov
2021-05-20 11:57   ` Mark Brown
2021-06-02 13:14     ` Dmitry Baryshkov
2021-06-03 10:27       ` Mark Brown
2021-05-20 21:08 ` (subset) [PATCH 1/2] regulator: core: resolve supply for boot-on/always-on regulators Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.