power: pm8921-bms: correct even after faking 100%
The current driver restores the OCV to the max voltage when the
BMS is in a mode where it fakes 100%.
This erases any corrections done to the OCV. Fix it by
forcing the OCV to max voltage just once right after charging
is done with a full battery.
Change-Id: Ibcbc20386e7932fe25d8152943be409397353988
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/drivers/power/pm8921-bms.c b/drivers/power/pm8921-bms.c
index 417e555..454727f 100644
--- a/drivers/power/pm8921-bms.c
+++ b/drivers/power/pm8921-bms.c
@@ -1037,18 +1037,10 @@
raw->last_good_ocv_uv = chip->last_ocv_uv;
}
- /* fake a high OCV if we are just done charging */
+ /* stop faking 100% after an OCV event */
if (chip->ocv_reading_at_100 != raw->last_good_ocv_raw) {
chip->ocv_reading_at_100 = OCV_RAW_UNINITIALIZED;
chip->cc_reading_at_100 = 0;
- } else {
- /*
- * force 100% ocv by selecting the highest voltage the
- * battery could ever reach
- */
- raw->last_good_ocv_uv = chip->max_voltage_uv;
- chip->last_ocv_uv = chip->max_voltage_uv;
- chip->last_ocv_temp_decidegc = batt_temp_decidegc;
}
pr_debug("0p625 = %duV\n", chip->xoadc_v0625);
pr_debug("1p25 = %duV\n", chip->xoadc_v125);
@@ -2616,6 +2608,7 @@
the_chip->last_ocv_uv = the_chip->max_voltage_uv;
raw.last_good_ocv_uv = the_chip->max_voltage_uv;
+ the_chip->last_ocv_temp_decidegc = batt_temp;
/*
* since we are treating this as an ocv event
* forget the old cc value