FG: RT9426a add safeguard for SOH

In some abnormal cases the soh=0 from the chip, that make the
bms_charge_counter&&bms_charge_full abnormal,then calculate the wrong
UI_SOC for battery.
if get soh=0; use old soh to aviod getting the wrong soc.

Change-Id: Ic7433d23c3162a96a40f9bc5e7043dcdfb42fb14
Signed-off-by: liuyc20 <liuyc20@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2151691
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
liuyc20 2021-12-22 14:34:11 +08:00 • committed by Yuecai Liu
commit cc3c111f0f

View file

@ -413,7 +413,7 @@ static int rt9426a_get_soh(struct rt9426a_chip *chip)
int ret;
ret = rt9426a_reg_read_word(chip->i2c, RT9426A_REG_SOH);
if (ret < 0)
if (ret <= 0)
dev_notice(chip->dev, "%s: read soh fail\n", __func__);
else
chip->soh = ret;