Re: Controller's wakeup setting at usb_add_hcd

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

 



On Thu, Oct 24, 2013 at 10:25:25AM -0400, Alan Stern wrote:
> On Thu, 24 Oct 2013, Peter Chen wrote:
> 
> > > If the HC is deleted and the UDC is added then the wakeup settings
> > > should be determined by the UDC, not by the HC.  The next time the
> > > system goes to sleep, the UDC driver should be responsible for enabling
> > > or disabling wakeup.
> > > 
> > 
> > I agree both of your points, but after thinking more, I doubt
> > that why hcd (or udc) needs to control its parent wakeup setting?
> > Why not let controller driver decide it?
> 
> I"m not quite sure what you're asking.
> 
> To start with, we are talking about two different wakeup settings:
> 
> 	The software flag, which is controlled by userspace writing
> 	to the power/wakeup attribute or by the driver calling
> 	device_wakeup_enable(), device_wakeup_disable(), or 
> 	device_set_wakeup_enable();
> 
> 	The physical wakeup setting in the hardware.
> 
> In general, the controller driver does not control the software flag,
> except that the driver may initialize the flag.  usb_add_hcd() always
> initializes the controller's flag to 1, but the driver can override it
> afterward.  After it is initialized, the flag is controlled entirely by
> userspace.
> 
> The physical wakeup setting is controlled by both the controller driver
> and the platform driver.  For example, with a PCI-based EHCI
> controller, ehci-hub.c sets the various port wakeup flags and the PCI
> subsystem enables or disables PME.  However this shouldn't matter,
> because these drivers should always tell the hardware to do what the
> software flag says.  That is, if device_may_wakeup() is true then the
> hardware wakeup should be enabled; otherwise it should be disabled.
> 

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

-- 

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




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

  Powered by Linux