aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/sleep/main.c')
-rw-r--r--drivers/acpi/sleep/main.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index 5055acf2163c..f3d3867303ec 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -44,13 +44,12 @@ int acpi_sleep_prepare(u32 acpi_state)
44 ACPI_FLUSH_CPU_CACHE(); 44 ACPI_FLUSH_CPU_CACHE();
45 acpi_enable_wakeup_device_prep(acpi_state); 45 acpi_enable_wakeup_device_prep(acpi_state);
46#endif 46#endif
47 acpi_gpe_sleep_prepare(acpi_state);
48 acpi_enter_sleep_state_prep(acpi_state); 47 acpi_enter_sleep_state_prep(acpi_state);
49 return 0; 48 return 0;
50} 49}
51 50
52#ifdef CONFIG_SUSPEND 51#ifdef CONFIG_SUSPEND
53static struct pm_ops acpi_pm_ops; 52static struct platform_suspend_ops acpi_pm_ops;
54 53
55extern void do_suspend_lowlevel(void); 54extern void do_suspend_lowlevel(void);
56 55
@@ -85,13 +84,12 @@ static int acpi_pm_set_target(suspend_state_t pm_state)
85 84
86/** 85/**
87 * acpi_pm_prepare - Do preliminary suspend work. 86 * acpi_pm_prepare - Do preliminary suspend work.
88 * @pm_state: ignored
89 * 87 *
90 * If necessary, set the firmware waking vector and do arch-specific 88 * If necessary, set the firmware waking vector and do arch-specific
91 * nastiness to get the wakeup code to the waking vector. 89 * nastiness to get the wakeup code to the waking vector.
92 */ 90 */
93 91
94static int acpi_pm_prepare(suspend_state_t pm_state) 92static int acpi_pm_prepare(void)
95{ 93{
96 int error = acpi_sleep_prepare(acpi_target_sleep_state); 94 int error = acpi_sleep_prepare(acpi_target_sleep_state);
97 95
@@ -160,13 +158,12 @@ static int acpi_pm_enter(suspend_state_t pm_state)
160 158
161/** 159/**
162 * acpi_pm_finish - Finish up suspend sequence. 160 * acpi_pm_finish - Finish up suspend sequence.
163 * @pm_state: ignored
164 * 161 *
165 * This is called after we wake back up (or if entering the sleep state 162 * This is called after we wake back up (or if entering the sleep state
166 * failed). 163 * failed).
167 */ 164 */
168 165
169static int acpi_pm_finish(suspend_state_t pm_state) 166static void acpi_pm_finish(void)
170{ 167{
171 u32 acpi_state = acpi_target_sleep_state; 168 u32 acpi_state = acpi_target_sleep_state;
172 169
@@ -184,7 +181,6 @@ static int acpi_pm_finish(suspend_state_t pm_state)
184 init_8259A(0); 181 init_8259A(0);
185 } 182 }
186#endif 183#endif
187 return 0;
188} 184}
189 185
190static int acpi_pm_state_valid(suspend_state_t pm_state) 186static int acpi_pm_state_valid(suspend_state_t pm_state)
@@ -203,7 +199,7 @@ static int acpi_pm_state_valid(suspend_state_t pm_state)
203 } 199 }
204} 200}
205 201
206static struct pm_ops acpi_pm_ops = { 202static struct platform_suspend_ops acpi_pm_ops = {
207 .valid = acpi_pm_state_valid, 203 .valid = acpi_pm_state_valid,
208 .set_target = acpi_pm_set_target, 204 .set_target = acpi_pm_set_target,
209 .prepare = acpi_pm_prepare, 205 .prepare = acpi_pm_prepare,
@@ -233,6 +229,12 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
233#endif /* CONFIG_SUSPEND */ 229#endif /* CONFIG_SUSPEND */
234 230
235#ifdef CONFIG_HIBERNATION 231#ifdef CONFIG_HIBERNATION
232static int acpi_hibernation_start(void)
233{
234 acpi_target_sleep_state = ACPI_STATE_S4;
235 return 0;
236}
237
236static int acpi_hibernation_prepare(void) 238static int acpi_hibernation_prepare(void)
237{ 239{
238 return acpi_sleep_prepare(ACPI_STATE_S4); 240 return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -254,13 +256,29 @@ static int acpi_hibernation_enter(void)
254 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 256 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
255} 257}
256 258
259static void acpi_hibernation_leave(void)
260{
261 /*
262 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
263 * enable it here.
264 */
265 acpi_enable();
266}
267
257static void acpi_hibernation_finish(void) 268static void acpi_hibernation_finish(void)
258{ 269{
270 /*
271 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
272 * enable it here.
273 */
274 acpi_enable();
259 acpi_leave_sleep_state(ACPI_STATE_S4); 275 acpi_leave_sleep_state(ACPI_STATE_S4);
260 acpi_disable_wakeup_device(ACPI_STATE_S4); 276 acpi_disable_wakeup_device(ACPI_STATE_S4);
261 277
262 /* reset firmware waking vector */ 278 /* reset firmware waking vector */
263 acpi_set_firmware_waking_vector((acpi_physical_address) 0); 279 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
280
281 acpi_target_sleep_state = ACPI_STATE_S0;
264} 282}
265 283
266static int acpi_hibernation_pre_restore(void) 284static int acpi_hibernation_pre_restore(void)
@@ -277,10 +295,13 @@ static void acpi_hibernation_restore_cleanup(void)
277 acpi_hw_enable_all_runtime_gpes(); 295 acpi_hw_enable_all_runtime_gpes();
278} 296}
279 297
280static struct hibernation_ops acpi_hibernation_ops = { 298static struct platform_hibernation_ops acpi_hibernation_ops = {
299 .start = acpi_hibernation_start,
300 .pre_snapshot = acpi_hibernation_prepare,
301 .finish = acpi_hibernation_finish,
281 .prepare = acpi_hibernation_prepare, 302 .prepare = acpi_hibernation_prepare,
282 .enter = acpi_hibernation_enter, 303 .enter = acpi_hibernation_enter,
283 .finish = acpi_hibernation_finish, 304 .leave = acpi_hibernation_leave,
284 .pre_restore = acpi_hibernation_pre_restore, 305 .pre_restore = acpi_hibernation_pre_restore,
285 .restore_cleanup = acpi_hibernation_restore_cleanup, 306 .restore_cleanup = acpi_hibernation_restore_cleanup,
286}; 307};
@@ -417,7 +438,7 @@ int __init acpi_sleep_init(void)
417 } 438 }
418 } 439 }
419 440
420 pm_set_ops(&acpi_pm_ops); 441 suspend_set_ops(&acpi_pm_ops);
421#endif 442#endif
422 443
423#ifdef CONFIG_HIBERNATION 444#ifdef CONFIG_HIBERNATION