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

Commit dd4b9c3d 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-msm: Fix check for device suspend"

parents 5821f5ce eda06a9d
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -1579,7 +1579,7 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc)
	bool host_bus_suspend;
	bool host_ss_active;
	bool can_suspend_ssphy;
	bool device_bus_suspend;
	bool device_bus_suspend = false;
	struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);

	dev_dbg(mdwc->dev, "%s: entering lpm. usb_lpm_override:%d\n",
@@ -1596,9 +1596,11 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc)
		return 0;
	}

	/* pending device events need to be handled by dwc3_thread_interrupt */
	if (mdwc->dwc3) {
		struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
	if (mdwc->otg_xceiv && mdwc->otg_xceiv->state == OTG_STATE_B_PERIPHERAL)
		device_bus_suspend = true;

	if (device_bus_suspend) {
		/* pending device events unprocessed */
		for (i = 0; i < dwc->num_event_buffers; i++) {
			struct dwc3_event_buffer *evt = dwc->ev_buffs[i];
			if ((evt->flags & DWC3_EVENT_PENDING)) {
@@ -1609,14 +1611,13 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc)
				return -EBUSY;
			}
		}
	}

		if (!msm_bam_usb_lpm_ok(DWC3_CTRL)) {
		dev_dbg(mdwc->dev,
			"%s: IPA handshake not finished, will suspend when done\n",
			dev_dbg(mdwc->dev, "%s: IPA handshake not finished, will suspend when done\n",
					__func__);
			return -EBUSY;
		}
	}

	if (!mdwc->vbus_active && mdwc->otg_xceiv &&
		mdwc->otg_xceiv->state == OTG_STATE_B_PERIPHERAL) {
@@ -1660,8 +1661,6 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc)

	host_bus_suspend = (mdwc->scope == POWER_SUPPLY_SCOPE_SYSTEM);
	can_suspend_ssphy = !(host_bus_suspend && host_ss_active);
	device_bus_suspend = ((mdwc->charger.chg_type == DWC3_SDP_CHARGER) ||
				 (mdwc->charger.chg_type == DWC3_CDP_CHARGER));

	if (host_bus_suspend || device_bus_suspend) {