Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 3 Sep 2014, Peter Chen wrote:

> > Okay.  Let's start by adding the reset field to struct
> > usb_gadget_driver.  The initial implementation in the four gadget
> > drivers can be very simple: It calls the disconnect handler.  (At some
> > later time we can add a ->reset callback to struct
> > usb_composite_driver; then the reset handler in composite.c can invoke
> > that callback for all function drivers that define it.)
> > 
> > Next, add routines to udc-core to handle Vbus changes, function
> > activation changes, and resets.  The Vbus routine will invoke the
> > gadget driver's ->disconnect callback when Vbus goes off and then call
> > usb_gadget_disconnect.  The activation routine will call
> > usb_gadget_disconnect if any functions are deactivated, and
> > usb_gadget_connect if all the functions are activated (basically, do
> > whatever composite.c would do).  And the reset routine will invoke the
> > gadget driver's ->reset callback.  I suppose we'll also have to add
> > fields to struct usb_gadget, to store the current Vbus and activation
> > statuses.
> 
> If the usb_gadget_disconnect will be not called at gadget driver's
> ->disconnect, it has no much meaning we still have gadget driver's
> ->reset, since the content of its ->disconnect and ->reset are the
> same if we don't consider to add function's reset handler.

No, they aren't always the same.  For example, g_mass_storage ought to 
flush its dirty buffers when a disconnect occurs, but it doesn't have 
to flush them when a reset occurs.

> > Then modify all the UDC drivers; make them invoke the new udc-core
> > routines whenever there's a change in Vbus status or a reset, instead
> > of invoking the gadget driver's callbacks directly.  At the same time
> > we can remove the code that turns off the pullup when Vbus 
> > goes down, because now the udc-core routine will take care of it.
> 
> Why we need to record the reset at udc-core?

We don't really need to.  But it seems like a good idea to have events
that affect the entire device (including connect, disconnect, reset,
and probably also bus suspend and bus resume) all pass through
udc-core.

Alan Stern

--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux