> From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx] > Sent: Wednesday, August 13, 2014 12:46 PM > > On Wed, 13 Aug 2014, Paul Zimmerman wrote: > > > > > The UDC driver ought to know when Vbus turns on or off, without > > > > polling. It should get an interrupt when that happens, or its > > > > ops->vbus_session routine should be called. So at that time, the UDC > > > > driver could invoke a new usb_gadget_driver callback. Let's also call > > > > it vbus_session. > > > > > > > > Since composite.c defines a usb_gadget_driver structure, it can have a > > > > composite_vbus_session() callback. When this routine is called, it > > > > will check to see whether all the functions are activated. If they are > > > > and Vbus is now on, it will call usb_gadget_connect(); otherwise it > > > > will call usb_gadget_disconnect(). > > > > Is there a difference between a VBus on/off and a connect/disconnect? > > Because AFAIK the Synopsys USB 3.0 controller (unless it is configured > > for OTG mode) does not have a way to detect when VBus is enabled/ > > disabled, other than by a connect/disconnect interrupt. > > That's an excellent point; it completely slipped my mind. So we > already have all the callbacks we need. No, that was a brain fart on my part. The DWC3 controller needs to have the pullups enabled before it can see a connect. Well, it's actually the host that won't see the device being connected until the pullups are enabled, but it amounts to the same thing, since the device needs to see some bus activity from the host before it asserts the ConnectDone interrupt. -- Paul -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html