From: Federico Amedeo Izzo <[email protected]>

Fix issue where regulator mode could not be set to the
"regulator-initial-mode" value from dts.

priv->mode was initialized to "regulator-initial-mode", but this could
differ from the actual regulator mode.
In this case rpmh_regulator_vrm_set_mode() would return early, thinking
that the mode is already correct.

Setting an invalid mode on probe solves the issue.

Signed-off-by: Federico Amedeo Izzo <[email protected]>
---
 drivers/power/regulator/qcom-rpmh-regulator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/power/regulator/qcom-rpmh-regulator.c 
b/drivers/power/regulator/qcom-rpmh-regulator.c
index 4d65aae1690..06c3c14c46e 100644
--- a/drivers/power/regulator/qcom-rpmh-regulator.c
+++ b/drivers/power/regulator/qcom-rpmh-regulator.c
@@ -882,8 +882,7 @@ static int rpmh_regulator_probe(struct udevice *dev)
        priv->hw_data = init_data->hw_data;
        priv->enabled = -EINVAL;
        priv->uv = -ENOTRECOVERABLE;
-       if (ofnode_read_u32(dev_ofnode(dev), "regulator-initial-mode", 
&priv->mode))
-               priv->mode = -EINVAL;
+       priv->mode = -EINVAL;
 
        plat_data->mode = priv->hw_data->pmic_mode_map;
        plat_data->mode_count = priv->hw_data->n_modes;

-- 
2.54.0


Reply via email to