2001-03-17 00:22:48

by Andrew Grover

[permalink] [raw]
Subject: [PATCH] USB suspend when no devices attached

Hi all.

This is a preliminary patch against 2.4.2 to uhci.c that puts the host
controller into global suspend when there are no devices attached. This
conserves power on mobile systems, and because suspending the host
controller ceases UHCI's incessant busmastering activity, it allows the CPU
to enter a deeper idle state.

The main problem with this implementation is that it just looks at the 2
root hub ports and suspends if nothing is connected. Ideally, it would be
smart enough to realize it can also suspend when only hubs are present, or
when all devices on the USB are also suspended. I hope a USB expert can add
these enhancements, as it's beyond me.

You should be able to verify this patch is working in one of two ways:
1) Turn on USB debug messages, and look for suspend_hc and wakeup_hc
messages
2) Download the latest ACPI patch from
http://developer.intel.com/technology/iapc/acpi/downloads.htm and verify
that /proc/acpi/processor/0/status shows mostly 0's for busmastering
activity (as opposed to mostly F's) when no USB devices are connected.

Thanks -- Regards -- Andy


Attachments:
uhci.diff (2.95 kB)

2001-03-17 00:32:59

by Johannes Erdfelt

[permalink] [raw]
Subject: Re: [Acpi] [PATCH] USB suspend when no devices attached

On Fri, Mar 16, 2001, Grover, Andrew <[email protected]> wrote:
> This is a preliminary patch against 2.4.2 to uhci.c that puts the host
> controller into global suspend when there are no devices attached. This
> conserves power on mobile systems, and because suspending the host
> controller ceases UHCI's incessant busmastering activity, it allows the CPU
> to enter a deeper idle state.
>
> The main problem with this implementation is that it just looks at the 2
> root hub ports and suspends if nothing is connected. Ideally, it would be
> smart enough to realize it can also suspend when only hubs are present, or
> when all devices on the USB are also suspended. I hope a USB expert can add
> these enhancements, as it's beyond me.

If you want it to be seamless, you really can't do that. USB is a polled
bus, so the HC needs to send something to the device so it tells us that
something has changed, like a device being plugged into a hub (not the root
hub).

> You should be able to verify this patch is working in one of two ways:
> 1) Turn on USB debug messages, and look for suspend_hc and wakeup_hc
> messages
> 2) Download the latest ACPI patch from
> http://developer.intel.com/technology/iapc/acpi/downloads.htm and verify
> that /proc/acpi/processor/0/status shows mostly 0's for busmastering
> activity (as opposed to mostly F's) when no USB devices are connected.

Thanks for the patch. I'll integrate into my patch and send it off to Linus
as well after I run it through it's paces.

It looks good on visual inspection atleast.

JE