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.c97
1 files changed, 61 insertions, 36 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 2fcc67d34b11..6d3a06a629a1 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -177,6 +177,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
177 }, 177 },
178 { 178 {
179 .callback = init_nvs_nosave, 179 .callback = init_nvs_nosave,
180 .ident = "Sony Vaio VGN-FW41E_H",
181 .matches = {
182 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
183 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW41E_H"),
184 },
185 },
186 {
187 .callback = init_nvs_nosave,
180 .ident = "Sony Vaio VGN-FW21E", 188 .ident = "Sony Vaio VGN-FW21E",
181 .matches = { 189 .matches = {
182 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 190 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
@@ -386,6 +394,8 @@ static void acpi_pm_finish(void)
386 394
387 acpi_target_sleep_state = ACPI_STATE_S0; 395 acpi_target_sleep_state = ACPI_STATE_S0;
388 396
397 acpi_resume_power_resources();
398
389 /* If we were woken with the fixed power button, provide a small 399 /* 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 400 * hint to userspace in the form of a wakeup event on the fixed power
391 * button device (if it can be found). 401 * button device (if it can be found).
@@ -577,7 +587,28 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = {
577 .end = acpi_pm_end, 587 .end = acpi_pm_end,
578 .recover = acpi_pm_finish, 588 .recover = acpi_pm_finish,
579}; 589};
580#endif /* CONFIG_SUSPEND */ 590
591static void acpi_sleep_suspend_setup(void)
592{
593 int i;
594
595 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
596 acpi_status status;
597 u8 type_a, type_b;
598
599 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
600 if (ACPI_SUCCESS(status)) {
601 sleep_states[i] = 1;
602 pr_cont(" S%d", i);
603 }
604 }
605
606 suspend_set_ops(old_suspend_ordering ?
607 &acpi_suspend_ops_old : &acpi_suspend_ops);
608}
609#else /* !CONFIG_SUSPEND */
610static inline void acpi_sleep_suspend_setup(void) {}
611#endif /* !CONFIG_SUSPEND */
581 612
582#ifdef CONFIG_HIBERNATION 613#ifdef CONFIG_HIBERNATION
583static unsigned long s4_hardware_signature; 614static unsigned long s4_hardware_signature;
@@ -698,7 +729,30 @@ static const struct platform_hibernation_ops acpi_hibernation_ops_old = {
698 .restore_cleanup = acpi_pm_thaw, 729 .restore_cleanup = acpi_pm_thaw,
699 .recover = acpi_pm_finish, 730 .recover = acpi_pm_finish,
700}; 731};
701#endif /* CONFIG_HIBERNATION */ 732
733static void acpi_sleep_hibernate_setup(void)
734{
735 acpi_status status;
736 u8 type_a, type_b;
737
738 status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
739 if (ACPI_FAILURE(status))
740 return;
741
742 hibernation_set_ops(old_suspend_ordering ?
743 &acpi_hibernation_ops_old : &acpi_hibernation_ops);
744 sleep_states[ACPI_STATE_S4] = 1;
745 pr_cont(KERN_CONT " S4");
746 if (nosigcheck)
747 return;
748
749 acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs);
750 if (facs)
751 s4_hardware_signature = facs->hardware_signature;
752}
753#else /* !CONFIG_HIBERNATION */
754static inline void acpi_sleep_hibernate_setup(void) {}
755#endif /* !CONFIG_HIBERNATION */
702 756
703int acpi_suspend(u32 acpi_state) 757int acpi_suspend(u32 acpi_state)
704{ 758{
@@ -734,9 +788,6 @@ int __init acpi_sleep_init(void)
734{ 788{
735 acpi_status status; 789 acpi_status status;
736 u8 type_a, type_b; 790 u8 type_a, type_b;
737#ifdef CONFIG_SUSPEND
738 int i = 0;
739#endif
740 791
741 if (acpi_disabled) 792 if (acpi_disabled)
742 return 0; 793 return 0;
@@ -744,45 +795,19 @@ int __init acpi_sleep_init(void)
744 acpi_sleep_dmi_check(); 795 acpi_sleep_dmi_check();
745 796
746 sleep_states[ACPI_STATE_S0] = 1; 797 sleep_states[ACPI_STATE_S0] = 1;
747 printk(KERN_INFO PREFIX "(supports S0"); 798 pr_info(PREFIX "(supports S0");
748
749#ifdef CONFIG_SUSPEND
750 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
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 799
758 suspend_set_ops(old_suspend_ordering ? 800 acpi_sleep_suspend_setup();
759 &acpi_suspend_ops_old : &acpi_suspend_ops); 801 acpi_sleep_hibernate_setup();
760#endif
761 802
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); 803 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
779 if (ACPI_SUCCESS(status)) { 804 if (ACPI_SUCCESS(status)) {
780 sleep_states[ACPI_STATE_S5] = 1; 805 sleep_states[ACPI_STATE_S5] = 1;
781 printk(KERN_CONT " S5"); 806 pr_cont(" S5");
782 pm_power_off_prepare = acpi_power_off_prepare; 807 pm_power_off_prepare = acpi_power_off_prepare;
783 pm_power_off = acpi_power_off; 808 pm_power_off = acpi_power_off;
784 } 809 }
785 printk(KERN_CONT ")\n"); 810 pr_cont(")\n");
786 /* 811 /*
787 * Register the tts_notifier to reboot notifier list so that the _TTS 812 * Register the tts_notifier to reboot notifier list so that the _TTS
788 * object can also be evaluated when the system enters S5. 813 * object can also be evaluated when the system enters S5.