diff options
author | David Brownell <david-b@pacbell.net> | 2007-05-08 03:34:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:18 -0400 |
commit | f5f72b46c349fefcfd4421b2213c6ffb324c5e56 (patch) | |
tree | 9ad2ac0eb4504399aad8f2a9a9e72ae8103e2e53 /drivers/acpi/glue.c | |
parent | 87ac84f42a7a580d0dd72ae31d6a5eb4bfe04c6d (diff) |
ACPI wakeup hooks for rtc-cmos
Remove /proc/acpi/alarm file when the rtc-cmos "wakealarm" file is available.
Instead, provide hooks that rtc-cmos will use.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/acpi/glue.c')
-rw-r--r-- | drivers/acpi/glue.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 4334c208841a..83768e9cf296 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -245,6 +245,35 @@ arch_initcall(init_acpi_device_notify); | |||
245 | 245 | ||
246 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) | 246 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) |
247 | 247 | ||
248 | #ifdef CONFIG_PM | ||
249 | static u32 rtc_handler(void *context) | ||
250 | { | ||
251 | acpi_clear_event(ACPI_EVENT_RTC); | ||
252 | acpi_disable_event(ACPI_EVENT_RTC, 0); | ||
253 | return ACPI_INTERRUPT_HANDLED; | ||
254 | } | ||
255 | |||
256 | static inline void rtc_wake_setup(void) | ||
257 | { | ||
258 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); | ||
259 | } | ||
260 | |||
261 | static void rtc_wake_on(struct device *dev) | ||
262 | { | ||
263 | acpi_clear_event(ACPI_EVENT_RTC); | ||
264 | acpi_enable_event(ACPI_EVENT_RTC, 0); | ||
265 | } | ||
266 | |||
267 | static void rtc_wake_off(struct device *dev) | ||
268 | { | ||
269 | acpi_disable_event(ACPI_EVENT_RTC, 0); | ||
270 | } | ||
271 | #else | ||
272 | #define rtc_wake_setup() do{}while(0) | ||
273 | #define rtc_wake_on NULL | ||
274 | #define rtc_wake_off NULL | ||
275 | #endif | ||
276 | |||
248 | /* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find | 277 | /* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find |
249 | * its device node and pass extra config data. This helps its driver use | 278 | * its device node and pass extra config data. This helps its driver use |
250 | * capabilities that the now-obsolete mc146818 didn't have, and informs it | 279 | * capabilities that the now-obsolete mc146818 didn't have, and informs it |
@@ -283,11 +312,17 @@ static int __init acpi_rtc_init(void) | |||
283 | struct device *dev = get_rtc_dev(); | 312 | struct device *dev = get_rtc_dev(); |
284 | 313 | ||
285 | if (dev) { | 314 | if (dev) { |
315 | rtc_wake_setup(); | ||
316 | rtc_info.wake_on = rtc_wake_on; | ||
317 | rtc_info.wake_off = rtc_wake_off; | ||
318 | |||
286 | rtc_info.rtc_day_alarm = acpi_gbl_FADT.day_alarm; | 319 | rtc_info.rtc_day_alarm = acpi_gbl_FADT.day_alarm; |
287 | rtc_info.rtc_mon_alarm = acpi_gbl_FADT.month_alarm; | 320 | rtc_info.rtc_mon_alarm = acpi_gbl_FADT.month_alarm; |
288 | rtc_info.rtc_century = acpi_gbl_FADT.century; | 321 | rtc_info.rtc_century = acpi_gbl_FADT.century; |
289 | 322 | ||
290 | /* NOTE: acpi_gbl_FADT->rtcs4 is NOT currently useful */ | 323 | /* NOTE: S4_RTC_WAKE is NOT currently useful to Linux */ |
324 | if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE) | ||
325 | printk("ACPI: RTC can wake from S4\n"); | ||
291 | 326 | ||
292 | dev->platform_data = &rtc_info; | 327 | dev->platform_data = &rtc_info; |
293 | 328 | ||