Commit aea8dfb9 authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Mark Brown

regulator: max77802: set opmode to normal if off is read from hw

The max77802 driver reads the default operating mode (opmode)
set for regulators when enabled from the hardware registers.

But if a regulator is disabled and the system warm restarted,
the hardware reports OFF as the opmode so the regulator is
not enabled. Default to operating mode NORMAL if OFF is read
from the hardware register.
Reported-by: default avatarYuvaraj Cd <yuvaraj.lkml@gmail.com>
Signed-off-by: default avatarJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: default avatarDoug Anderson <dianders@chromium.org>
Tested-by: default avatarYuvaraj Kumar CD <yuvaraj.cd@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 29b9c318
...@@ -540,7 +540,17 @@ static int max77802_pmic_probe(struct platform_device *pdev) ...@@ -540,7 +540,17 @@ static int max77802_pmic_probe(struct platform_device *pdev)
config.of_node = pdata->regulators[i].of_node; config.of_node = pdata->regulators[i].of_node;
ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val); ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val);
max77802->opmode[id] = val >> shift & MAX77802_OPMODE_MASK; val = val >> shift & MAX77802_OPMODE_MASK;
/*
* If the regulator is disabled and the system warm rebooted,
* the hardware reports OFF as the regulator operating mode.
* Default to operating mode NORMAL in that case.
*/
if (val == MAX77802_OPMODE_OFF)
max77802->opmode[id] = MAX77802_OPMODE_NORMAL;
else
max77802->opmode[id] = val;
rdev = devm_regulator_register(&pdev->dev, rdev = devm_regulator_register(&pdev->dev,
&regulators[i], &config); &regulators[i], &config);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment