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

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

 



On Mon, Dec 19, 2011 at 01:17:51PM +0000, Chen Peter-B29397 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().
> > 
> Yes, my meaning is also it is the default value for usb_gadget_status, we
> can also use this value as disconnect state (vbus is off) 

indeed.

> > > 	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.
> I have not read USB3 spec, it is triggered by host setup packet or controller interrupt?
> or the same with USB2 Charter 9 USB default state?

same as USB2 default state.

> When we usually go to set it?

after your Bus Reset finishes, you should go to default state. So, you
probably have a Bus Reset Interrupt, at the end of that handler, you set
the gadget to Default.

> > > 	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.
> Get it, how about reset? does it need resetting and reseted?

Maybe... but the "USB_STATUS_RESET" would be the same as
USB_STATUS_DEFAULT.

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