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 authored and litong committed 2023-05-30 21:52:31 -05:00
1 parent f86c48d11b
commit a07f15833d
1 file changed
+1 -1
@@ -1071,7 +1071,7 @@ static void cw_get_batt_status(struct cw_battery *cw_bat)
cw_bat->batt_status = POWER_SUPPLY_STATUS_FULL; cw_bat->batt_status = POWER_SUPPLY_STATUS_FULL;
} else if (abs(batt_curr) < CW_CUR_ACCURACY) { } else if (abs(batt_curr) < CW_CUR_ACCURACY) {
cw_bat->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; 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; cw_bat->batt_status = POWER_SUPPLY_STATUS_CHARGING;
} else { } else {
cw_bat->batt_status = POWER_SUPPLY_STATUS_DISCHARGING; cw_bat->batt_status = POWER_SUPPLY_STATUS_DISCHARGING;