regulator: da9062: fix suspend_enable/disable preparation
authorMarco Felsch <m.felsch@pengutronix.de>
Tue, 17 Sep 2019 12:42:42 +0000 (14:42 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 23 Sep 2019 21:21:05 +0000 (14:21 -0700)
commita72865f057820ea9f57597915da4b651d65eb92f
treeff7fc2056de830fe13b20ab4dcc059f3ae825d7b
parent58283636a5a03e64ad5d03bd282e3b66dcfa2c49
regulator: da9062: fix suspend_enable/disable preparation

Currently the suspend reg_field maps to the pmic voltage selection bits
and is used during suspend_enabe/disable() and during get_mode(). This
seems to be wrong for both use cases.

Use case one (suspend_enabe/disable):
Those callbacks are used to mark a regulator device as enabled/disabled
during suspend. Marking the regulator enabled during suspend is done by
the LDOx_CONF/BUCKx_CONF bit within the LDOx_CONT/BUCKx_CONT registers.
Setting this bit tells the DA9062 PMIC state machine to keep the
regulator on in POWERDOWN mode and switch to suspend voltage.

Use case two (get_mode):
The get_mode callback is used to retrieve the active mode state. Since
the regulator-setting-A is used for the active state and
regulator-setting-B for the suspend state there is no need to check
which regulator setting is active.

Fixes: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20190917124246.11732-2-m.felsch@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/da9062-regulator.c