power: pm8921-bms: calibrate ocv only when it changes

The current driver adjusts the ocv (open circuit voltage) every time
it is asked to do a state of charge calculation. This results in small
errors in state of charge as the calibration values changes.

Update the driver such that it converts a raw ocv value to voltage only
when it changes. For other times it uses the previously calculated ocv
voltage (stored in last_ocv_uv). This implies that calibration data used
for raw to voltage conversion is right around when ocv was taken.

Change-Id: I27832682f77391c4fce65127e25ec456ee1a0fd1
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
1 file changed