power: qpnp-bms: fix boot time iavg calculation algorithm
A bug was introduced in the unusable charge calculation algorithm
when the shutdown SoC and IAVG was refactored. Since the BMS driver
will try to do a SoC calculation before the shutdown data was loaded,
the shutdown IAVG never gets used to populate the IAVG sample array.
This causes the shutdown IAVG to never get used by the BMS driver,
creating a situation where the high boot time current fills the IAVG
samples array and skewing UUC to be much higher than it should be.
Fix this by moving the first time calculation flag for UUC to the end
of the SoC calculation function so that only the first real SoC
calculation after shutdown data is loaded clears the flag. Also,
add a delta time check in the UUC iavg sample array aggregation so
that recalculating SoC many times will not incorrectly skew the IAVG
and cause a incorrectly high UUC.
Change-Id: Ida355c64e60167e0a11dcbb587585273924c9da1
Signed-off-by:
Xiaozhe Shi <xiaozhes@codeaurora.org>
Loading
Please register or sign in to comment