Re: [RFC/PATCH 1/2] usb: gadget: introduce gadget status tracking

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

 



Hi,

On Mon, Dec 19, 2011 at 08:42:07PM +0800, Peter Chen wrote:
> On Mon, Dec 19, 2011 at 02:06:17PM +0200, Felipe Balbi wrote:
> > On Mon, Dec 19, 2011 at 01:04:44PM +0100, Sebastian Andrzej Siewior wrote:
> > > * Felipe Balbi | 2011-12-19 13:04:05 [+0200]:
> > > 
> > > >--- a/include/linux/usb/gadget.h
> > > >+++ b/include/linux/usb/gadget.h
> > > >@@ -478,6 +478,53 @@ struct usb_gadget_ops {
> > > > 	int	(*stop)(struct usb_gadget_driver *);
> > > > };
> > > > 
> > > >+enum usb_device_status {
> > > >+	USB_STATUS_IDLE,
> > > >+	USB_STATUS_CONNECTED,
> > > >+	USB_STATUS_RESETTING,
> > > >+
> > > >+	USB_STATUS_DEFAULT,
> > > >+	USB_STATUS_ADDRESSED,
> > > >+	USB_STATUS_UNCONFIGURED,
> > > >+	USB_STATUS_CONFIGURED,
> > > >+
> > > >+	USB_STATUS_SUSPENDING,
> > > >+	USB_STATUS_SUSPENDED,
> > > >+	USB_STATUS_RESUMING,
> > > >+	USB_STATUS_RESUMED,
> > > >+};
> 
> Please connect me if my understanding is wrong

s/connect/correct

(you were wrong ;-)

> 	USB_STATUS_IDLE, /* default state */

well, it really just means idle. It's not the default state per USB
specification. We need a default value to use before we called our first
usb_gadget_set_status().

> 	USB_STATUS_CONNECTED, /* when get vbus rising interrupt */

yes.

> 	USB_STATUS_RESETTING, /* when receive BUS_RESET */

yes.

> 	USB_STATUS_DEFAULT,  /* ??? */

this is USB Specification Default state. See USB3 Spec Section 9.1.1.3.
It means we are not addressed yet, we don't have an address.

> 	USB_STATUS_ADDRESSED, /* after receive SET_ADDRESS */

yes.

> 	USB_STATUS_UNCONFIGURED, /* ??? */

After set_address and before set_configuration

> 	USB_STATUS_CONFIGURED, /* after receive SET_CONFIGRUTION */

yes.

> 	USB_STATUS_SUSPENDING, /* bus idle 3ms */
> 	USB_STATUS_SUSPENDED,
> 	USB_STATUS_RESUMING,  /* after receive resuming signal */
> 	USB_STATUS_RESUMED,
> 
> 1. when the status will be used I have marked with /* ??? */ above?
> 2. Any differences between USB_STATUS_SUSPENDING and USB_STATUS_SUSPENDED?

We might want to know that difference. When bus is idle for 3ms, we will
e.g. Get a Suspend interrupt. Most drivers will use that to put PHY
and/or Link into a lower power state and only after that whole
operation finishes, we are truly suspended.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux