Skip to content

Commit 21795c8

Browse files
Mian Yousaf KaukabFelipe Balbi
authored andcommitted
usb: dwc2: exit hibernation on session request
Controller enters hibernation through suspend interrupt on disconnection. On connection, session request interrupt is generated. dwc2 must exit hibernation and restore state from this interrupt before continuing. In host mode, exit from hibernation is handled by bus_resume function. Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Tested-by: Robert Baldyga <r.baldyga@samsung.com> Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com> Tested-by: John Youn <johnyoun@synopsys.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parent 8fc37b8 commit 21795c8

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

drivers/usb/dwc2/core_intr.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,28 @@ static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg)
313313
*/
314314
static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg)
315315
{
316-
dev_dbg(hsotg->dev, "++Session Request Interrupt++\n");
316+
int ret;
317+
318+
dev_dbg(hsotg->dev, "Session request interrupt - lx_state=%d\n",
319+
hsotg->lx_state);
317320

318321
/* Clear interrupt */
319322
dwc2_writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS);
320323

321-
/*
322-
* Report disconnect if there is any previous session established
323-
*/
324-
if (dwc2_is_device_mode(hsotg))
324+
if (dwc2_is_device_mode(hsotg)) {
325+
if (hsotg->lx_state == DWC2_L2) {
326+
ret = dwc2_exit_hibernation(hsotg, true);
327+
if (ret && (ret != -ENOTSUPP))
328+
dev_err(hsotg->dev,
329+
"exit hibernation failed\n");
330+
}
331+
332+
/*
333+
* Report disconnect if there is any previous session
334+
* established
335+
*/
325336
dwc2_hsotg_disconnect(hsotg);
337+
}
326338
}
327339

328340
/*

0 commit comments

Comments
 (0)