power: pm8921-bms: increase soc slowly while charging

It could happen that the calculated soc was higher than the reported
soc even when a charger is not plugged in. This usually happens when
the battery temperature increases or the average current changes causing
unusable charge to go low. The current code never reports this high soc
unless a charger is plugged in.

However at the instant when charger is plugged in, the driver reports
that high calculated soc. This jump in soc in an instant is
unacceptable.

Slowly increase the reported soc so that it approaches the calculated
soc while charging. Basically we are playing catchup between reported
soc and calculated soc. The catch up time is based on how big the
difference between calculated soc and reported soc is - we allow
60 seconds per percent delta.

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