[PATCH 14/14] usb: udc-core: add judgement logic for usb_gadget_connect

Peter Chen peter.chen at freescale.com
Fri Mar 15 08:26:59 EDT 2013


On Fri, Mar 15, 2013 at 12:37:01PM +0200, Felipe Balbi wrote:
> >   */
> >  static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
> >  {
> > +	int ret = 0;
> > +
> >  	if (!gadget->ops->pullup)
> >  		return -EOPNOTSUPP;
> > -	return gadget->ops->pullup(gadget, 0);
> > +
> > +	if (gadget->connection == 1)
> > +		ret = gadget->ops->pullup(gadget, 0);
> > +
> > +	if (!ret)
> > +		gadget->connection --;
> > +
> > +	return ret;
> >  }
> 
> this might be a good idea. But we already have something similar,
> although it's managed at composite device level.

Yes, I know, it should only be managed at one place at last.

> Maybe we need to move
> that to the gadget layer. Still, I don't want to let UDC drivers call
> usb_gadget_connect()/disconnect() directly.
> 
> It's easy enough for udc-core to handle that.


Below are all cases I can think about pullup_dp

1. No vbus interrupt support udc driver, manage pullup at load/unload
gadget module.
2. For vbus interrupt supported udc driver, manage pullup at vbus interrupt
3. For gadget module, like uvc, it will call pullup_dp through its app.

Are there any cases? We need to design one solution to cover all
cases, then, we can try to delete the duplicate pullup calling at
all udc drivers, and make it be generic.

-- 

Best Regards,
Peter Chen




More information about the linux-arm-kernel mailing list