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

Commit de5677c7 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5-lib: use USB options in low ICL range"

parents 72f4105b f2454873
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -1078,7 +1078,6 @@ static int set_sdp_current(struct smb_charger *chg, int icl_ua)
		icl_options = CFG_USB3P0_SEL_BIT | USB51_MODE_BIT;
		break;
	default:
		smblib_err(chg, "ICL %duA isn't supported for SDP\n", icl_ua);
		return -EINVAL;
	}

@@ -1164,7 +1163,17 @@ int smblib_set_icl_current(struct smb_charger *chg, int icl_ua)
			goto out;
		}
	} else {
		set_sdp_current(chg, 100000);
		/*
		 * Try USB 2.0/3,0 option first on USB path when maximum input
		 * current limit is 500mA or below for better accuracy; in case
		 * of error, proceed to use USB high-current mode.
		 */
		if (icl_ua <= USBIN_500MA) {
			rc = set_sdp_current(chg, icl_ua);
			if (rc >= 0)
				goto out;
		}

		rc = smblib_set_charge_param(chg, &chg->param.usb_icl, icl_ua);
		if (rc < 0) {
			smblib_err(chg, "Couldn't set HC ICL rc=%d\n", rc);