Skip to content

Commit

Permalink
regulator: max77802: set opmode to normal if off is read from hw
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Javier Martinez Canillas authored and Mark Brown committed Aug 27, 2014
1 parent 29b9c31 commit aea8dfb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/regulator/max77802.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,17 @@ static int max77802_pmic_probe(struct platform_device *pdev)
config.of_node = pdata->regulators[i].of_node;

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,
&regulators[i], &config);
Expand Down

0 comments on commit aea8dfb

Please sign in to comment.