sc760x: make battery current polority selectable from dt.

sc760x:
make battery current polority selectable from dt.

Change-Id: I99d242a26fe236c35b98cae2fbe11b579c139f63
Reviewed-on: https://gerrit.mot.com/2707676
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Reviewed-by: Alison Venancio <alisonv@motorola.com>
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-08-11 19:05:07 +08:00 • committed by litong
commit 253717c35b
2 changed files with 8 additions and 1 deletions

View file

@ -1475,7 +1475,7 @@ static int sc760x_charger_get_batt_info(void *data, struct mmi_battery_info *bat
chg->batt_info.batt_mv = val.intval / 1000;
rc = power_supply_get_property(chg->fg_psy, POWER_SUPPLY_PROP_CURRENT_NOW, &val);
if (!rc)
chg->batt_info.batt_ma = val.intval / 1000;
chg->batt_info.batt_ma = val.intval / 1000 * chg->ichg_polority;
rc = power_supply_get_property(chg->fg_psy, POWER_SUPPLY_PROP_CAPACITY, &val);
if (!rc)
chg->batt_info.batt_soc = val.intval;
@ -1882,6 +1882,12 @@ static int sc760x_mmi_charger_init(struct sc760x_mmi_charger *chg)
chg->chg_cfg.charging_disable = chg->sc->init_data.charger_disabled;
chg->chg_cfg.charger_suspend = chg->sc->init_data.charger_disabled;
if (of_property_read_bool(chg->sc->dev->of_node, "mmi,ichg-invert-polority"))
chg->ichg_polority = -1;
else
chg->ichg_polority = 1;
pr_info("ichg_polority %d\n", chg->ichg_polority);
driver = devm_kzalloc(chg->sc->dev,
sizeof(struct mmi_charger_driver),
GFP_KERNEL);

View file

@ -172,6 +172,7 @@ struct sc760x_mmi_charger {
u32 chrg_taper_cnt;
const char *fg_psy_name;
struct power_supply *fg_psy;
int ichg_polority;
struct mmi_battery_info paired_batt_info;
};