power: qpnp-bms: fix batterydata reverse interpolation
power: qpnp-bms: fix batterydata reverse interpolation

The BMS driver needs to look up open circuit voltages for a given
SoC. However, the current algorithm is a bit flawed. If the battery
profile is not monotonic, there is a risk of going to an infinite
loop.

Fix this by modifying the reverse lookup loop to be bounded, and to
modify the step size so that the OCV will converge instead of
oscillating.

Change-Id: I25ba92de9796c4b89b476a0eff39a542407205f0
Signed-off-by: Xiaozhe Shi <4c58d9c21c42c2a4cf34b559441bd01b9c143cf4@codeaurora.org>

TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas