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

From: George Stark
Date: Mon Jun 10 2024 - 08:01:07 EST


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

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,
--
2.25.1