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

Commit 479d36e0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dwc3: msm: Notify -ETIMEDOUT always in case of floating charger"

parents df42ac7d 83cf33d6
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -3714,20 +3714,20 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned mA)
	union power_supply_propval pval = {0};
	int ret, psy_type;

	if (mdwc->max_power == mA)
	psy_type = get_psy_type(mdwc);
	if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT) {
		pval.intval = -ETIMEDOUT;
		goto set_prop;
	}

	if (mdwc->max_power == mA || psy_type != POWER_SUPPLY_TYPE_USB)
		return 0;

	psy_type = get_psy_type(mdwc);
	if (psy_type == POWER_SUPPLY_TYPE_USB) {
	dev_info(mdwc->dev, "Avail curr from USB = %u\n", mA);
	/* Set max current limit in uA */
	pval.intval = 1000 * mA;
	} else if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT) {
		pval.intval = -ETIMEDOUT;
	} else {
		return 0;
	}

set_prop:
	ret = power_supply_set_property(mdwc->usb_psy,
				POWER_SUPPLY_PROP_SDP_CURRENT_MAX, &pval);
	if (ret) {