power: qpnp-bms: do not rely on the charger to provide battery presence

Currently the BMS driver relies on the charger to register the battery
power supply before it gets access to the battery presence information.
However, this can cause issues where SoC is reported as 100% before the
power supply is registered and it can cause shutdown SoC loading to
fail.

Since the BMS driver already has read access to the charger bat_if's
battery presence register for detecting battery removal in offmode, fix
the issue with battery presence as well by directly reading from the
register instead of waiting for charger to register. If the register is
not given to the BMS in the device tree, then default back to reading
from the battery power supply.

Change-Id: Ie1faf47a09fc838e856fa7391918611f1139a1af
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
1 file changed