aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r--drivers/acpi/sleep.c89
1 files changed, 53 insertions, 36 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 2fcc67d34b11..277aa825edd9 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -386,6 +386,8 @@ static void acpi_pm_finish(void)
386 386
387 acpi_target_sleep_state = ACPI_STATE_S0; 387 acpi_target_sleep_state = ACPI_STATE_S0;
388 388
389 acpi_resume_power_resources();
390
389 /* If we were woken with the fixed power button, provide a small 391 /* If we were woken with the fixed power button, provide a small
390 * hint to userspace in the form of a wakeup event on the fixed power 392 * hint to userspace in the form of a wakeup event on the fixed power
391 * button device (if it can be found). 393 * button device (if it can be found).
@@ -577,7 +579,28 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = {
577 .end = acpi_pm_end, 579 .end = acpi_pm_end,
578 .recover = acpi_pm_finish, 580 .recover = acpi_pm_finish,
579}; 581};
580#endif /* CONFIG_SUSPEND */ 582
583static void acpi_sleep_suspend_setup(void)
584{
585 int i;
586
587 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
588 acpi_status status;
589 u8 type_a, type_b;
590
591 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
592 if (ACPI_SUCCESS(status)) {
593 sleep_states[i] = 1;
594 pr_cont(" S%d", i);
595 }
596 }
597
598 suspend_set_ops(old_suspend_ordering ?
599 &acpi_suspend_ops_old : &acpi_suspend_ops);
600}
601#else /* !CONFIG_SUSPEND */
602static inline void acpi_sleep_suspend_setup(void) {}
603#endif /* !CONFIG_SUSPEND */
581 604
582#ifdef CONFIG_HIBERNATION 605#ifdef CONFIG_HIBERNATION
583static unsigned long s4_hardware_signature; 606static unsigned long s4_hardware_signature;
@@ -698,7 +721,30 @@ static const struct platform_hibernation_ops acpi_hibernation_ops_old = {
698 .restore_cleanup = acpi_pm_thaw, 721 .restore_cleanup = acpi_pm_thaw,
699 .recover = acpi_pm_finish, 722 .recover = acpi_pm_finish,
700}; 723};
701#endif /* CONFIG_HIBERNATION */ 724
725static void acpi_sleep_hibernate_setup(void)
726{
727 acpi_status status;
728 u8 type_a, type_b;
729
730 status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
731 if (ACPI_FAILURE(status))
732 return;
733
734 hibernation_set_ops(old_suspend_ordering ?
735 &acpi_hibernation_ops_old : &acpi_hibernation_ops);
736 sleep_states[ACPI_STATE_S4] = 1;
737 pr_cont(KERN_CONT " S4");
738 if (nosigcheck)
739 return;
740
741 acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs);
742 if (facs)
743 s4_hardware_signature = facs->hardware_signature;
744}
745#else /* !CONFIG_HIBERNATION */
746static inline void acpi_sleep_hibernate_setup(void) {}
747#endif /* !CONFIG_HIBERNATION */
702 748
703int acpi_suspend(u32 acpi_state) 749int acpi_suspend(u32 acpi_state)
704{ 750{
@@ -734,9 +780,6 @@ int __init acpi_sleep_init(void)
734{ 780{
735 acpi_status status; 781 acpi_status status;
736 u8 type_a, type_b; 782 u8 type_a, type_b;
737#ifdef CONFIG_SUSPEND
738 int i = 0;
739#endif
740 783
741 if (acpi_disabled) 784 if (acpi_disabled)
742 return 0; 785 return 0;
@@ -744,45 +787,19 @@ int __init acpi_sleep_init(void)
744 acpi_sleep_dmi_check(); 787 acpi_sleep_dmi_check();
745 788
746 sleep_states[ACPI_STATE_S0] = 1; 789 sleep_states[ACPI_STATE_S0] = 1;
747 printk(KERN_INFO PREFIX "(supports S0"); 790 pr_info(PREFIX "(supports S0");
748 791
749#ifdef CONFIG_SUSPEND 792 acpi_sleep_suspend_setup();
750 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) { 793 acpi_sleep_hibernate_setup();
751 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
752 if (ACPI_SUCCESS(status)) {
753 sleep_states[i] = 1;
754 printk(KERN_CONT " S%d", i);
755 }
756 }
757 794
758 suspend_set_ops(old_suspend_ordering ?
759 &acpi_suspend_ops_old : &acpi_suspend_ops);
760#endif
761
762#ifdef CONFIG_HIBERNATION
763 status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
764 if (ACPI_SUCCESS(status)) {
765 hibernation_set_ops(old_suspend_ordering ?
766 &acpi_hibernation_ops_old : &acpi_hibernation_ops);
767 sleep_states[ACPI_STATE_S4] = 1;
768 printk(KERN_CONT " S4");
769 if (!nosigcheck) {
770 acpi_get_table(ACPI_SIG_FACS, 1,
771 (struct acpi_table_header **)&facs);
772 if (facs)
773 s4_hardware_signature =
774 facs->hardware_signature;
775 }
776 }
777#endif
778 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); 795 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
779 if (ACPI_SUCCESS(status)) { 796 if (ACPI_SUCCESS(status)) {
780 sleep_states[ACPI_STATE_S5] = 1; 797 sleep_states[ACPI_STATE_S5] = 1;
781 printk(KERN_CONT " S5"); 798 pr_cont(" S5");
782 pm_power_off_prepare = acpi_power_off_prepare; 799 pm_power_off_prepare = acpi_power_off_prepare;
783 pm_power_off = acpi_power_off; 800 pm_power_off = acpi_power_off;
784 } 801 }
785 printk(KERN_CONT ")\n"); 802 pr_cont(")\n");
786 /* 803 /*
787 * Register the tts_notifier to reboot notifier list so that the _TTS 804 * Register the tts_notifier to reboot notifier list so that the _TTS
788 * object can also be evaluated when the system enters S5. 805 * object can also be evaluated when the system enters S5.