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:
parent
4f58101bd4
commit
7b88f791b3
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue