> From: Felipe Balbi [mailto:ba...@ti.com] > Sent: Wednesday, August 13, 2014 12:21 PM > > On Wed, Aug 13, 2014 at 07:15:37PM +0000, Paul Zimmerman wrote: > > > From: linux-usb-ow...@vger.kernel.org > > > [mailto:linux-usb-ow...@vger.kernel.org] 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. > > yeah, there's no difference from the digital side of things. Most boards > I've seen use USB vbus comparators present on the PMIC.
I guess what I was trying to say, is that if you have a DWC3 platform that uses a generic Phy, there is no way that I can see to detect when VBus is enabled/disabled. Aside from Connect/Disconnect, but I realise now the pullups would have to be enabled already to see a Connect, so that wouldn't work either. So any method that depends on detecting VBus would have to be optional, since not all platforms can support it. -- Paul -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html