Message ID | 1460374506-9779-8-git-send-email-rogerq@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, Roger Quadros <rogerq@ti.com> writes: > Gadget controller might not be always active during suspend/ > resume when we are operating in dual-role/otg mode. > Check if we're active and only if we are then perform > necessary actions during suspend/resume. I don't get this. If we're operating in OTG, we should have a gadget driver loaded, no ?
On 11/04/16 15:23, Felipe Balbi wrote: > > Hi, > > Roger Quadros <rogerq@ti.com> writes: >> Gadget controller might not be always active during suspend/ >> resume when we are operating in dual-role/otg mode. >> Check if we're active and only if we are then perform >> necessary actions during suspend/resume. > > I don't get this. If we're operating in OTG, we should have a gadget > driver loaded, no ? > At boot gadget driver is not automatically loaded. We're still in OTG mode but OTG state machine hasn't started. System suspend/resume can still happen. User might also load/unload the gadget driver prior to system suspend. cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, Roger Quadros <rogerq@ti.com> writes: > On 11/04/16 15:23, Felipe Balbi wrote: >> >> Hi, >> >> Roger Quadros <rogerq@ti.com> writes: >>> Gadget controller might not be always active during suspend/ >>> resume when we are operating in dual-role/otg mode. >>> Check if we're active and only if we are then perform >>> necessary actions during suspend/resume. >> >> I don't get this. If we're operating in OTG, we should have a gadget >> driver loaded, no ? >> > At boot gadget driver is not automatically loaded. We're still in OTG mode > but OTG state machine hasn't started. > System suspend/resume can still happen. > > User might also load/unload the gadget driver prior to system suspend. good point, this should go in the -rc too.
On 11/04/16 16:26, Felipe Balbi wrote: > > Hi, > > Roger Quadros <rogerq@ti.com> writes: >> On 11/04/16 15:23, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Roger Quadros <rogerq@ti.com> writes: >>>> Gadget controller might not be always active during suspend/ >>>> resume when we are operating in dual-role/otg mode. >>>> Check if we're active and only if we are then perform >>>> necessary actions during suspend/resume. >>> >>> I don't get this. If we're operating in OTG, we should have a gadget >>> driver loaded, no ? >>> >> At boot gadget driver is not automatically loaded. We're still in OTG mode >> but OTG state machine hasn't started. >> System suspend/resume can still happen. >> >> User might also load/unload the gadget driver prior to system suspend. > > good point, this should go in the -rc too. > But there is no dual-role mode currently so it won't fix any bug yet :). cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, Roger Quadros <rogerq@ti.com> writes: > On 11/04/16 16:26, Felipe Balbi wrote: >> >> Hi, >> >> Roger Quadros <rogerq@ti.com> writes: >>> On 11/04/16 15:23, Felipe Balbi wrote: >>>> >>>> Hi, >>>> >>>> Roger Quadros <rogerq@ti.com> writes: >>>>> Gadget controller might not be always active during suspend/ >>>>> resume when we are operating in dual-role/otg mode. >>>>> Check if we're active and only if we are then perform >>>>> necessary actions during suspend/resume. >>>> >>>> I don't get this. If we're operating in OTG, we should have a gadget >>>> driver loaded, no ? >>>> >>> At boot gadget driver is not automatically loaded. We're still in OTG mode >>> but OTG state machine hasn't started. >>> System suspend/resume can still happen. >>> >>> User might also load/unload the gadget driver prior to system suspend. >> >> good point, this should go in the -rc too. >> > But there is no dual-role mode currently so it won't fix any bug yet :). this should be a problem even for device-only, right ? i) boot-up ii) modprobe dwc3 iii) echo mem > /sys/power/state
On 12/04/16 11:00, Felipe Balbi wrote: > > Hi, > > Roger Quadros <rogerq@ti.com> writes: >> On 11/04/16 16:26, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Roger Quadros <rogerq@ti.com> writes: >>>> On 11/04/16 15:23, Felipe Balbi wrote: >>>>> >>>>> Hi, >>>>> >>>>> Roger Quadros <rogerq@ti.com> writes: >>>>>> Gadget controller might not be always active during suspend/ >>>>>> resume when we are operating in dual-role/otg mode. >>>>>> Check if we're active and only if we are then perform >>>>>> necessary actions during suspend/resume. >>>>> >>>>> I don't get this. If we're operating in OTG, we should have a gadget >>>>> driver loaded, no ? >>>>> >>>> At boot gadget driver is not automatically loaded. We're still in OTG mode >>>> but OTG state machine hasn't started. >>>> System suspend/resume can still happen. >>>> >>>> User might also load/unload the gadget driver prior to system suspend. >>> >>> good point, this should go in the -rc too. >>> >> But there is no dual-role mode currently so it won't fix any bug yet :). > > this should be a problem even for device-only, right ? > > i) boot-up > ii) modprobe dwc3 > iii) echo mem > /sys/power/state > Indeed. It is applicable for device-only mode as well. I'll send this patch for rc then. cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 83d5c57..1ca5ac0 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2952,6 +2952,9 @@ void dwc3_gadget_exit(struct dwc3 *dwc) int dwc3_gadget_suspend(struct dwc3 *dwc) { + if (!dwc->gadget_driver) + return 0; + if (dwc->pullups_connected) { dwc3_gadget_disable_irq(dwc); dwc3_gadget_run_stop(dwc, true, true); @@ -2970,6 +2973,9 @@ int dwc3_gadget_resume(struct dwc3 *dwc) struct dwc3_ep *dep; int ret; + if (!dwc->gadget_driver) + return 0; + /* Start with SuperSpeed Default */ dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512);
Gadget controller might not be always active during suspend/ resume when we are operating in dual-role/otg mode. Check if we're active and only if we are then perform necessary actions during suspend/resume. Signed-off-by: Roger Quadros <rogerq@ti.com> --- drivers/usb/dwc3/gadget.c | 6 ++++++ 1 file changed, 6 insertions(+)