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

Peter Chen peter.chen at freescale.com
Thu Mar 14 05:24:39 EDT 2013


On Thu, Mar 14, 2013 at 11:00:05AM +0200, Felipe Balbi wrote:
> Hi,
> 
> On Thu, Mar 14, 2013 at 01:50:42PM +0800, Peter Chen wrote:
> > - If there is no vbus control to indicate connection.
> > and disconnect, we can pullup dp when we load gadget module.
> > - If we have vbus control logic, the dp is better pull up
> > when there is a vbus session.
> > 
> > Signed-off-by: Peter Chen <peter.chen at freescale.com>
> > ---
> >  drivers/usb/gadget/udc-core.c |   10 ++++++++--
> >  1 files changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
> > index 4d90bdf..4b56f7c 100644
> > --- a/drivers/usb/gadget/udc-core.c
> > +++ b/drivers/usb/gadget/udc-core.c
> > @@ -278,7 +278,10 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
> >  		driver->unbind(gadget);
> >  		goto err1;
> >  	}
> > -	usb_gadget_connect(gadget);
> > +	if (!gadget->ops->vbus_session ||
> > +			(gadget->ops->vbus_session
> > +				&& gadget->vbus_active))
> > +		usb_gadget_connect(gadget);
> >  
> >  	kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
> >  	return 0;
> > @@ -384,7 +387,10 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
> >  
> >  	if (sysfs_streq(buf, "connect")) {
> >  		usb_gadget_udc_start(gadget, udc->driver);
> > -		usb_gadget_connect(gadget);
> > +		if (!gadget->ops->vbus_session ||
> > +				(gadget->ops->vbus_session
> > +					&& gadget->vbus_active))
> > +			usb_gadget_connect(gadget);
> 
> this patch is incomplete. What happens if this test fails ? Who will
> connect pullup then ?

gadget->ops->vbus_session will handle it when the vbus interrupt comes

> 
> -- 
> balbi



-- 

Best Regards,
Peter Chen




More information about the linux-arm-kernel mailing list