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

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

Merge "usb: dwc3: dwc3-msm: Handle floating charger PMI notification properly"

parents a59b89b1 c5c2ca05
Loading
Loading
Loading
Loading
+8 −23
Original line number Diff line number Diff line
@@ -2634,8 +2634,6 @@ done:

static void check_for_sdp_connection(struct work_struct *w)
{
	int ret;
	union power_supply_propval pval = {0};
	struct dwc3_msm *mdwc =
		container_of(w, struct dwc3_msm, sdp_check.work);
	struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
@@ -2646,21 +2644,6 @@ static void check_for_sdp_connection(struct work_struct *w)
	/* floating D+/D- lines detected */
	if (dwc->gadget.state < USB_STATE_DEFAULT &&
		dwc3_gadget_get_link_state(dwc) != DWC3_LINK_STATE_CMPLY) {
		if (!mdwc->usb_psy) {
			mdwc->usb_psy = power_supply_get_by_name("usb");
			if (!mdwc->usb_psy) {
				dev_dbg(mdwc->dev,
					"Could not get usb power_supply\n");
				return;
			}
		}
		pval.intval = -ETIMEDOUT;
		ret = power_supply_set_property(mdwc->usb_psy,
					POWER_SUPPLY_PROP_CURRENT_MAX, &pval);
		if (ret)
			dev_dbg(mdwc->dev,
				"power supply error when setting property\n");

		mdwc->vbus_active = 0;
		dbg_event(0xFF, "Q RW SPD CHK", mdwc->vbus_active);
		queue_work(mdwc->dwc3_wq, &mdwc->resume_work);
@@ -3708,14 +3691,16 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned mA)
		return 0;

	psy_type = get_psy_type(mdwc);
	if (psy_type != POWER_SUPPLY_TYPE_USB &&
			psy_type != POWER_SUPPLY_TYPE_USB_FLOAT)
		return 0;

	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;
	}

	ret = power_supply_set_property(mdwc->usb_psy,
				POWER_SUPPLY_PROP_CURRENT_MAX, &pval);
	if (ret) {