Bug 29692

Summary: Wake on RTC no longer works in some kernel configurations
Product: Power Management Reporter: Justin Maggard (jmaggard10)
Component: OtherAssignee: Rafael J. Wysocki (rjw)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: florian, lenb, maciej.rutecki, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.37+ Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 7216, 27352    
Attachments: PM: Fix ACPI wakeup from S5 when CONFIG_PM_SLEEP is unset

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-2.6.37.1/kernel/power/Kconfig	2011-02-17 23:44:35.000000000 +0000
+++ linux-2.6.37.1.jm/kernel/power/Kconfig	2011-02-23 03:44:02.000000000 +0000
@@ -92,7 +92,7 @@
 
 config PM_SLEEP
 	bool
-	depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE
+	depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE || RTC_CLASS=y
 	default y
 
 config PM_SLEEP_ADVANCED_DEBUG
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
closed