aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/sleep/proc.c')
-rw-r--r--drivers/acpi/sleep/proc.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index ccc11b33d89c..76b45f0b8341 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -60,7 +60,7 @@ acpi_system_write_sleep(struct file *file,
60 state = simple_strtoul(str, NULL, 0); 60 state = simple_strtoul(str, NULL, 0);
61#ifdef CONFIG_SOFTWARE_SUSPEND 61#ifdef CONFIG_SOFTWARE_SUSPEND
62 if (state == 4) { 62 if (state == 4) {
63 error = software_suspend(); 63 error = hibernate();
64 goto Done; 64 goto Done;
65 } 65 }
66#endif 66#endif
@@ -70,6 +70,14 @@ acpi_system_write_sleep(struct file *file,
70} 70}
71#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ 71#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */
72 72
73#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
74/* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
75#else
76#define HAVE_ACPI_LEGACY_ALARM
77#endif
78
79#ifdef HAVE_ACPI_LEGACY_ALARM
80
73static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) 81static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
74{ 82{
75 u32 sec, min, hr; 83 u32 sec, min, hr;
@@ -341,6 +349,8 @@ acpi_system_write_alarm(struct file *file,
341 end: 349 end:
342 return_VALUE(result ? result : count); 350 return_VALUE(result ? result : count);
343} 351}
352#endif /* HAVE_ACPI_LEGACY_ALARM */
353
344 354
345extern struct list_head acpi_wakeup_device_list; 355extern struct list_head acpi_wakeup_device_list;
346extern spinlock_t acpi_device_lock; 356extern spinlock_t acpi_device_lock;
@@ -350,21 +360,31 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
350{ 360{
351 struct list_head *node, *next; 361 struct list_head *node, *next;
352 362
353 seq_printf(seq, "Device Sleep state Status\n"); 363 seq_printf(seq, "Device\tS-state\t Status Sysfs node\n");
354 364
355 spin_lock(&acpi_device_lock); 365 spin_lock(&acpi_device_lock);
356 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 366 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
357 struct acpi_device *dev = 367 struct acpi_device *dev =
358 container_of(node, struct acpi_device, wakeup_list); 368 container_of(node, struct acpi_device, wakeup_list);
369 struct device *ldev;
359 370
360 if (!dev->wakeup.flags.valid) 371 if (!dev->wakeup.flags.valid)
361 continue; 372 continue;
362 spin_unlock(&acpi_device_lock); 373 spin_unlock(&acpi_device_lock);
363 seq_printf(seq, "%4s %4d %s%8s\n", 374
375 ldev = acpi_get_physical_device(dev->handle);
376 seq_printf(seq, "%s\t S%d\t%c%-8s ",
364 dev->pnp.bus_id, 377 dev->pnp.bus_id,
365 (u32) dev->wakeup.sleep_state, 378 (u32) dev->wakeup.sleep_state,
366 dev->wakeup.flags.run_wake ? "*" : "", 379 dev->wakeup.flags.run_wake ? '*' : ' ',
367 dev->wakeup.state.enabled ? "enabled" : "disabled"); 380 dev->wakeup.state.enabled ? "enabled" : "disabled");
381 if (ldev)
382 seq_printf(seq, "%s:%s",
383 ldev->bus ? ldev->bus->name : "no-bus",
384 ldev->bus_id);
385 seq_printf(seq, "\n");
386 put_device(ldev);
387
368 spin_lock(&acpi_device_lock); 388 spin_lock(&acpi_device_lock);
369 } 389 }
370 spin_unlock(&acpi_device_lock); 390 spin_unlock(&acpi_device_lock);
@@ -454,6 +474,7 @@ static const struct file_operations acpi_system_sleep_fops = {
454}; 474};
455#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ 475#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */
456 476
477#ifdef HAVE_ACPI_LEGACY_ALARM
457static const struct file_operations acpi_system_alarm_fops = { 478static const struct file_operations acpi_system_alarm_fops = {
458 .open = acpi_system_alarm_open_fs, 479 .open = acpi_system_alarm_open_fs,
459 .read = seq_read, 480 .read = seq_read,
@@ -469,8 +490,9 @@ static u32 rtc_handler(void *context)
469 490
470 return ACPI_INTERRUPT_HANDLED; 491 return ACPI_INTERRUPT_HANDLED;
471} 492}
493#endif /* HAVE_ACPI_LEGACY_ALARM */
472 494
473static int acpi_sleep_proc_init(void) 495static int __init acpi_sleep_proc_init(void)
474{ 496{
475 struct proc_dir_entry *entry = NULL; 497 struct proc_dir_entry *entry = NULL;
476 498
@@ -486,6 +508,7 @@ static int acpi_sleep_proc_init(void)
486 entry->proc_fops = &acpi_system_sleep_fops; 508 entry->proc_fops = &acpi_system_sleep_fops;
487#endif 509#endif
488 510
511#ifdef HAVE_ACPI_LEGACY_ALARM
489 /* 'alarm' [R/W] */ 512 /* 'alarm' [R/W] */
490 entry = 513 entry =
491 create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR, 514 create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR,
@@ -493,6 +516,9 @@ static int acpi_sleep_proc_init(void)
493 if (entry) 516 if (entry)
494 entry->proc_fops = &acpi_system_alarm_fops; 517 entry->proc_fops = &acpi_system_alarm_fops;
495 518
519 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
520#endif /* HAVE_ACPI_LEGACY_ALARM */
521
496 /* 'wakeup device' [R/W] */ 522 /* 'wakeup device' [R/W] */
497 entry = 523 entry =
498 create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR, 524 create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR,
@@ -500,7 +526,6 @@ static int acpi_sleep_proc_init(void)
500 if (entry) 526 if (entry)
501 entry->proc_fops = &acpi_system_wakeup_device_fops; 527 entry->proc_fops = &acpi_system_wakeup_device_fops;
502 528
503 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
504 return 0; 529 return 0;
505} 530}
506 531