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

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

power: qpnp-fg: fix errors with memif communication



There is a race condition currently when the driver tries to read or
write to the SRAM. When a transaction completes, the memory hold bit is
reset. However, the IRQ for memory access being revoked may not happen
immediately.

It is possible for another memory access to happen while the access is
still alive, but the memory hold bit is not set. Then the access can be
revoked mid-access, which can cause errors with SRAM communication.

Fix this by also checking if the memory hold bit is set before starting
communications.

Also, increase the timeout timer for SRAM access since it has been found
that SRAM access can be delayed for longer than a single 1.5 fuel gauge
cycle.

Finally, fix an issue with the mem_avail irq handler where it can return
0 instead of IRQ_HANDLED when fg_read fails. This can cause the IRQ to
fire incorrectly and cause timeouts with memory access.

CRs-Fixed: 738872
Change-Id: I288c8d5b38839f36bac2ef96a92081a3326e2fb4
Signed-off-by: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent 387bc198
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