smb138x: support usbin-usbin with external rsense

Currently smb138x only support usbin-usbin parallel architecture
where the battery current from the parallel charger flows through
the batfet of the main charger.

Support configurations where there is remote sensing or an external
rsense where the current from parallel charger directly goes to the
battery.

Change-Id: I5506190d83436bfaea3b6c98b1b311746cf85071
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar 2017-04-03 15:27:21 -07:00
parent f9aee28de6
commit cdd3e6733f

View file

@ -577,13 +577,15 @@ static int smb138x_parallel_get_prop(struct power_supply *psy,
rc = smblib_get_usb_suspend(chg, &val->intval);
break;
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED:
if (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
if ((chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
|| (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN_EXT))
rc = smblib_get_prop_input_current_limited(chg, val);
else
val->intval = 0;
break;
case POWER_SUPPLY_PROP_CURRENT_MAX:
if (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
if ((chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
|| (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN_EXT))
rc = smblib_get_charge_param(chg, &chg->param.usb_icl,
&val->intval);
else
@ -669,7 +671,8 @@ static int smb138x_parallel_set_prop(struct power_supply *psy,
rc = smb138x_set_parallel_suspend(chip, (bool)val->intval);
break;
case POWER_SUPPLY_PROP_CURRENT_MAX:
if (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
if ((chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
|| (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN_EXT))
rc = smblib_set_charge_param(chg, &chg->param.usb_icl,
val->intval);
break;
@ -1484,7 +1487,8 @@ static int smb138x_slave_probe(struct smb138x *chip)
goto cleanup;
}
if (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN) {
if ((chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
|| (chip->dt.pl_mode == POWER_SUPPLY_PL_USBIN_USBIN_EXT)) {
rc = smb138x_init_vbus_regulator(chip);
if (rc < 0) {
pr_err("Couldn't initialize vbus regulator rc=%d\n",