]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * sleep.c - ACPI sleep support. | |
3 | * | |
e2a5b420 | 4 | * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> |
1da177e4 LT |
5 | * Copyright (c) 2004 David Shaohua Li <shaohua.li@intel.com> |
6 | * Copyright (c) 2000-2003 Patrick Mochel | |
7 | * Copyright (c) 2003 Open Source Development Lab | |
8 | * | |
9 | * This file is released under the GPLv2. | |
10 | * | |
11 | */ | |
12 | ||
13 | #include <linux/delay.h> | |
14 | #include <linux/irq.h> | |
15 | #include <linux/dmi.h> | |
16 | #include <linux/device.h> | |
17 | #include <linux/suspend.h> | |
f216cc37 AS |
18 | |
19 | #include <asm/io.h> | |
20 | ||
1da177e4 LT |
21 | #include <acpi/acpi_bus.h> |
22 | #include <acpi/acpi_drivers.h> | |
23 | #include "sleep.h" | |
24 | ||
25 | u8 sleep_states[ACPI_S_STATE_COUNT]; | |
26 | ||
853298bc | 27 | #ifdef CONFIG_PM_SLEEP |
296699de | 28 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; |
853298bc | 29 | #endif |
296699de | 30 | |
c9b6c8f6 | 31 | static int acpi_sleep_prepare(u32 acpi_state) |
2f3f2226 AS |
32 | { |
33 | #ifdef CONFIG_ACPI_SLEEP | |
34 | /* do we have a wakeup address for S2 and S3? */ | |
35 | if (acpi_state == ACPI_STATE_S3) { | |
36 | if (!acpi_wakeup_address) { | |
37 | return -EFAULT; | |
38 | } | |
4b4f7280 PA |
39 | acpi_set_firmware_waking_vector( |
40 | (acpi_physical_address)acpi_wakeup_address); | |
2f3f2226 AS |
41 | |
42 | } | |
43 | ACPI_FLUSH_CPU_CACHE(); | |
44 | acpi_enable_wakeup_device_prep(acpi_state); | |
45 | #endif | |
c9b6c8f6 RW |
46 | printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n", |
47 | acpi_state); | |
2f3f2226 AS |
48 | acpi_enter_sleep_state_prep(acpi_state); |
49 | return 0; | |
50 | } | |
51 | ||
296699de | 52 | #ifdef CONFIG_SUSPEND |
2c6e33c3 | 53 | static struct platform_suspend_ops acpi_suspend_ops; |
1da177e4 | 54 | |
1da177e4 LT |
55 | extern void do_suspend_lowlevel(void); |
56 | ||
57 | static u32 acpi_suspend_states[] = { | |
e2a5b420 AS |
58 | [PM_SUSPEND_ON] = ACPI_STATE_S0, |
59 | [PM_SUSPEND_STANDBY] = ACPI_STATE_S1, | |
60 | [PM_SUSPEND_MEM] = ACPI_STATE_S3, | |
e2a5b420 | 61 | [PM_SUSPEND_MAX] = ACPI_STATE_S5 |
1da177e4 LT |
62 | }; |
63 | ||
64 | static int init_8259A_after_S1; | |
65 | ||
e9b3aba8 | 66 | /** |
2c6e33c3 | 67 | * acpi_suspend_begin - Set the target system sleep state to the state |
e9b3aba8 RW |
68 | * associated with given @pm_state, if supported. |
69 | */ | |
70 | ||
2c6e33c3 | 71 | static int acpi_suspend_begin(suspend_state_t pm_state) |
e9b3aba8 RW |
72 | { |
73 | u32 acpi_state = acpi_suspend_states[pm_state]; | |
74 | int error = 0; | |
75 | ||
76 | if (sleep_states[acpi_state]) { | |
77 | acpi_target_sleep_state = acpi_state; | |
78 | } else { | |
79 | printk(KERN_ERR "ACPI does not support this state: %d\n", | |
80 | pm_state); | |
81 | error = -ENOSYS; | |
82 | } | |
83 | return error; | |
84 | } | |
85 | ||
1da177e4 | 86 | /** |
2c6e33c3 | 87 | * acpi_suspend_prepare - Do preliminary suspend work. |
1da177e4 | 88 | * |
e9b3aba8 RW |
89 | * If necessary, set the firmware waking vector and do arch-specific |
90 | * nastiness to get the wakeup code to the waking vector. | |
1da177e4 LT |
91 | */ |
92 | ||
2c6e33c3 | 93 | static int acpi_suspend_prepare(void) |
1da177e4 | 94 | { |
7731ce63 | 95 | int error = acpi_sleep_prepare(acpi_target_sleep_state); |
1da177e4 | 96 | |
7731ce63 RW |
97 | if (error) { |
98 | acpi_target_sleep_state = ACPI_STATE_S0; | |
99 | return error; | |
60417f59 | 100 | } |
e9b3aba8 | 101 | |
60417f59 | 102 | return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT; |
1da177e4 LT |
103 | } |
104 | ||
1da177e4 | 105 | /** |
2c6e33c3 | 106 | * acpi_suspend_enter - Actually enter a sleep state. |
e9b3aba8 | 107 | * @pm_state: ignored |
1da177e4 | 108 | * |
50ad147a RW |
109 | * Flush caches and go to sleep. For STR we have to call arch-specific |
110 | * assembly, which in turn call acpi_enter_sleep_state(). | |
1da177e4 LT |
111 | * It's unfortunate, but it works. Please fix if you're feeling frisky. |
112 | */ | |
113 | ||
2c6e33c3 | 114 | static int acpi_suspend_enter(suspend_state_t pm_state) |
1da177e4 LT |
115 | { |
116 | acpi_status status = AE_OK; | |
117 | unsigned long flags = 0; | |
e9b3aba8 | 118 | u32 acpi_state = acpi_target_sleep_state; |
1da177e4 LT |
119 | |
120 | ACPI_FLUSH_CPU_CACHE(); | |
121 | ||
122 | /* Do arch specific saving of state. */ | |
50ad147a | 123 | if (acpi_state == ACPI_STATE_S3) { |
1da177e4 | 124 | int error = acpi_save_state_mem(); |
e9b3aba8 | 125 | |
60417f59 | 126 | if (error) |
1da177e4 LT |
127 | return error; |
128 | } | |
129 | ||
1da177e4 LT |
130 | local_irq_save(flags); |
131 | acpi_enable_wakeup_device(acpi_state); | |
e9b3aba8 RW |
132 | switch (acpi_state) { |
133 | case ACPI_STATE_S1: | |
1da177e4 LT |
134 | barrier(); |
135 | status = acpi_enter_sleep_state(acpi_state); | |
136 | break; | |
137 | ||
e9b3aba8 | 138 | case ACPI_STATE_S3: |
1da177e4 LT |
139 | do_suspend_lowlevel(); |
140 | break; | |
1da177e4 | 141 | } |
872d83d0 | 142 | |
c95d47a8 RW |
143 | /* Reprogram control registers and execute _BFS */ |
144 | acpi_leave_sleep_state_prep(acpi_state); | |
145 | ||
23b168d4 | 146 | /* ACPI 3.0 specs (P62) says that it's the responsibility |
872d83d0 AP |
147 | * of the OSPM to clear the status bit [ implying that the |
148 | * POWER_BUTTON event should not reach userspace ] | |
149 | */ | |
150 | if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) | |
151 | acpi_clear_event(ACPI_EVENT_POWER_BUTTON); | |
152 | ||
a3627f67 SL |
153 | /* |
154 | * Disable and clear GPE status before interrupt is enabled. Some GPEs | |
155 | * (like wakeup GPE) haven't handler, this can avoid such GPE misfire. | |
156 | * acpi_leave_sleep_state will reenable specific GPEs later | |
157 | */ | |
158 | acpi_hw_disable_all_gpes(); | |
159 | ||
1da177e4 LT |
160 | local_irq_restore(flags); |
161 | printk(KERN_DEBUG "Back to C!\n"); | |
162 | ||
e9b3aba8 | 163 | /* restore processor state */ |
50ad147a | 164 | if (acpi_state == ACPI_STATE_S3) |
1da177e4 LT |
165 | acpi_restore_state_mem(); |
166 | ||
1da177e4 LT |
167 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
168 | } | |
169 | ||
1da177e4 | 170 | /** |
2c6e33c3 | 171 | * acpi_suspend_finish - Instruct the platform to leave a sleep state. |
1da177e4 LT |
172 | * |
173 | * This is called after we wake back up (or if entering the sleep state | |
174 | * failed). | |
175 | */ | |
176 | ||
2c6e33c3 | 177 | static void acpi_suspend_finish(void) |
1da177e4 | 178 | { |
e9b3aba8 | 179 | u32 acpi_state = acpi_target_sleep_state; |
1da177e4 | 180 | |
1da177e4 | 181 | acpi_disable_wakeup_device(acpi_state); |
1dbc1fda | 182 | acpi_leave_sleep_state(acpi_state); |
1da177e4 LT |
183 | |
184 | /* reset firmware waking vector */ | |
185 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | |
186 | ||
e9b3aba8 RW |
187 | acpi_target_sleep_state = ACPI_STATE_S0; |
188 | ||
e8b2fd01 | 189 | #ifdef CONFIG_X86 |
1da177e4 LT |
190 | if (init_8259A_after_S1) { |
191 | printk("Broken toshiba laptop -> kicking interrupts\n"); | |
192 | init_8259A(0); | |
193 | } | |
e8b2fd01 | 194 | #endif |
1da177e4 LT |
195 | } |
196 | ||
c697eece | 197 | /** |
2c6e33c3 | 198 | * acpi_suspend_end - Finish up suspend sequence. |
c697eece RW |
199 | */ |
200 | ||
2c6e33c3 | 201 | static void acpi_suspend_end(void) |
c697eece RW |
202 | { |
203 | /* | |
2c6e33c3 | 204 | * This is necessary in case acpi_suspend_finish() is not called during a |
7731ce63 | 205 | * failing transition to a sleep state. |
c697eece | 206 | */ |
7731ce63 | 207 | acpi_target_sleep_state = ACPI_STATE_S0; |
c697eece RW |
208 | } |
209 | ||
2c6e33c3 | 210 | static int acpi_suspend_state_valid(suspend_state_t pm_state) |
eb9289eb | 211 | { |
e8c9c502 | 212 | u32 acpi_state; |
eb9289eb | 213 | |
e8c9c502 JB |
214 | switch (pm_state) { |
215 | case PM_SUSPEND_ON: | |
216 | case PM_SUSPEND_STANDBY: | |
217 | case PM_SUSPEND_MEM: | |
218 | acpi_state = acpi_suspend_states[pm_state]; | |
219 | ||
220 | return sleep_states[acpi_state]; | |
221 | default: | |
222 | return 0; | |
223 | } | |
eb9289eb SL |
224 | } |
225 | ||
2c6e33c3 LB |
226 | static struct platform_suspend_ops acpi_suspend_ops = { |
227 | .valid = acpi_suspend_state_valid, | |
228 | .begin = acpi_suspend_begin, | |
229 | .prepare = acpi_suspend_prepare, | |
230 | .enter = acpi_suspend_enter, | |
231 | .finish = acpi_suspend_finish, | |
232 | .end = acpi_suspend_end, | |
1da177e4 LT |
233 | }; |
234 | ||
296699de RW |
235 | /* |
236 | * Toshiba fails to preserve interrupts over S1, reinitialization | |
237 | * of 8259 is needed after S1 resume. | |
238 | */ | |
1855256c | 239 | static int __init init_ints_after_s1(const struct dmi_system_id *d) |
296699de RW |
240 | { |
241 | printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); | |
242 | init_8259A_after_S1 = 1; | |
243 | return 0; | |
244 | } | |
245 | ||
246 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |
247 | { | |
248 | .callback = init_ints_after_s1, | |
249 | .ident = "Toshiba Satellite 4030cdt", | |
250 | .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),}, | |
251 | }, | |
252 | {}, | |
253 | }; | |
254 | #endif /* CONFIG_SUSPEND */ | |
255 | ||
b0cb1a19 | 256 | #ifdef CONFIG_HIBERNATION |
caea99ef | 257 | static int acpi_hibernation_begin(void) |
74f270af RW |
258 | { |
259 | acpi_target_sleep_state = ACPI_STATE_S4; | |
7258ec5d | 260 | |
7731ce63 | 261 | return 0; |
74f270af RW |
262 | } |
263 | ||
a3d25c27 RW |
264 | static int acpi_hibernation_prepare(void) |
265 | { | |
7731ce63 | 266 | int error = acpi_sleep_prepare(ACPI_STATE_S4); |
3c1d2b60 | 267 | |
7731ce63 RW |
268 | if (error) { |
269 | acpi_target_sleep_state = ACPI_STATE_S0; | |
270 | return error; | |
7258ec5d | 271 | } |
3c1d2b60 | 272 | |
7258ec5d | 273 | return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT; |
a3d25c27 RW |
274 | } |
275 | ||
276 | static int acpi_hibernation_enter(void) | |
277 | { | |
278 | acpi_status status = AE_OK; | |
279 | unsigned long flags = 0; | |
280 | ||
281 | ACPI_FLUSH_CPU_CACHE(); | |
282 | ||
283 | local_irq_save(flags); | |
284 | acpi_enable_wakeup_device(ACPI_STATE_S4); | |
285 | /* This shouldn't return. If it returns, we have a problem */ | |
286 | status = acpi_enter_sleep_state(ACPI_STATE_S4); | |
c95d47a8 RW |
287 | /* Reprogram control registers and execute _BFS */ |
288 | acpi_leave_sleep_state_prep(ACPI_STATE_S4); | |
a3d25c27 RW |
289 | local_irq_restore(flags); |
290 | ||
291 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | |
292 | } | |
293 | ||
c7e0831d RW |
294 | static void acpi_hibernation_leave(void) |
295 | { | |
296 | /* | |
297 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to | |
298 | * enable it here. | |
299 | */ | |
300 | acpi_enable(); | |
c95d47a8 RW |
301 | /* Reprogram control registers and execute _BFS */ |
302 | acpi_leave_sleep_state_prep(ACPI_STATE_S4); | |
c7e0831d RW |
303 | } |
304 | ||
a3d25c27 RW |
305 | static void acpi_hibernation_finish(void) |
306 | { | |
a3d25c27 | 307 | acpi_disable_wakeup_device(ACPI_STATE_S4); |
1dbc1fda | 308 | acpi_leave_sleep_state(ACPI_STATE_S4); |
a3d25c27 RW |
309 | |
310 | /* reset firmware waking vector */ | |
311 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | |
74f270af RW |
312 | |
313 | acpi_target_sleep_state = ACPI_STATE_S0; | |
a3d25c27 RW |
314 | } |
315 | ||
caea99ef RW |
316 | static void acpi_hibernation_end(void) |
317 | { | |
318 | /* | |
319 | * This is necessary in case acpi_hibernation_finish() is not called | |
7731ce63 | 320 | * during a failing transition to the sleep state. |
caea99ef | 321 | */ |
7731ce63 | 322 | acpi_target_sleep_state = ACPI_STATE_S0; |
caea99ef RW |
323 | } |
324 | ||
a634cc10 RW |
325 | static int acpi_hibernation_pre_restore(void) |
326 | { | |
327 | acpi_status status; | |
328 | ||
329 | status = acpi_hw_disable_all_gpes(); | |
330 | ||
331 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | |
332 | } | |
333 | ||
334 | static void acpi_hibernation_restore_cleanup(void) | |
335 | { | |
336 | acpi_hw_enable_all_runtime_gpes(); | |
337 | } | |
338 | ||
b3dac3b3 | 339 | static struct platform_hibernation_ops acpi_hibernation_ops = { |
caea99ef RW |
340 | .begin = acpi_hibernation_begin, |
341 | .end = acpi_hibernation_end, | |
74f270af RW |
342 | .pre_snapshot = acpi_hibernation_prepare, |
343 | .finish = acpi_hibernation_finish, | |
a3d25c27 RW |
344 | .prepare = acpi_hibernation_prepare, |
345 | .enter = acpi_hibernation_enter, | |
c7e0831d | 346 | .leave = acpi_hibernation_leave, |
a634cc10 RW |
347 | .pre_restore = acpi_hibernation_pre_restore, |
348 | .restore_cleanup = acpi_hibernation_restore_cleanup, | |
a3d25c27 | 349 | }; |
b0cb1a19 | 350 | #endif /* CONFIG_HIBERNATION */ |
a3d25c27 | 351 | |
296699de RW |
352 | int acpi_suspend(u32 acpi_state) |
353 | { | |
354 | suspend_state_t states[] = { | |
355 | [1] = PM_SUSPEND_STANDBY, | |
356 | [3] = PM_SUSPEND_MEM, | |
357 | [5] = PM_SUSPEND_MAX | |
358 | }; | |
359 | ||
360 | if (acpi_state < 6 && states[acpi_state]) | |
361 | return pm_suspend(states[acpi_state]); | |
362 | if (acpi_state == 4) | |
363 | return hibernate(); | |
364 | return -EINVAL; | |
365 | } | |
366 | ||
853298bc | 367 | #ifdef CONFIG_PM_SLEEP |
fd4aff1a SL |
368 | /** |
369 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device | |
370 | * in the system sleep state given by %acpi_target_sleep_state | |
371 | * @dev: device to examine | |
372 | * @wake: if set, the device should be able to wake up the system | |
373 | * @d_min_p: used to store the upper limit of allowed states range | |
374 | * Return value: preferred power state of the device on success, -ENODEV on | |
375 | * failure (ie. if there's no 'struct acpi_device' for @dev) | |
376 | * | |
377 | * Find the lowest power (highest number) ACPI device power state that | |
378 | * device @dev can be in while the system is in the sleep state represented | |
379 | * by %acpi_target_sleep_state. If @wake is nonzero, the device should be | |
380 | * able to wake up the system from this sleep state. If @d_min_p is set, | |
381 | * the highest power (lowest number) device power state of @dev allowed | |
382 | * in this system sleep state is stored at the location pointed to by it. | |
383 | * | |
384 | * The caller must ensure that @dev is valid before using this function. | |
385 | * The caller is also responsible for figuring out if the device is | |
386 | * supposed to be able to wake up the system and passing this information | |
387 | * via @wake. | |
388 | */ | |
389 | ||
390 | int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) | |
391 | { | |
392 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | |
393 | struct acpi_device *adev; | |
394 | char acpi_method[] = "_SxD"; | |
395 | unsigned long d_min, d_max; | |
396 | ||
397 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | |
ead77594 | 398 | printk(KERN_DEBUG "ACPI handle has no context!\n"); |
fd4aff1a SL |
399 | return -ENODEV; |
400 | } | |
401 | ||
402 | acpi_method[2] = '0' + acpi_target_sleep_state; | |
403 | /* | |
404 | * If the sleep state is S0, we will return D3, but if the device has | |
405 | * _S0W, we will use the value from _S0W | |
406 | */ | |
407 | d_min = ACPI_STATE_D0; | |
408 | d_max = ACPI_STATE_D3; | |
409 | ||
410 | /* | |
411 | * If present, _SxD methods return the minimum D-state (highest power | |
412 | * state) we can use for the corresponding S-states. Otherwise, the | |
413 | * minimum D-state is D0 (ACPI 3.x). | |
414 | * | |
415 | * NOTE: We rely on acpi_evaluate_integer() not clobbering the integer | |
416 | * provided -- that's our fault recovery, we ignore retval. | |
417 | */ | |
418 | if (acpi_target_sleep_state > ACPI_STATE_S0) | |
419 | acpi_evaluate_integer(handle, acpi_method, NULL, &d_min); | |
420 | ||
421 | /* | |
422 | * If _PRW says we can wake up the system from the target sleep state, | |
423 | * the D-state returned by _SxD is sufficient for that (we assume a | |
424 | * wakeup-aware driver if wake is set). Still, if _SxW exists | |
425 | * (ACPI 3.x), it should return the maximum (lowest power) D-state that | |
426 | * can wake the system. _S0W may be valid, too. | |
427 | */ | |
428 | if (acpi_target_sleep_state == ACPI_STATE_S0 || | |
429 | (wake && adev->wakeup.state.enabled && | |
430 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { | |
ad3399c3 RW |
431 | acpi_status status; |
432 | ||
fd4aff1a | 433 | acpi_method[3] = 'W'; |
ad3399c3 RW |
434 | status = acpi_evaluate_integer(handle, acpi_method, NULL, |
435 | &d_max); | |
436 | if (ACPI_FAILURE(status)) { | |
437 | d_max = d_min; | |
438 | } else if (d_max < d_min) { | |
439 | /* Warn the user of the broken DSDT */ | |
440 | printk(KERN_WARNING "ACPI: Wrong value from %s\n", | |
441 | acpi_method); | |
442 | /* Sanitize it */ | |
fd4aff1a | 443 | d_min = d_max; |
ad3399c3 | 444 | } |
fd4aff1a SL |
445 | } |
446 | ||
447 | if (d_min_p) | |
448 | *d_min_p = d_min; | |
449 | return d_max; | |
450 | } | |
853298bc | 451 | #endif |
fd4aff1a | 452 | |
f216cc37 AS |
453 | static void acpi_power_off_prepare(void) |
454 | { | |
455 | /* Prepare to power off the system */ | |
456 | acpi_sleep_prepare(ACPI_STATE_S5); | |
3c1d2b60 | 457 | acpi_hw_disable_all_gpes(); |
f216cc37 AS |
458 | } |
459 | ||
460 | static void acpi_power_off(void) | |
461 | { | |
462 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | |
96b2dd1f | 463 | printk("%s called\n", __func__); |
f216cc37 | 464 | local_irq_disable(); |
9c1c6a1b | 465 | acpi_enable_wakeup_device(ACPI_STATE_S5); |
f216cc37 AS |
466 | acpi_enter_sleep_state(ACPI_STATE_S5); |
467 | } | |
468 | ||
aafbcd16 | 469 | int __init acpi_sleep_init(void) |
1da177e4 | 470 | { |
296699de RW |
471 | acpi_status status; |
472 | u8 type_a, type_b; | |
473 | #ifdef CONFIG_SUSPEND | |
e2a5b420 | 474 | int i = 0; |
1da177e4 LT |
475 | |
476 | dmi_check_system(acpisleep_dmi_table); | |
296699de | 477 | #endif |
1da177e4 LT |
478 | |
479 | if (acpi_disabled) | |
480 | return 0; | |
481 | ||
5a50fe70 FP |
482 | sleep_states[ACPI_STATE_S0] = 1; |
483 | printk(KERN_INFO PREFIX "(supports S0"); | |
484 | ||
296699de | 485 | #ifdef CONFIG_SUSPEND |
5a50fe70 | 486 | for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) { |
1da177e4 LT |
487 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); |
488 | if (ACPI_SUCCESS(status)) { | |
489 | sleep_states[i] = 1; | |
490 | printk(" S%d", i); | |
491 | } | |
1da177e4 | 492 | } |
1da177e4 | 493 | |
2c6e33c3 | 494 | suspend_set_ops(&acpi_suspend_ops); |
296699de | 495 | #endif |
a3d25c27 | 496 | |
b0cb1a19 | 497 | #ifdef CONFIG_HIBERNATION |
296699de RW |
498 | status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b); |
499 | if (ACPI_SUCCESS(status)) { | |
a3d25c27 | 500 | hibernation_set_ops(&acpi_hibernation_ops); |
296699de | 501 | sleep_states[ACPI_STATE_S4] = 1; |
f216cc37 | 502 | printk(" S4"); |
296699de | 503 | } |
a3d25c27 | 504 | #endif |
f216cc37 AS |
505 | status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); |
506 | if (ACPI_SUCCESS(status)) { | |
507 | sleep_states[ACPI_STATE_S5] = 1; | |
508 | printk(" S5"); | |
509 | pm_power_off_prepare = acpi_power_off_prepare; | |
510 | pm_power_off = acpi_power_off; | |
511 | } | |
512 | printk(")\n"); | |
1da177e4 LT |
513 | return 0; |
514 | } |