Skip to content

Commit aea8dfb

Browse files
Javier Martinez Canillasbroonie
authored andcommitted
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>
1 parent 29b9c31 commit aea8dfb

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎drivers/regulator/max77802.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,17 @@ static int max77802_pmic_probe(struct platform_device *pdev)
540540
config.of_node = pdata->regulators[i].of_node;
541541

542542
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;
544554

545555
rdev = devm_regulator_register(&pdev->dev,
546556
&regulators[i], &config);

0 commit comments

Comments
 (0)