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

Commit b595281e authored by Ajay Agarwal's avatar Ajay Agarwal Committed by Gerrit - the friendly Code Review server
Browse files

usb: dwc3-msm: Add support for snps SSPHY suspend in system suspend



Currently the platforms using SNPS SSPHY do not suspend it so as
to receive SS wakeup events via pwr_event_irq. But certain
telematics platforms do not need SS wakeup in system suspend
scenario.
USB wakeup from PM suspend/hibernation is not a requirement for
automotive/telematics platforms. Use enable_wakeup parameter in
dwc3_msm_suspend call to allow SSPHY suspend to happen and also
to keep the IRQs enabled/disabled.

Change-Id: I691585e15539490e63a345fe2b3aacf182352399
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
Signed-off-by: default avatarHarsh Agarwal <harshq@codeaurora.org>
parent 74b8a97e
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -2851,7 +2851,8 @@ static int dwc3_msm_update_bus_bw(struct dwc3_msm *mdwc, enum bus_vote bv)
	return ret;
}

static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse)
static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse,
					bool enable_wakeup)
{
	int ret;
	struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
@@ -2944,7 +2945,8 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse)
		((mdwc->hs_phy->flags & (PHY_HSFS_MODE | PHY_LS_MODE)) &&
			!dwc3_msm_is_superspeed(mdwc)));
	can_suspend_ssphy = dwc->maximum_speed >= USB_SPEED_SUPER &&
			(!mdwc->use_pwr_event_for_wakeup || no_active_ss);
			(!mdwc->use_pwr_event_for_wakeup || no_active_ss ||
			 !enable_wakeup);
	/* Suspend SS PHY */
	if (can_suspend_ssphy) {
		if (mdwc->in_host_mode) {
@@ -3015,7 +3017,7 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse)
	 * using HS_PHY_IRQ or SS_PHY_IRQ. Hence enable wakeup only in
	 * case of host bus suspend and device bus suspend.
	 */
	if (!(mdwc->lpm_flags & MDWC3_POWER_COLLAPSE)) {
	if (!(mdwc->lpm_flags & MDWC3_POWER_COLLAPSE) && enable_wakeup) {
		if (mdwc->use_pdc_interrupts) {
			enable_usb_pdc_interrupt(mdwc, true);
		} else {
@@ -5313,7 +5315,8 @@ static int dwc3_msm_pm_suspend(struct device *dev)
		return 0;
	}

	ret = dwc3_msm_suspend(mdwc, false);
	/* Wakeup not required for automotive/telematics platform host mode */
	ret = dwc3_msm_suspend(mdwc, false, false);
	if (!ret)
		atomic_set(&mdwc->pm_suspended, 1);

@@ -5385,8 +5388,9 @@ static int dwc3_msm_pm_freeze(struct device *dev)
	/*
	 * Power collapse the core. Hence call dwc3_msm_suspend with
	 * 'force_power_collapse' set to 'true'.
	 * Wakeup not required for automotive/telematics platform host mode.
	 */
	ret = dwc3_msm_suspend(mdwc, true);
	ret = dwc3_msm_suspend(mdwc, true, false);
	if (!ret)
		atomic_set(&mdwc->pm_suspended, 1);

@@ -5449,7 +5453,7 @@ static int dwc3_msm_runtime_suspend(struct device *dev)
	dev_dbg(dev, "DWC3-msm runtime suspend\n");
	dbg_event(0xFF, "RT Sus", 0);

	return dwc3_msm_suspend(mdwc, false);
	return dwc3_msm_suspend(mdwc, false, true);
}

static int dwc3_msm_runtime_resume(struct device *dev)