power: qpnp-bms: clamp charging soc

During constant voltage charging, the BMS reports a SoC calculated
by linearly interpolating battery current. However, sometimes the
charger does not immediately stop at -100 mA, and sometimes dips a bit
lower. This causes the BMS to report > 100% SoC and may cause a bad
user experience.

Fix this by clamping the linearly interpolated SoC to [0, 100].

Change-Id: I22149c8b9bb7eaa4ecdd6420fbd051c92f05b03a
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
1 file changed