Trying to understand new wakeup events architecture

Daniel Drake
2010-12-14T17:57:20Z

Hi,

The OLPC XO laptop suspends a lot. It suspends with the screen on as
if it is still running. It can be woken up in a variety of ways:
keyboard, mouse, WLAN, ...

While upstreaming OLPC's power management code I'm facing the
requirement that our userspace power manager needs to know the reason
for system wakeup. For example, if it was a WLAN packet then we can go
back to sleep pretty quickly, without restoring screen brightness (the
screen gets dimmed after a few mins of inactivity on the
keyboard/mouse front). But if the system was woken up with the
keyboard we want to restore screen brightness immediately and stay
awake for a longer time before going back into suspend.

We used to do this (outside of mainline) with a /proc node storing the
"wakeup reason" but I'm now wondering what the most upstream-suitable
approach is.

I saw this patch:

commit 074037ec79bea73edf1b1ec72fef1010e83e3cc5
Author: Rafael J. Wysocki <rjw@sisk.pl>
Date: Wed Sep 22 22:09:10 2010 +0200

PM / Wakeup: Introduce wakeup source objects and event statistics

But I'm unable to find any documentation of what it's for or how to use it.

Does it solve my problem?
If so, are there any examples of drivers adapted to use this
functionality? Or documentation?

I suspect the reason I don't understand it well is because I haven't
read 17 long threads about android...And I'd rather not, if it can be
avoided :)

Thanks,
Daniel