Bug 29692 - Wake on RTC no longer works in some kernel configurations
Wake on RTC no longer works in some kernel configurations
Product: Power Management
Classification: Unclassified
Component: Other
All Linux
: P1 normal
Assigned To: Rafael J. Wysocki
Depends on:
Blocks: 7216 27352
  Show dependency treegraph
Reported: 2011-02-23 04:37 UTC by Justin Maggard
Modified: 2011-03-03 01:02 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.37+
Tree: Mainline
Regression: Yes

PM: Fix ACPI wakeup from S5 when CONFIG_PM_SLEEP is unset (1.92 KB, patch)
2011-02-23 09:23 UTC, Rafael J. Wysocki
Details | Diff

Description Justin Maggard 2011-02-23 04:37:03 UTC
Waking from S5 via RTC by writing to /sys/class/rtc/rtc0/wakealarm had been working for me for quite some time, until moving to a 2.6.37 kernel.  After some digging, I found that /sys/class/rtc/rtc0/device/power/wakeup was set to disabled, while it was always set to enabled on previous kernels, and this appeared to be the main visible difference.

I eventually tracked it down to to the differences in include/linux/pm_wakeup.h between 2.6.36 and 2.6.37.  The rtc-cmos driver calls device_init_wakeup() during initialization, which sets the can_wakeup flag to 1.  But device_init_wakeup() doesn't do anything today unless CONFIG_PM_SLEEP is set.  And CONFIG_PM_SLEEP doesn't get enabled unless CONFIG_SUSPEND || CONFIG_HIBERNATION || CONFIG_XEN_SAVE_RESTORE are enabled.

Seems like you shouldn't have to enable suspend to disk or suspend to RAM support in order to wake from S5, but I don't know what the proper solution is.  I tried the following quick and dirty hack, and things did work after recompiling my kernel with that change; but it's obviously not a proper fix.

--- linux-	2011-02-17 23:44:35.000000000 +0000
+++ linux-	2011-02-23 03:44:02.000000000 +0000
@@ -92,7 +92,7 @@
 config PM_SLEEP
 	default y
Comment 1 Rafael J. Wysocki 2011-02-23 09:23:46 UTC
Created attachment 48712 [details]
PM: Fix ACPI wakeup from S5 when CONFIG_PM_SLEEP is unset

Thanks for the report.  Does the attached patch help (on top of 2.6.38-rc6)?
Comment 2 Justin Maggard 2011-02-23 20:08:59 UTC
Yes, it works perfectly again with your patch.  Thanks for the quick response!
Comment 3 Florian Mickler 2011-02-23 21:30:12 UTC
Patch: https://bugzilla.kernel.org/attachment.cgi?id=48712
Comment 4 Len Brown 2011-03-03 01:02:43 UTC
commit 805bdaec1a44155db35f6ee5410d6bbc365324a8
Author: Rafael J. Wysocki <rjw@sisk.pl>
Date:   Thu Feb 24 11:10:01 2011 +0100

    PM: Make ACPI wakeup from S5 work again when CONFIG_PM_SLEEP is unset

shipped in linux-2.6.38-rc7

Note You need to log in before you can comment on or make changes to this bug.