On Thu, Oct 24, 2013 at 12:51:47PM -0400, Alan Stern wrote: > On Thu, 24 Oct 2013, Peter Chen wrote: > > > It is the same which the embedded world does, that is the physical wakeup > > setting is controlled by software flag. Since it is the controller's wakeup, > > why the controller driver does not go to control the software flag in general? > > > > The current problem for me is: usb_add_hcd initializes the controller's flag > > to 1, the controller driver needs to override it as 0. It will delete the > > hcd on the fly (call usb_remove_hcd) for otg controller due to plug in Micro B-to-A > > cable (ID 0->1), and later, the user may plug out this cable (ID 1->0), the > > hcd will be added again, at this time, the wakeup flag is set by hcd again. > > If I want to keep the wakeup flag as 0 by default, I need to clear it again. > > Yes. > > > Just like you said: > > > The physical wakeup setting is controlled by both the controller driver > > > and the platform driver. > > But currently, it is controlled (or affected) by hcd layer. > > It is _initialized_ by the HCD layer. The platform driver can always > override this. It's easy; just call device_set_wakeup_enable(dev, 0) > after usb_add_hcd(). > > In fact, your platform driver probably should remember the current > wakeup setting when the HC is removed. The next time it is added you > should change the wakeup setting to the remembered value. That way, if > the user adjusts the setting and switches between host and device mode, > the desired setting will persist. > Yes, we can do that. But if there is no initializing for wakeup setting at usb_add_hcd, the controller driver needs to do nothing, No matter HC is removed or peripheral switches to HC, the wakeup setting will be totally decided by user, and the default setting is 0. -- Best Regards, Peter Chen -- 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