Add ibat polority invert from dt

Support configure the ibat polority invert from
device tree.

Change-Id: I6742831a97dcf57a334047e277dcdc3ce2778f44
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2210038
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
yanyh2 2022-03-08 16:30:49 +08:00 committed by chenyt17
parent 4f58101bd4
commit 7b88f791b3

View file

@ -323,6 +323,7 @@ struct bq_fg_chip {
const char *batt_profile_name;
const char *batt_name;
u32 temp_source;
int ibat_polority;
/* debug */
int skip_reads;
@ -1348,7 +1349,7 @@ static int fg_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_CURRENT_NOW:
mutex_lock(&bq->data_lock);
fg_read_current(bq, &bq->batt_curr);
val->intval = -bq->batt_curr * 1000;
val->intval = -bq->batt_curr * 1000 * bq->ibat_polority;
mutex_unlock(&bq->data_lock);
break;
@ -2372,6 +2373,11 @@ static int bq_parse_dt(struct bq_fg_chip *bq)
rc = 0;
}
if (of_property_read_bool(node, "mmi,ibat-invert-polority"))
bq->ibat_polority = -1;
else
bq->ibat_polority = 1;
return rc;
}