Re: USB runtime D3

Alan Stern
2009-07-30T19:22:31Z

On Thu, 30 Jul 2009, Matthew Garrett wrote:

> On Thu, Jul 30, 2009 at 02:57:48PM -0400, Alan Stern wrote:
> > > event, even though port0en and port1n are set in USB_RES. Is there any
> > > way to get UHCI to do this? I'm guessing that the power is being cut to
> > > the port when it suspends with no device connected.
> >
> > No, that doesn't sound right. On the other hand, there's only one way
> > to find out for certain. Voltmeters do come in handy at times...
>
> Thinking about it, I get plug events from EHCI, so it can't be that the
> port is powered down. Maybe it's something to do with the port switching
> logic.

Seems likely. What happens if you suspend the UHCI controller but
leave the EHCI controller active? Then the port-switching logic should
kick in.

> > > Anyone have any ideas? I've attached the current version of my code,
> > > which is hacked up in various ways as I try to understand what's going
> > > on but should give some idea what I'm trying.
> >
> > Ugh... Hacked is right. I can't comment on the ACPI stuff, but the
> > USB parts are a mess. You put stuff in the USB core that really
> > belongs in the PCI core and you put stuff in the kernel that belongs in
> > userspace. Of course, there's nothing wrong with doing this as part of
> > a "proof-of-principle" thing.
>
> Yes, I guess the correct model is for this to be in PCI and have the USB
> code do nothing other than indicate that the PCI device is now idle.

Which reminds me... One of the things you had to do was enable remote
wakeup for the host controllers. The current initial state is
disabled, for a good reason. People don't like it if they suspend
their laptop only to find that the computer wakes back up again when
they unplug the USB mouse.

If we do end up implementing runtime power management for USB host
controllers, something (a userspace program?) will have to turn off
remote wakeup before system sleeps and turn it back on afterward.

Alan Stern