aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max77802.c
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>2014-08-26 07:37:41 -0400
committerMark Brown <broonie@linaro.org>2014-08-27 13:50:56 -0400
commitaea8dfb9f32bf90dd6fd00758978b50efdc08df5 (patch)
tree2fe2e21cbd0c2ad5badd09b015c0ecffbf24cc6f /drivers/regulator/max77802.c
parent29b9c318025bece77d019eada2dee856e3ca50b2 (diff)
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: Yuvaraj Cd <yuvaraj.lkml@gmail.com> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Yuvaraj Kumar CD <yuvaraj.cd@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/max77802.c')
-rw-r--r--drivers/regulator/max77802.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index ad1caa902ef0..967e10934d3e 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -540,7 +540,17 @@ static int max77802_pmic_probe(struct platform_device *pdev)
540 config.of_node = pdata->regulators[i].of_node; 540 config.of_node = pdata->regulators[i].of_node;
541 541
542 ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val); 542 ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val);
543 max77802->opmode[id] = val >> shift & MAX77802_OPMODE_MASK; 543 val = val >> shift & MAX77802_OPMODE_MASK;
544
545 /*
546 * If the regulator is disabled and the system warm rebooted,
547 * the hardware reports OFF as the regulator operating mode.
548 * Default to operating mode NORMAL in that case.
549 */
550 if (val == MAX77802_OPMODE_OFF)
551 max77802->opmode[id] = MAX77802_OPMODE_NORMAL;
552 else
553 max77802->opmode[id] = val;
544 554
545 rdev = devm_regulator_register(&pdev->dev, 555 rdev = devm_regulator_register(&pdev->dev,
546 &regulators[i], &config); 556 &regulators[i], &config);