> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Felipe Balbi > Sent: Wednesday, August 13, 2014 10:20 AM > > On Wed, Aug 13, 2014 at 12:56:27PM -0400, Alan Stern wrote: > > > > If you want libcomposite to handle the pullups on behalf of the > > > > function drivers, there has to be a way for the UDC driver to tell > > > > libcomposite when Vbus turns on and off. Add a new callback to the > > > > usb_gadget_driver structure? > > > > > > usb_gadget_driver, why ? We need a way for udc-core to ask the PHY if > > > > Not udc-core. libcomposite. > > > > > VBUS is already above session valid threshold. My fear is that we might > > > end up implementing this by polling this PHY method until it's valid. > > > > > > Are we starting to see a need for a kgadgetd which gets awaken on > > > different conditions ? Any other ideas ? > > > > 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. > sounds good. I think we will be able to drop gadget->vbus_session() once > this is all done as most current implementations will call > gadget->disconnect/connect() conditionally on vbus being active or not. > > -- > balbi -- 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