power: qpnp-bms: Fix overflow issues with battery current
Currently, the battery current is being supplied by the VSENSE_AVG
register of the BMS. This is provided as a 16 bit signed integer.
However, while converting the integer to microvolts, there could be
an overflow, causing the battery current's polarity to be wrong.
Fix this issue by converting the reading into a 64 bit signed integer
before doing the conversion.
CRs-Fixed: 479213
Change-Id: Ibebde59706c201f3c4d947817f2702a1f3c688d6
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
1 file changed