power: pm8921-bms: fix sleep discharge issue

There is an issue when the battery voltage drops very low causing
system to shutdown, while apps is suspended. There is no BMS running
to report 0% capacity and triggering the low battery shutdown process.

To avoid this situation prevent suspend when the battery voltage is
close to cutoff voltage + 20mV to allow for some buffer.

Note that the battery may temporarily dip in this range while the
load is high, release the wakelock later if the battery voltage
rises above this range.

Also, note that there exists a mechanism (battery alarm) in the
charger driver which wakes up the device if battery voltage falls.
Rely on the charger to wake up when the battery falls low.

CRs-Fixed: 400183
Change-Id: I1f4b65cba149480fb4a8f91667ce45a876dff2f0
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
1 file changed