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

Commit aeefc39f authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3: gadget: Enable SUSPEND event after CONNECT DONE



Spurious suspend event may arrive before CONNECT DONE, which
may unnecessarily notify to the charger to reduce current
draw to 2mA, only to revert back to 100mA on the subsequent
reset & connection. Instead, only enable the SUSPEND event
interrupt after the initial CONNECT DONE event is handled.

Change-Id: I41e2ff5d9b693757e06059c98fbe8b3a3878abdd
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent ff50d719
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -2224,14 +2224,8 @@ static void dwc3_gadget_enable_irq(struct dwc3 *dwc)
			DWC3_DEVTEN_USBRSTEN |
			DWC3_DEVTEN_USBRSTEN |
			DWC3_DEVTEN_DISCONNEVTEN);
			DWC3_DEVTEN_DISCONNEVTEN);


	/*
	 * Enable SUSPENDEVENT(BIT:6) for version 230A and above
	 * else enable USB Link change event (BIT:3) for older version
	 */
	if (dwc->revision < DWC3_REVISION_230A)
	if (dwc->revision < DWC3_REVISION_230A)
		reg |= DWC3_DEVTEN_ULSTCNGEN;
		reg |= DWC3_DEVTEN_ULSTCNGEN;
	else
		reg |= DWC3_DEVTEN_EOPFEN;


	dwc3_writel(dwc->regs, DWC3_DEVTEN, reg);
	dwc3_writel(dwc->regs, DWC3_DEVTEN, reg);
}
}
@@ -3251,6 +3245,13 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
	speed = reg & DWC3_DSTS_CONNECTSPD;
	speed = reg & DWC3_DSTS_CONNECTSPD;
	dwc->speed = speed;
	dwc->speed = speed;


	/* Enable SUSPENDEVENT(BIT:6) for version 230A and above */
	if (dwc->revision >= DWC3_REVISION_230A) {
		reg = dwc3_readl(dwc->regs, DWC3_DEVTEN);
		reg |= DWC3_DEVTEN_EOPFEN;
		dwc3_writel(dwc->regs, DWC3_DEVTEN, reg);
	}

	/*
	/*
	 * RAMClkSel is reset to 0 after USB reset, so it must be reprogrammed
	 * RAMClkSel is reset to 0 after USB reset, so it must be reprogrammed
	 * each time on Connect Done.
	 * each time on Connect Done.