]> git.baikalelectronics.ru Git - kernel.git/commit
regulator: da9063: fix suspend
authorMartin Fuzzey <martin.fuzzey@flowbird.group>
Tue, 17 Mar 2020 16:14:26 +0000 (17:14 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 18 Mar 2020 19:07:47 +0000 (19:07 +0000)
commit52b5dae16942938a240def6f47ff461cd3565260
tree5fe59c164dd12c12db1860c96a289faef2841bc7
parent0dfb6f36b8e8b2fea60385ad977415921f2aed92
regulator: da9063: fix suspend

The .set_suspend_enable() and .set_suspend_disable() methods are not
supposed to immediately change the regulator state but just indicated
if the regulator should be enabled or disabled when standby mode is
entered (by a hardware signal).

However currently they set control the SEL bits in the DVC registers,
which causes the voltage to change to immediately between the "A"
(normal) and "B" (standby) values as programmed and does nothing for
the enable state...

This means that "regulator-on-in-suspend" does not work (the regulator
is switched off when the PMIC enters standby mode on the hardware
signal) and, potentially, depending on the A and B voltage
configurations the voltage could be incorrectly changed *before*
actually entering suspend.

The right bit to use for the functionality is the "CONF" bit in the
"CONT" register.
The detailed register description says "Sequencer target state"
for this bit which is not very clear but the functional description
is clearer.

>From 5.1.5 System Enable:

De-asserting SYS_EN (changing from active to passive state)
clears control SYSTEM_EN  which triggers a power down sequence
into hibernate/standby mode
...
With the exception of supplies that have the xxxx_CONF control
bit asserted, all regulators in power domains POWER1, POWER, and
SYSTEM are sequentially disabled in reverse order.
Regulators with the <x>_CONF bit set remain on but change the
active voltage controlregisters from V<x>_A to V<x>_B
(if V<x>_B is notalready selected).

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
Link: https://lore.kernel.org/r/1584461691-14344-1-git-send-email-martin.fuzzey@flowbird.group
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/da9063-regulator.c