Hi, On Wed, Apr 26, 2023, Roger Quadros wrote: > Hi Thinh, > > On Linux kernel v6.3 > Test procedure: > > - modprobe g_zero > - Connect to PC host > - systemctl suspend > > A large delay of 3 seconds is observed. The delay comes from dwc3_gadget_suspend()->dwc3_gadget_run_stop() waiting for DWC3_DSTS_DEVCTRLHLT to be set. > It returns -ETIMEDOUT. > > Are we missing something to do a clean stop during suspend? > > FYI. Unloading g_zero does not show this delay on stop. > > cheers, > -roger When clearing run_stop bit and the controller doesn't halt, that usually means there are active transfers/endpoints that aren't ended yet. The dwc3_gadget_suspend() doesn't properly do all the cleanup before clearing the run_stop bit. I think you just need to call dwc3_gadget_soft_disconnect() in dwc3_gadget_suspend() to fix this. Thanks, Thinh