> -----Original Message----- > From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx] > Sent: Wednesday, April 13, 2011 11:08 PM > To: Xu, Andiry > Cc: Sarah Sharp; linux-usb@xxxxxxxxxxxxxxx > Subject: Re: Question about USB keyboard remote wakeup from hibernation > > On Wed, 13 Apr 2011, Andiry Xu wrote: > > > Thanks for the elaborate explanation, that's really helpful. > > Part of the discussion was wrong; I mixed up xhci_bus_suspend and > xhci_pci_suspend. But it looks like you realized what I meant. > > > I've not got a serial console but I managed to catch some call trace > > using a very simple but effective method: use outb(data, 0x80) and > check > > the LED display on the motherboard. > > > > xhci_bus_suspend() will check all the ports and suspend them if they > are > > in U0 state. this makes things different for suspend and hibernation. > > > > During system suspend, the call trace is like this: > > usb_port_suspend(): > > Set REMOTE_WAKEUP request to the device; > > Suspend the port; > > xhci_bus_suspend(): > > //The port is already suspended > > xhci_pci_suspend() > > Suspend the host; > > > > During system hibernation, the call trace is like this: > > xhci_bus_suspend(): > > Suspend the port, since it's in U0 state; > > There should be a call to xhci_bus_resume() at this point, during the > second or "thaw" stage. It should put the port back into U0. > Yes, you're right. xhci_bus_resume() is called at this moment and it resumes the port again. > > usb_port_suspend(): > > No REMOTE_WAKEUP request is sent to the device, maybe because > it's > > suspended? > > The remote-wakeup request should have been sent because the port should > not have been suspended. > > > Suspend the port; > > xhci_pci_suspend(): > > Suspend the host; > > > > So remote wakeup is not working. > > > > I made a small test, skip the port suspend part in xhci_bus_suspend(): > > xhci_bus_suspend(): > > //Skip the port suspend part; > > See if you can trace the call to xhci_bus_resume() that's supposed to > appear here. > > > usb_port_suspend(): > > REMOTE_WAKEUP request is sent to the device; > > Suspend the port; > > xhci_pci_suspend(): > > Suspend the host; > > > > And by doing this, press the USB keyboard on xHCI can wakeup the > system > > from hibernation. > > > > The xhci bus suspend/resume is mainly copied from EHCI bus > > suspend/resume method, in which EHCI suspend all the ports during bus > > suspend. Seems it should be modified for xHCI. Any suggestions? > > The same scheme should work for both EHCI and xHCI. I can't tell what > the problem is. > I think I've figured out the root cause: after port resume, it indicates a port link state change and set the PLC bit in PORTSC. It should be cleared after port resume. After clear the PORT_PLC in xhci_bus_resume(), USB keyboard remote wakeup works for hibernation. I'll submit a formal patch later, thanks a lot for your help. Thanks, Andiry -- 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