• Martin Fuzzey's avatar
    regulator: da9063: fix suspend · 99f75ce6
    Martin Fuzzey authored
    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: default avatarMartin Fuzzey <martin.fuzzey@flowbird.group>
    Link: https://lore.kernel.org/r/1584461691-14344-1-git-send-email-martin.fuzzey@flowbird.groupSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    99f75ce6
da9063-regulator.c 23.8 KB