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

Commit 6ed51a55 authored by Xiaozhe Shi's avatar Xiaozhe Shi Committed by Nicholas Troast
Browse files

power: qpnp-fg: fix peripheral restart code



Currently the do_restart code does not give the same guarantee as profile
initialization. During a manual fuel gauge peripheral restart, the
driver could display the incorrect battery type, and cause SRAM
read/writes to fail silently.

Specifically, there's a period of time between putting in the battery
and the battery being loaded where the battery is considered missing,
even when it's not. The missing battery type will not change until the
battery profile is loaded. In the worst case, if the new battery is
unrecognized, it will just stay missing all the time. During this time,
SRAM writes and reads will also fail to read the correct values, which
can cause the driver to report incorrect values.

Fix this by changing the driver so that once the battery is removed,
the battery type is set to the default battery type. If the battery
is missing, report the type as missing through the power supply
framework. Also, disallow SRAM updates during this time. Finally, use
a completion instead of polling in order to make the restart routine
finish faster and avoid the period of time where delayed or incorrect
SRAM reads and writes can happen.

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