Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a2f72174 authored by Xiaozhe Shi's avatar Xiaozhe Shi
Browse files

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: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent 546d84cd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment