Subject: Re: power management and idle detection on non-x86
To: Michael Lorenz <macallan@netbsd.org>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: tech-kern
Date: 05/07/2006 21:05:26
Michael Lorenz wrote:
> I've been working to get some sort of power management into my
> sparcbook for a while now and apart from powerhooks in many device
> drivers there are a few other things missing.
> First, we need a way to know when the machine is idle so we can dim
> backlight at some point, or fall asleep. What I'd like to have is a
> bunch of 'idle timers' - just write the current timestamp into a more
> or less global variable whenever the mouse is moved, some key is
> pressed etc., probably keep different counters for different devices.
> With this we could detect 'idleness' by just comparing these variables
> to current time, if enough of them differ by some predefined value we
> can take actions. On PCs this is probably handled by the APM BIOS but
> on macppc or sparc we don't have anything like that so we need our own.
wscons seems like the ideal place to handle this. Low level hw drivers
should be able to register callbacks for certain actions
("dim/standby/suspend display", etc).
Now, policy needs to be set in userland. Also, if you sleep, you want to
notify powerd that you want to go to sleep so it can run its sleep
scripts before powering off -- don't do this directly from the kernel.
Also, x86 is interested in this for ACPI. I'd be willing to work with
you on this.
> So, before I'm wasting my time inventing the wheel the 5th time - do
> we have something like this somewhere in the kernel? Should it be
> integrated with powerd? What about powerd vs. apmd? Their scopes seem
> to overlap quite a bit.
apmd is dead; the future is powerd.
Cheers,
Jared