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

Skip to content
Commit 1e0f4753 authored by Xiaozhe Shi's avatar Xiaozhe Shi Committed by Stephen Boyd
Browse files

power: qpnp-bms: Fix SoC being stuck upon resume



There is a problem with soc being stuck upon resuming from sleep.
If report soc is called before calculate soc finished, but after
the soc is unbound, the BMS will try to keep reporting the old soc.

Fix this issue by only setting the unbound soc flag after a new
calculated soc is added. When this flag is set, reported soc can
change by 1% per 20 seconds that it has been asleep. Also, switch
the scale_soc_while_charging function to make use of the RTC so that
the time spent during sleep is counted as catch up time.

Also, protect report soc with mutexes so a race condition does not
invalidate last_soc.

CRs-Fixed: 480859
Change-Id: I05584a30e680401357bd08ed8c3dc89f812520f3
Signed-off-by: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent ee70e06f
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