cw2217b: modify charging status

First unify the polarity of the current through the ibat_polority,
then judge the charging state according to the polarity of the current.

Change-Id: Ie2c155708e0c6808f56502325af0248e74e6c420
Reviewed-on: https://gerrit.mot.com/2620148
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
litong20 2023-05-25 14:40:50 +08:00 • committed by litong
commit a07f15833d

View file

@ -1071,7 +1071,7 @@ static void cw_get_batt_status(struct cw_battery *cw_bat)
cw_bat->batt_status = POWER_SUPPLY_STATUS_FULL;
} else if (abs(batt_curr) < CW_CUR_ACCURACY) {
cw_bat->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING;
} else if (batt_curr * cw_bat->ibat_polority < 0) {
} else if (batt_curr > 0) {
cw_bat->batt_status = POWER_SUPPLY_STATUS_CHARGING;
} else {
cw_bat->batt_status = POWER_SUPPLY_STATUS_DISCHARGING;