diff mbox series

[1/1] regulator: core: add warning for not-recoverable state

Message ID 20240610120025.405062-2-gnstark@salutedevices.com (mailing list archive)
State New, archived
Headers show
Series pwm-regulator with voltage table problem | expand

Commit Message

George Stark June 10, 2024, noon UTC
If regulator is always-on or boot-on then it's expected to be on while
being probed so add warning if such a regulator is in not-recoverable
state during initialization.

Signed-off-by: George Stark <gnstark@salutedevices.com>
---
 drivers/regulator/core.c | 4 ++++
 1 file changed, 4 insertions(+)

--
2.25.1

Comments

Mark Brown June 10, 2024, 3:47 p.m. UTC | #1
On Mon, Jun 10, 2024 at 03:00:25PM +0300, George Stark wrote:
> If regulator is always-on or boot-on then it's expected to be on while
> being probed so add warning if such a regulator is in not-recoverable
> state during initialization.

I don't see that these regulators are especially magical, and IIRC we
have several cases where we simply lack the ability to read back the
configuration at any time so expect to write out what we need during
normal operation.
diff mbox series

Patch

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a968dabb48f5..133789eb3d71 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1251,6 +1251,10 @@  static int machine_constraints_voltage(struct regulator_dev *rdev,
 		int current_uV = regulator_get_voltage_rdev(rdev);

 		if (current_uV == -ENOTRECOVERABLE) {
+			if (rdev->constraints->always_on || rdev->constraints->boot_on)
+				rdev_warn(rdev,
+					  "boot-on / always-on regulator is in not-recoverable state\n");
+
 			/* This regulator can't be read and must be initialized */
 			rdev_info(rdev, "Setting %d-%duV\n",
 				  rdev->constraints->min_uV,