diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/sleep/poweroff.c | 15 | ||||
-rw-r--r-- | drivers/acpi/sleep/sleep.h | 2 | ||||
-rw-r--r-- | drivers/acpi/sleep/wakeup.c | 6 |
3 files changed, 13 insertions, 10 deletions
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index af7935a95bcc..47fb4b394eec 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c | |||
@@ -33,9 +33,7 @@ int acpi_sleep_prepare(u32 acpi_state) | |||
33 | ACPI_FLUSH_CPU_CACHE(); | 33 | ACPI_FLUSH_CPU_CACHE(); |
34 | acpi_enable_wakeup_device_prep(acpi_state); | 34 | acpi_enable_wakeup_device_prep(acpi_state); |
35 | #endif | 35 | #endif |
36 | if (acpi_state == ACPI_STATE_S5) { | 36 | acpi_gpe_sleep_prepare(acpi_state); |
37 | acpi_wakeup_gpe_poweroff_prepare(); | ||
38 | } | ||
39 | acpi_enter_sleep_state_prep(acpi_state); | 37 | acpi_enter_sleep_state_prep(acpi_state); |
40 | return 0; | 38 | return 0; |
41 | } | 39 | } |
@@ -53,11 +51,16 @@ void acpi_power_off(void) | |||
53 | 51 | ||
54 | static int acpi_shutdown(struct sys_device *x) | 52 | static int acpi_shutdown(struct sys_device *x) |
55 | { | 53 | { |
56 | if (system_state == SYSTEM_POWER_OFF) { | 54 | switch (system_state) { |
57 | /* Prepare if we are going to power off the system */ | 55 | case SYSTEM_POWER_OFF: |
56 | /* Prepare to power off the system */ | ||
58 | return acpi_sleep_prepare(ACPI_STATE_S5); | 57 | return acpi_sleep_prepare(ACPI_STATE_S5); |
58 | case SYSTEM_SUSPEND_DISK: | ||
59 | /* Prepare to suspend the system to disk */ | ||
60 | return acpi_sleep_prepare(ACPI_STATE_S4); | ||
61 | default: | ||
62 | return 0; | ||
59 | } | 63 | } |
60 | return 0; | ||
61 | } | 64 | } |
62 | 65 | ||
63 | static struct sysdev_class acpi_sysclass = { | 66 | static struct sysdev_class acpi_sysclass = { |
diff --git a/drivers/acpi/sleep/sleep.h b/drivers/acpi/sleep/sleep.h index efd0001c6f05..f3e70397a7d6 100644 --- a/drivers/acpi/sleep/sleep.h +++ b/drivers/acpi/sleep/sleep.h | |||
@@ -5,4 +5,4 @@ extern int acpi_suspend (u32 state); | |||
5 | extern void acpi_enable_wakeup_device_prep(u8 sleep_state); | 5 | extern void acpi_enable_wakeup_device_prep(u8 sleep_state); |
6 | extern void acpi_enable_wakeup_device(u8 sleep_state); | 6 | extern void acpi_enable_wakeup_device(u8 sleep_state); |
7 | extern void acpi_disable_wakeup_device(u8 sleep_state); | 7 | extern void acpi_disable_wakeup_device(u8 sleep_state); |
8 | extern void acpi_wakeup_gpe_poweroff_prepare(void); | 8 | extern void acpi_gpe_sleep_prepare(u32 sleep_state); |
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 4134ed43d026..85df0ceda2a9 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -192,7 +192,7 @@ late_initcall(acpi_wakeup_device_init); | |||
192 | * RUNTIME GPEs, we simply mark all GPES that | 192 | * RUNTIME GPEs, we simply mark all GPES that |
193 | * are not enabled for wakeup from S5 as RUNTIME. | 193 | * are not enabled for wakeup from S5 as RUNTIME. |
194 | */ | 194 | */ |
195 | void acpi_wakeup_gpe_poweroff_prepare(void) | 195 | void acpi_gpe_sleep_prepare(u32 sleep_state) |
196 | { | 196 | { |
197 | struct list_head *node, *next; | 197 | struct list_head *node, *next; |
198 | 198 | ||
@@ -201,8 +201,8 @@ void acpi_wakeup_gpe_poweroff_prepare(void) | |||
201 | struct acpi_device, | 201 | struct acpi_device, |
202 | wakeup_list); | 202 | wakeup_list); |
203 | 203 | ||
204 | /* The GPE can wakeup system from S5, don't touch it */ | 204 | /* The GPE can wakeup system from this state, don't touch it */ |
205 | if ((u32) dev->wakeup.sleep_state == ACPI_STATE_S5) | 205 | if ((u32) dev->wakeup.sleep_state >= sleep_state) |
206 | continue; | 206 | continue; |
207 | /* acpi_set_gpe_type will automatically disable GPE */ | 207 | /* acpi_set_gpe_type will automatically disable GPE */ |
208 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 208 | acpi_set_gpe_type(dev->wakeup.gpe_device, |