fg_cw2217b: Ensuring monotonic variation of soc

fg_cw2217b:
Ensuring monotonic variation of soc

Change-Id: If13fbfcbd32e8e8897388b236c5355838c7e114c
Reviewed-on: https://gerrit.mot.com/2586781
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
litong20 authored and litong committed 2023-04-24 03:57:16 -05:00
1 parent a8cb200aab
commit 1e1506a5e5
1 file changed
+11 -1
@@ -418,9 +418,19 @@ static int cw_get_capacity(struct cw_battery *cw_bat)
cw_printk("CW2015[%d]: UI_SOC = %d larger 100!!!!\n", __LINE__, ui_soc);
ui_soc = 100;
}
if ((cw_bat->ui_soc == 0) ||
(chr_st_now && ui_soc > cw_bat->ui_soc) ||
(!chr_st_now && ui_soc < cw_bat->ui_soc)) {
cw_bat->ui_soc = ui_soc;
}
if (cw_bat->ui_soc != ui_soc) {
cw_printk("CW2015[%d]: not update, cw_bat->ui_soc %d, ui_soc %d", __LINE__, cw_bat->ui_soc, ui_soc);
}
cw_bat->ic_soc_h = soc_h;
cw_bat->ic_soc_l = soc_l;
cw_bat->ui_soc = ui_soc;
return 0;
}