power: pm8921-bms: fix issues with reading 0 for OCV

There are cases when the OCV value in the register is 0. Most likely
the pmic did not go through a PON sequence or it was disabled while
PON happened.

There are couple of issues with reading 0 in the OCV register
- The driver jumps to end of charge condition when the register read is 0.
- The driver assumes that it never took an OCV and behaves as if it is
  reading the PON OCV on every calculation. Since it sees a value of 0,
  it estimates OCV on every calculation.

Fix this case by initializing ocv_reading_at_100 and
prev_last_good_ocv_raw to an impossibly high value to differentiate
it from the 0 OCV case.

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