power: qpnp-charger: implement software end of charge

With accuracy issues introduced by both the analog
and digital end of charge hardware interrupts,
introduce a software assisted end of charge algorithm.

The vbat-det-lo interrupt will be leveraged to wake
up the device once the configured resume voltage delta
has been approached. By default this is 4.1 V.

The charger driver then proceeds to hold a wakelock for
until three samples of ibat_ua, VDD_LOOP and BATFET_ON
are taken. Only then will end of charge be declared.

Once end of charge is declared charging will be disabled
and only re-enabled once the vbat-det-lo interrupt is
triggered.

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