]> Pileus Git - ~andy/linux/commit
regulator: palmas: preserve modes of rails during enable/disable
authorLaxman Dewangan <ldewangan@nvidia.com>
Thu, 18 Apr 2013 13:02:48 +0000 (18:32 +0530)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 18 Apr 2013 17:23:53 +0000 (18:23 +0100)
commit51d3a0c999e18a802a654171b5e05952b4630148
tree4ddc1594d7f4d132d40b6e3adf62892ba01eb2cc
parent28d1e8cd671a53d6b4f967abbbc2a55f7bd333f6
regulator: palmas: preserve modes of rails during enable/disable

The Palma device like TPS65913 have the mode mask which is also
used for enable/disable the rails. The mode bits are defined as
00: OFF
01: AUTO
10: ECO
11: Forced PWM

and modes are set accordingly as
REGULATOR_MODE_NORMAL: AUTO
REGULATOR_MODE_IDLE: ECO
REGULATOR_MODE_FAST: PWM

Two issue observed:
1. If client calls following sequence:
regulator_enable(),
regulator_set_mode(FAST),
regulator_disable()

and again the regulator_enable() then the mode is reset
to NORMAL inplace of keeping the mode as FAST.

Fixing this by storing the current mode configured by client
and restoring modes when enable() is called after disable().

2. In following sequence, the regulator get enabled:
regulator_disable()
regulator_set_mode(FAST),

Fixing this by updating new mode in register only if it is
enabled.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/palmas-regulator.c
include/linux/mfd/palmas.h