aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/sleep.c87
1 files changed, 51 insertions, 36 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 4ef0328579cc..277aa825edd9 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -579,7 +579,28 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = {
579 .end = acpi_pm_end, 579 .end = acpi_pm_end,
580 .recover = acpi_pm_finish, 580 .recover = acpi_pm_finish,
581}; 581};
582#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 */
583 604
584#ifdef CONFIG_HIBERNATION 605#ifdef CONFIG_HIBERNATION
585static unsigned long s4_hardware_signature; 606static unsigned long s4_hardware_signature;
@@ -700,7 +721,30 @@ static const struct platform_hibernation_ops acpi_hibernation_ops_old = {
700 .restore_cleanup = acpi_pm_thaw, 721 .restore_cleanup = acpi_pm_thaw,
701 .recover = acpi_pm_finish, 722 .recover = acpi_pm_finish,
702}; 723};
703#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 */
704 748
705int acpi_suspend(u32 acpi_state) 749int acpi_suspend(u32 acpi_state)
706{ 750{
@@ -736,9 +780,6 @@ int __init acpi_sleep_init(void)
736{ 780{
737 acpi_status status; 781 acpi_status status;
738 u8 type_a, type_b; 782 u8 type_a, type_b;
739#ifdef CONFIG_SUSPEND
740 int i = 0;
741#endif
742 783
743 if (acpi_disabled) 784 if (acpi_disabled)
744 return 0; 785 return 0;
@@ -746,45 +787,19 @@ int __init acpi_sleep_init(void)
746 acpi_sleep_dmi_check(); 787 acpi_sleep_dmi_check();
747 788
748 sleep_states[ACPI_STATE_S0] = 1; 789 sleep_states[ACPI_STATE_S0] = 1;
749 printk(KERN_INFO PREFIX "(supports S0"); 790 pr_info(PREFIX "(supports S0");
750 791
751#ifdef CONFIG_SUSPEND 792 acpi_sleep_suspend_setup();
752 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) { 793 acpi_sleep_hibernate_setup();
753 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
754 if (ACPI_SUCCESS(status)) {
755 sleep_states[i] = 1;
756 printk(KERN_CONT " S%d", i);
757 }
758 }
759 794
760 suspend_set_ops(old_suspend_ordering ?
761 &acpi_suspend_ops_old : &acpi_suspend_ops);
762#endif
763
764#ifdef CONFIG_HIBERNATION
765 status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
766 if (ACPI_SUCCESS(status)) {
767 hibernation_set_ops(old_suspend_ordering ?
768 &acpi_hibernation_ops_old : &acpi_hibernation_ops);
769 sleep_states[ACPI_STATE_S4] = 1;
770 printk(KERN_CONT " S4");
771 if (!nosigcheck) {
772 acpi_get_table(ACPI_SIG_FACS, 1,
773 (struct acpi_table_header **)&facs);
774 if (facs)
775 s4_hardware_signature =
776 facs->hardware_signature;
777 }
778 }
779#endif
780 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);
781 if (ACPI_SUCCESS(status)) { 796 if (ACPI_SUCCESS(status)) {
782 sleep_states[ACPI_STATE_S5] = 1; 797 sleep_states[ACPI_STATE_S5] = 1;
783 printk(KERN_CONT " S5"); 798 pr_cont(" S5");
784 pm_power_off_prepare = acpi_power_off_prepare; 799 pm_power_off_prepare = acpi_power_off_prepare;
785 pm_power_off = acpi_power_off; 800 pm_power_off = acpi_power_off;
786 } 801 }
787 printk(KERN_CONT ")\n"); 802 pr_cont(")\n");
788 /* 803 /*
789 * 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
790 * object can also be evaluated when the system enters S5. 805 * object can also be evaluated when the system enters S5.