power: qpnp-bms: Improve SoC response time while charging

Currently, there are a number of issues that can cause SoC reported
while charging to lag behind the true calculated SoC.

First, if the charger driver probes before the BMS and starts
charging before the BMS driver probes, the BMS will not know that
the battery is charging. Fix this by checking the charging status at
BMS driver probe time.

Second, In a previous patch, the check for SoC changes was moved in
the calculate_state_of_charge function. This can cause SoC to not be
updated and propagated into userspace at times. Fix this by checking
for SoC changes to an earlier spot in the function.

Third, while charging, the SoC can change faster than once per 20
seconds. Change this limit to 1 SoC per 5 seconds.

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