Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22e6fbc7 authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

smb1351: Fix parallel ICL configuration



In slave configuration "POWER_SUPPLY_PROP_CURRENT_MAX" fails to
suspend USB input path for 0/2mA current request. Fix this by
separately handling 0/2mA request to suspend input.

CRs-Fixed: 2148379
Change-Id: Id9b7887c4f2f924d9e4c8484947d74baa96eb8a3
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 1ecbc6d7
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -1597,7 +1597,7 @@ static int smb1351_parallel_set_property(struct power_supply *psy,
				       enum power_supply_property prop,
				       enum power_supply_property prop,
				       const union power_supply_propval *val)
				       const union power_supply_propval *val)
{
{
	int rc = 0, index;
	int rc = 0, index, current_ma;
	struct smb1351_charger *chip = power_supply_get_drvdata(psy);
	struct smb1351_charger *chip = power_supply_get_drvdata(psy);


	switch (prop) {
	switch (prop) {
@@ -1620,8 +1620,13 @@ static int smb1351_parallel_set_property(struct power_supply *psy,
					chip->target_fastchg_current_max_ma);
					chip->target_fastchg_current_max_ma);
		break;
		break;
	case POWER_SUPPLY_PROP_CURRENT_MAX:
	case POWER_SUPPLY_PROP_CURRENT_MAX:
		index = smb1351_get_closest_usb_setpoint(val->intval / 1000);
		current_ma = val->intval / 1000;
		if (current_ma > SUSPEND_CURRENT_MA) {
			index = smb1351_get_closest_usb_setpoint(current_ma);
			chip->usb_psy_ma = usb_chg_current[index];
			chip->usb_psy_ma = usb_chg_current[index];
		} else {
			chip->usb_psy_ma = current_ma;
		}
		if (!chip->parallel_charger_suspended)
		if (!chip->parallel_charger_suspended)
			rc = smb1351_set_usb_chg_current(chip,
			rc = smb1351_set_usb_chg_current(chip,
						chip->usb_psy_ma);
						chip->usb_psy_ma);