power: pm8921-charger: smbc uvlo lockup workaround

During UVLO events the charger hardware may lock up
and hence the charger poweron trigger will not work.

Add a workaround which ensures that
low power mode (LPM) is always enabled while the device
is running off the battery. This forces the
charger to run off the 32kHz clock which prevents
a lockup during a UVLO event.

However as a caveat charger register writes do not
work during LPM and hence during every write that happens
the software makes sure that LPM bit is disabled.
Note that this has no effect while a charger is connected
because the hardware automatically switches over to the
19.2 MHz clock which is needed for the registers writes.

While in LPM mode the bat_gone debouncer is bypassed while
a charger is not connected and re-enabled when a charger
is connected to avoid a debounce delay due to the clock
switching.

Note that all previous clock switching logic
including the battery alarm that was used to force on
the 19.2Mhz clock has been removed as part of this change.

Change-Id: I39b908451f4b678ed63b872ffc46590e2c728b2c
CRs-Fixed: 390327
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
3 files changed