On 10/16/2020 3:42 PM, Thinh Nguyen wrote: > Hi, > > Wesley Cheng wrote: >> Hi linux-usb members! >> >> I was looking at seeing how the DWC3 drivers are handling the USB cable >> disconnect routine (VBUS low situation) when there is no UDC binded. Is >> the below behavior expected? >> >> 1. Enumerate device w/ host. >> 2. Gadget is unbinded >> - echo "" > /sys/kernel/config/usb_gadget/g1/UDC >> 3. Disconnect the USB cable (VBUS low) >> 4. No dwc3_gadget_disconnect_interrupt() seen (since controller is >> halted from step#1) > > I think you mean after step#2? > >> 5. Runtime PM autosuspend fails due to "dwc->connected" being true >> (cleared in dwc3_gadget_disconnect_interrupt()) > > This is probably a mishap in the dwc3 driver. When the function driver > is unregistered, the pullup() callback will halt the controller. This is > a soft-disconnect, and dwc->connected should be false. > >> 6. Gadget binded >> - echo udc_name > /sys/kernel/config/usb_gadget/g1/UDC > > After this step, the device will still remain disconnected. > >> 7. No runtime suspend until cable is plugged in and out > > ... until the reset and connection done interrupt telling the driver > that the device is now connected. > >> >> This would be problematic for devices which have to reliably enter >> suspend. I just wanted to see if this is a scenario which has been >> considered? Seems odd that we would still keep the controller out of >> low power if there was no cable connected. >> > > This should be a simple fix. Would you create a patch for this? > Hi Thinh, Sure, will submit a patch for this. Will upload it soon! Thanks Regards, Wesley Cheng -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project