power: qpnp-charger: save open circuit voltage upon battery insertion
The BMS driver relies on having accurate open circuit voltage (OCV)
readings to estimate the state of charge of a battery. Usually the
BMS hardware takes an OCV reading of the battery upon power-on
because the load on the battery is small so there is very little
voltage drop across the battery.
However when a battery is hotswapped, it is difficult to obtain an
accurate OCV reading. This is because the hardware does not take a
OCV when the battery is inserted in a hotswap.
Work around this issue by forcing the BATFET open when a battery is
removed, and only let it close once a new battery is inserted and
the driver has taken a voltage reading when the BATFET is open.
Report this value through the power supply framework.
Change-Id: I5ee87c795be7ff32e21598f1103a4237283c9dc8
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
1 file changed