diff options
author | Sudeep Holla <Sudeep.Holla@arm.com> | 2016-02-17 07:03:23 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-02-21 18:53:56 -0500 |
commit | 504997cf96fabf67b4768b7a8ca1a1b622abd839 (patch) | |
tree | b28e6c830f8ff61044f6b0974847e5461ae08c91 /drivers/acpi/sleep.c | |
parent | db62fda318a6b9082ee9d230be8b45e56b6545c0 (diff) |
ACPI / sleep: move acpi_processor_sleep to sleep.c
acpi_processor_sleep is neither related nor used by CPUIdle framework.
It's used in system suspend/resume path as a syscore operation. It makes
more sense to move it to acpi/sleep.c where all the S-state transition
(a.k.a. Linux system suspend/hiberate) related code are present.
Also make it depend on CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT so that
it's not compiled on architecture like ARM64 where S-states are not
yet defined in ACPI.
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r-- | drivers/acpi/sleep.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 9cb975200cac..fbfcce3b5227 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/reboot.h> | 19 | #include <linux/reboot.h> |
20 | #include <linux/acpi.h> | 20 | #include <linux/acpi.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/syscore_ops.h> | ||
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
23 | #include <trace/events/power.h> | 24 | #include <trace/events/power.h> |
24 | 25 | ||
@@ -677,6 +678,39 @@ static void acpi_sleep_suspend_setup(void) | |||
677 | static inline void acpi_sleep_suspend_setup(void) {} | 678 | static inline void acpi_sleep_suspend_setup(void) {} |
678 | #endif /* !CONFIG_SUSPEND */ | 679 | #endif /* !CONFIG_SUSPEND */ |
679 | 680 | ||
681 | #ifdef CONFIG_PM_SLEEP | ||
682 | static u32 saved_bm_rld; | ||
683 | |||
684 | static int acpi_save_bm_rld(void) | ||
685 | { | ||
686 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); | ||
687 | return 0; | ||
688 | } | ||
689 | |||
690 | static void acpi_restore_bm_rld(void) | ||
691 | { | ||
692 | u32 resumed_bm_rld = 0; | ||
693 | |||
694 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); | ||
695 | if (resumed_bm_rld == saved_bm_rld) | ||
696 | return; | ||
697 | |||
698 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); | ||
699 | } | ||
700 | |||
701 | static struct syscore_ops acpi_sleep_syscore_ops = { | ||
702 | .suspend = acpi_save_bm_rld, | ||
703 | .resume = acpi_restore_bm_rld, | ||
704 | }; | ||
705 | |||
706 | void acpi_sleep_syscore_init(void) | ||
707 | { | ||
708 | register_syscore_ops(&acpi_sleep_syscore_ops); | ||
709 | } | ||
710 | #else | ||
711 | static inline void acpi_sleep_syscore_init(void) {} | ||
712 | #endif /* CONFIG_PM_SLEEP */ | ||
713 | |||
680 | #ifdef CONFIG_HIBERNATION | 714 | #ifdef CONFIG_HIBERNATION |
681 | static unsigned long s4_hardware_signature; | 715 | static unsigned long s4_hardware_signature; |
682 | static struct acpi_table_facs *facs; | 716 | static struct acpi_table_facs *facs; |
@@ -839,6 +873,7 @@ int __init acpi_sleep_init(void) | |||
839 | 873 | ||
840 | sleep_states[ACPI_STATE_S0] = 1; | 874 | sleep_states[ACPI_STATE_S0] = 1; |
841 | 875 | ||
876 | acpi_sleep_syscore_init(); | ||
842 | acpi_sleep_suspend_setup(); | 877 | acpi_sleep_suspend_setup(); |
843 | acpi_sleep_hibernate_setup(); | 878 | acpi_sleep_hibernate_setup(); |
844 | 879 | ||