blob: 77c517f6f6d05d3e4fe2fd0aedffe172c67cf743 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sleep.c - ACPI sleep support.
3 *
Alexey Starikovskiye2a5b422005-03-18 16:20:46 -05004 * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * 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>
Zhao Yakuie49f7112008-08-12 10:20:22 +080018#include <linux/reboot.h>
H. Peter Anvind1ee4332011-02-14 15:42:46 -080019#include <linux/acpi.h>
Lin Minga2ef5c42012-03-21 10:58:46 +080020#include <linux/module.h>
Alexey Starikovskiyf216cc32007-09-20 21:32:35 +040021
22#include <asm/io.h>
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <acpi/acpi_bus.h>
25#include <acpi/acpi_drivers.h>
Bjorn Helgaase60cc7a2009-03-13 12:08:26 -060026
27#include "internal.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include "sleep.h"
29
Stephen Hemminger01eac602010-10-18 18:47:25 -070030static u8 sleep_states[ACPI_S_STATE_COUNT];
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Zhao Yakuie49f7112008-08-12 10:20:22 +080032static void acpi_sleep_tts_switch(u32 acpi_state)
33{
34 union acpi_object in_arg = { ACPI_TYPE_INTEGER };
35 struct acpi_object_list arg_list = { 1, &in_arg };
36 acpi_status status = AE_OK;
37
38 in_arg.integer.value = acpi_state;
39 status = acpi_evaluate_object(NULL, "\\_TTS", &arg_list, NULL);
40 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
41 /*
42 * OS can't evaluate the _TTS object correctly. Some warning
43 * message will be printed. But it won't break anything.
44 */
45 printk(KERN_NOTICE "Failure in evaluating _TTS object\n");
46 }
47}
48
49static int tts_notify_reboot(struct notifier_block *this,
50 unsigned long code, void *x)
51{
52 acpi_sleep_tts_switch(ACPI_STATE_S5);
53 return NOTIFY_DONE;
54}
55
56static struct notifier_block tts_notifier = {
57 .notifier_call = tts_notify_reboot,
58 .next = NULL,
59 .priority = 0,
60};
61
Rafael J. Wysockic9b6c8f2008-01-08 00:10:57 +010062static int acpi_sleep_prepare(u32 acpi_state)
Alexey Starikovskiy2f3f22262007-09-24 14:33:21 +020063{
64#ifdef CONFIG_ACPI_SLEEP
65 /* do we have a wakeup address for S2 and S3? */
66 if (acpi_state == ACPI_STATE_S3) {
H. Peter Anvin319b6ff2012-05-30 12:33:41 +030067 if (!acpi_wakeup_address)
Alexey Starikovskiy2f3f22262007-09-24 14:33:21 +020068 return -EFAULT;
H. Peter Anvin319b6ff2012-05-30 12:33:41 +030069 acpi_set_firmware_waking_vector(acpi_wakeup_address);
Alexey Starikovskiy2f3f22262007-09-24 14:33:21 +020070
71 }
72 ACPI_FLUSH_CPU_CACHE();
Alexey Starikovskiy2f3f22262007-09-24 14:33:21 +020073#endif
Rafael J. Wysockic9b6c8f2008-01-08 00:10:57 +010074 printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
75 acpi_state);
Rafael J. Wysocki78f5f022010-07-06 22:09:38 -040076 acpi_enable_wakeup_devices(acpi_state);
Alexey Starikovskiy2f3f22262007-09-24 14:33:21 +020077 acpi_enter_sleep_state_prep(acpi_state);
78 return 0;
79}
80
Rafael J. Wysocki5d1e0722008-10-22 14:58:43 -040081#ifdef CONFIG_ACPI_SLEEP
Jan Beulich091aad62010-12-07 14:52:25 +000082static u32 acpi_target_sleep_state = ACPI_STATE_S0;
Rafael J. Wysockia5ca7342012-07-23 21:01:02 +020083static bool pwr_btn_event_pending;
Jan Beulich091aad62010-12-07 14:52:25 +000084
Zhang Ruid7f0eea2009-12-30 15:36:42 +080085/*
Rafael J. Wysocki72ad5d72010-07-23 22:59:09 +020086 * The ACPI specification wants us to save NVS memory regions during hibernation
87 * and to restore them during the subsequent resume. Windows does that also for
88 * suspend to RAM. However, it is known that this mechanism does not work on
89 * all machines, so we allow the user to disable it with the help of the
90 * 'acpi_sleep=nonvs' kernel command line option.
91 */
92static bool nvs_nosave;
93
94void __init acpi_nvs_nosave(void)
95{
96 nvs_nosave = true;
97}
98
99/*
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200100 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
101 * user to request that behavior by using the 'acpi_old_suspend_ordering'
102 * kernel command line option that causes the following variable to be set.
103 */
104static bool old_suspend_ordering;
105
106void __init acpi_old_suspend_ordering(void)
107{
108 old_suspend_ordering = true;
109}
110
111/**
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200112 * acpi_pm_freeze - Disable the GPEs and suspend EC transactions.
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200113 */
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200114static int acpi_pm_freeze(void)
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200115{
Lin Ming3d97e422008-12-16 16:57:46 +0800116 acpi_disable_all_gpes();
Lin Mingbd6f10a2012-05-22 16:43:49 +0800117 acpi_os_wait_events_complete();
Rafael J. Wysockife955682010-04-09 01:40:38 +0200118 acpi_ec_block_transactions();
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200119 return 0;
120}
121
122/**
Rafael J. Wysockic5f7a1b2010-07-02 00:14:09 +0200123 * acpi_pre_suspend - Enable wakeup devices, "freeze" EC and save NVS.
124 */
125static int acpi_pm_pre_suspend(void)
126{
127 acpi_pm_freeze();
Jiri Slaby26fcaf62011-01-07 01:42:31 +0100128 return suspend_nvs_save();
Rafael J. Wysockic5f7a1b2010-07-02 00:14:09 +0200129}
130
131/**
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200132 * __acpi_pm_prepare - Prepare the platform to enter the target state.
133 *
134 * If necessary, set the firmware waking vector and do arch-specific
135 * nastiness to get the wakeup code to the waking vector.
136 */
137static int __acpi_pm_prepare(void)
138{
139 int error = acpi_sleep_prepare(acpi_target_sleep_state);
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200140 if (error)
141 acpi_target_sleep_state = ACPI_STATE_S0;
Rafael J. Wysockic5f7a1b2010-07-02 00:14:09 +0200142
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200143 return error;
144}
145
146/**
147 * acpi_pm_prepare - Prepare the platform to enter the target sleep
148 * state and disable the GPEs.
149 */
150static int acpi_pm_prepare(void)
151{
152 int error = __acpi_pm_prepare();
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200153 if (!error)
Jiri Slaby26fcaf62011-01-07 01:42:31 +0100154 error = acpi_pm_pre_suspend();
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200155
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200156 return error;
157}
158
Daniel Drakec10d7a12012-05-10 00:08:43 +0100159static int find_powerf_dev(struct device *dev, void *data)
160{
161 struct acpi_device *device = to_acpi_device(dev);
162 const char *hid = acpi_device_hid(device);
163
164 return !strcmp(hid, ACPI_BUTTON_HID_POWERF);
165}
166
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200167/**
168 * acpi_pm_finish - Instruct the platform to leave a sleep state.
169 *
170 * This is called after we wake back up (or if entering the sleep state
171 * failed).
172 */
173static void acpi_pm_finish(void)
174{
Daniel Drakec10d7a12012-05-10 00:08:43 +0100175 struct device *pwr_btn_dev;
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200176 u32 acpi_state = acpi_target_sleep_state;
177
Len Brown42de55322010-06-12 01:15:40 -0400178 acpi_ec_unblock_transactions();
Rafael J. Wysockid551d812011-01-19 22:27:55 +0100179 suspend_nvs_free();
Matthew Garrett2a6b6972010-05-28 16:32:15 -0400180
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200181 if (acpi_state == ACPI_STATE_S0)
182 return;
183
184 printk(KERN_INFO PREFIX "Waking up from system sleep state S%d\n",
185 acpi_state);
Rafael J. Wysocki78f5f022010-07-06 22:09:38 -0400186 acpi_disable_wakeup_devices(acpi_state);
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200187 acpi_leave_sleep_state(acpi_state);
188
189 /* reset firmware waking vector */
190 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
191
192 acpi_target_sleep_state = ACPI_STATE_S0;
Daniel Drakec10d7a12012-05-10 00:08:43 +0100193
194 /* If we were woken with the fixed power button, provide a small
195 * hint to userspace in the form of a wakeup event on the fixed power
196 * button device (if it can be found).
197 *
198 * We delay the event generation til now, as the PM layer requires
199 * timekeeping to be running before we generate events. */
200 if (!pwr_btn_event_pending)
201 return;
202
203 pwr_btn_event_pending = false;
204 pwr_btn_dev = bus_find_device(&acpi_bus_type, NULL, NULL,
205 find_powerf_dev);
206 if (pwr_btn_dev) {
207 pm_wakeup_event(pwr_btn_dev, 0);
208 put_device(pwr_btn_dev);
209 }
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200210}
211
212/**
213 * acpi_pm_end - Finish up suspend sequence.
214 */
215static void acpi_pm_end(void)
216{
217 /*
218 * This is necessary in case acpi_pm_finish() is not called during a
219 * failing transition to a sleep state.
220 */
221 acpi_target_sleep_state = ACPI_STATE_S0;
Zhao Yakuie49f7112008-08-12 10:20:22 +0800222 acpi_sleep_tts_switch(acpi_target_sleep_state);
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200223}
Rafael J. Wysocki92daa7b2008-10-23 21:46:43 +0200224#else /* !CONFIG_ACPI_SLEEP */
225#define acpi_target_sleep_state ACPI_STATE_S0
Rafael J. Wysocki5d1e0722008-10-22 14:58:43 -0400226#endif /* CONFIG_ACPI_SLEEP */
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200227
228#ifdef CONFIG_SUSPEND
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229static u32 acpi_suspend_states[] = {
Alexey Starikovskiye2a5b422005-03-18 16:20:46 -0500230 [PM_SUSPEND_ON] = ACPI_STATE_S0,
231 [PM_SUSPEND_STANDBY] = ACPI_STATE_S1,
232 [PM_SUSPEND_MEM] = ACPI_STATE_S3,
Alexey Starikovskiye2a5b422005-03-18 16:20:46 -0500233 [PM_SUSPEND_MAX] = ACPI_STATE_S5
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234};
235
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200236/**
Len Brown2c6e33c2008-04-23 18:02:52 -0400237 * acpi_suspend_begin - Set the target system sleep state to the state
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200238 * associated with given @pm_state, if supported.
239 */
Len Brown2c6e33c2008-04-23 18:02:52 -0400240static int acpi_suspend_begin(suspend_state_t pm_state)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241{
242 u32 acpi_state = acpi_suspend_states[pm_state];
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200243 int error = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
Rafael J. Wysocki72ad5d72010-07-23 22:59:09 +0200245 error = nvs_nosave ? 0 : suspend_nvs_alloc();
Matthew Garrett2a6b6972010-05-28 16:32:15 -0400246 if (error)
247 return error;
248
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200249 if (sleep_states[acpi_state]) {
250 acpi_target_sleep_state = acpi_state;
Zhao Yakuie49f7112008-08-12 10:20:22 +0800251 acpi_sleep_tts_switch(acpi_target_sleep_state);
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200252 } else {
253 printk(KERN_ERR "ACPI does not support this state: %d\n",
254 pm_state);
255 error = -ENOSYS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 }
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200257 return error;
258}
259
260/**
Len Brown2c6e33c2008-04-23 18:02:52 -0400261 * acpi_suspend_enter - Actually enter a sleep state.
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200262 * @pm_state: ignored
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 *
Rafael J. Wysocki50ad1472007-07-24 11:58:39 +0200264 * Flush caches and go to sleep. For STR we have to call arch-specific
265 * assembly, which in turn call acpi_enter_sleep_state().
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 * It's unfortunate, but it works. Please fix if you're feeling frisky.
267 */
Len Brown2c6e33c2008-04-23 18:02:52 -0400268static int acpi_suspend_enter(suspend_state_t pm_state)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269{
270 acpi_status status = AE_OK;
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200271 u32 acpi_state = acpi_target_sleep_state;
Rafael J. Wysocki979f11b2011-02-08 23:42:09 +0100272 int error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273
274 ACPI_FLUSH_CPU_CACHE();
275
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200276 switch (acpi_state) {
277 case ACPI_STATE_S1:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 barrier();
Len Brown3f6f49c2012-07-26 20:08:54 -0400279 status = acpi_enter_sleep_state(acpi_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280 break;
281
Rafael J. Wysockie9b3aba2007-07-17 22:40:06 +0200282 case ACPI_STATE_S3:
Rafael J. Wysockif1a20032011-02-08 23:42:22 +0100283 error = acpi_suspend_lowlevel();
Rafael J. Wysocki979f11b2011-02-08 23:42:09 +0100284 if (error)
285 return error;
Rafael J. Wysocki7a63f082011-02-08 23:41:57 +0100286 pr_info(PREFIX "Low-level resume complete\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288 }
Arnaud Patard872d83d2006-04-27 05:25:00 -0400289
Matthew Garrettb6dacf62010-05-11 13:49:25 -0400290 /* This violates the spec but is required for bug compatibility. */
291 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
Rafael J. Wysocki65df7842008-11-26 17:53:13 -0500292
Len Brown3f6f49c2012-07-26 20:08:54 -0400293 /* Reprogram control registers */
294 acpi_leave_sleep_state_prep(acpi_state);
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100295
Pavel Machek23b168d2008-02-05 19:27:12 +0100296 /* ACPI 3.0 specs (P62) says that it's the responsibility
Arnaud Patard872d83d2006-04-27 05:25:00 -0400297 * of the OSPM to clear the status bit [ implying that the
298 * POWER_BUTTON event should not reach userspace ]
Daniel Drakec10d7a12012-05-10 00:08:43 +0100299 *
300 * However, we do generate a small hint for userspace in the form of
301 * a wakeup event. We flag this condition for now and generate the
302 * event later, as we're currently too early in resume to be able to
303 * generate wakeup events.
Arnaud Patard872d83d2006-04-27 05:25:00 -0400304 */
Daniel Drakec10d7a12012-05-10 00:08:43 +0100305 if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) {
306 acpi_event_status pwr_btn_status;
307
308 acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status);
309
310 if (pwr_btn_status & ACPI_EVENT_FLAG_SET) {
311 acpi_clear_event(ACPI_EVENT_POWER_BUTTON);
312 /* Flag for later */
313 pwr_btn_event_pending = true;
314 }
315 }
Arnaud Patard872d83d2006-04-27 05:25:00 -0400316
Shaohua Lia3627f62007-06-20 09:17:58 +0800317 /*
318 * Disable and clear GPE status before interrupt is enabled. Some GPEs
319 * (like wakeup GPE) haven't handler, this can avoid such GPE misfire.
320 * acpi_leave_sleep_state will reenable specific GPEs later
321 */
Lin Ming3d97e422008-12-16 16:57:46 +0800322 acpi_disable_all_gpes();
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200323 /* Allow EC transactions to happen. */
Rafael J. Wysockife955682010-04-09 01:40:38 +0200324 acpi_ec_unblock_transactions_early();
Shaohua Lia3627f62007-06-20 09:17:58 +0800325
Matthew Garrett2a6b6972010-05-28 16:32:15 -0400326 suspend_nvs_restore();
327
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
329}
330
Len Brown2c6e33c2008-04-23 18:02:52 -0400331static int acpi_suspend_state_valid(suspend_state_t pm_state)
Shaohua Lieb9289e2005-10-30 15:00:01 -0800332{
Johannes Berge8c9c502007-04-30 15:09:54 -0700333 u32 acpi_state;
Shaohua Lieb9289e2005-10-30 15:00:01 -0800334
Johannes Berge8c9c502007-04-30 15:09:54 -0700335 switch (pm_state) {
336 case PM_SUSPEND_ON:
337 case PM_SUSPEND_STANDBY:
338 case PM_SUSPEND_MEM:
339 acpi_state = acpi_suspend_states[pm_state];
340
341 return sleep_states[acpi_state];
342 default:
343 return 0;
344 }
Shaohua Lieb9289e2005-10-30 15:00:01 -0800345}
346
Lionel Debroux2f55ac02010-11-16 14:14:02 +0100347static const struct platform_suspend_ops acpi_suspend_ops = {
Len Brown2c6e33c2008-04-23 18:02:52 -0400348 .valid = acpi_suspend_state_valid,
349 .begin = acpi_suspend_begin,
Rafael J. Wysocki6a7c7ea2009-04-19 20:08:42 +0200350 .prepare_late = acpi_pm_prepare,
Len Brown2c6e33c2008-04-23 18:02:52 -0400351 .enter = acpi_suspend_enter,
Rafael J. Wysocki618d7fd2010-07-02 00:14:57 +0200352 .wake = acpi_pm_finish,
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200353 .end = acpi_pm_end,
354};
355
356/**
357 * acpi_suspend_begin_old - Set the target system sleep state to the
358 * state associated with given @pm_state, if supported, and
359 * execute the _PTS control method. This function is used if the
360 * pre-ACPI 2.0 suspend ordering has been requested.
361 */
362static int acpi_suspend_begin_old(suspend_state_t pm_state)
363{
364 int error = acpi_suspend_begin(pm_state);
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200365 if (!error)
366 error = __acpi_pm_prepare();
Rafael J. Wysockic5f7a1b2010-07-02 00:14:09 +0200367
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200368 return error;
369}
370
371/*
372 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
373 * been requested.
374 */
Lionel Debroux2f55ac02010-11-16 14:14:02 +0100375static const struct platform_suspend_ops acpi_suspend_ops_old = {
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200376 .valid = acpi_suspend_state_valid,
377 .begin = acpi_suspend_begin_old,
Rafael J. Wysockic5f7a1b2010-07-02 00:14:09 +0200378 .prepare_late = acpi_pm_pre_suspend,
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200379 .enter = acpi_suspend_enter,
Rafael J. Wysocki618d7fd2010-07-02 00:14:57 +0200380 .wake = acpi_pm_finish,
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200381 .end = acpi_pm_end,
382 .recover = acpi_pm_finish,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383};
Carlos Corbachoe41fb7c2008-07-23 21:28:43 -0700384
385static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
386{
387 old_suspend_ordering = true;
388 return 0;
389}
390
Rafael J. Wysocki53998642010-09-24 16:46:14 -0400391static int __init init_nvs_nosave(const struct dmi_system_id *d)
392{
393 acpi_nvs_nosave();
394 return 0;
395}
396
Carlos Corbachoe41fb7c2008-07-23 21:28:43 -0700397static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
398 {
399 .callback = init_old_suspend_ordering,
400 .ident = "Abit KN9 (nForce4 variant)",
401 .matches = {
402 DMI_MATCH(DMI_BOARD_VENDOR, "http://www.abit.com.tw/"),
403 DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"),
404 },
405 },
Rafael J. Wysocki4fb507b2008-10-14 22:54:06 +0200406 {
407 .callback = init_old_suspend_ordering,
408 .ident = "HP xw4600 Workstation",
409 .matches = {
410 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
411 DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
412 },
413 },
Rafael J. Wysocki65df7842008-11-26 17:53:13 -0500414 {
Andy Whitcrofta1404492009-02-11 18:11:22 +0000415 .callback = init_old_suspend_ordering,
416 .ident = "Asus Pundit P1-AH2 (M2N8L motherboard)",
417 .matches = {
418 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."),
419 DMI_MATCH(DMI_BOARD_NAME, "M2N8L"),
420 },
421 },
Zhang Rui45e77982009-03-15 22:13:44 -0400422 {
Zhao Yakui2a9ef8e2009-03-18 16:36:25 +0800423 .callback = init_old_suspend_ordering,
424 .ident = "Panasonic CF51-2L",
425 .matches = {
426 DMI_MATCH(DMI_BOARD_VENDOR,
427 "Matsushita Electric Industrial Co.,Ltd."),
428 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
429 },
430 },
Rafael J. Wysocki53998642010-09-24 16:46:14 -0400431 {
432 .callback = init_nvs_nosave,
Dave Jonesd11c78e2011-10-19 23:15:11 +0200433 .ident = "Sony Vaio VGN-FW21E",
434 .matches = {
435 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
436 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21E"),
437 },
438 },
439 {
440 .callback = init_nvs_nosave,
Dave Jonesddf6ce42011-11-03 00:58:59 +0100441 .ident = "Sony Vaio VPCEB17FX",
442 .matches = {
443 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
444 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB17FX"),
445 },
446 },
447 {
448 .callback = init_nvs_nosave,
Rafael J. Wysocki53998642010-09-24 16:46:14 -0400449 .ident = "Sony Vaio VGN-SR11M",
450 .matches = {
451 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
452 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"),
453 },
454 },
455 {
456 .callback = init_nvs_nosave,
457 .ident = "Everex StepNote Series",
458 .matches = {
459 DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."),
460 DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"),
461 },
462 },
Rafael J. Wysockiaf489312010-10-17 21:01:21 +0200463 {
464 .callback = init_nvs_nosave,
465 .ident = "Sony Vaio VPCEB1Z1E",
466 .matches = {
467 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
468 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"),
469 },
470 },
Rafael J. Wysocki291a73c2010-12-12 21:10:42 +0100471 {
472 .callback = init_nvs_nosave,
473 .ident = "Sony Vaio VGN-NW130D",
474 .matches = {
475 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
476 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"),
477 },
478 },
Rafael J. Wysocki7b330702011-01-06 23:37:01 +0100479 {
480 .callback = init_nvs_nosave,
Lan Tianyu93f77082012-01-21 09:23:56 +0800481 .ident = "Sony Vaio VPCCW29FX",
482 .matches = {
483 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
484 DMI_MATCH(DMI_PRODUCT_NAME, "VPCCW29FX"),
485 },
486 },
487 {
488 .callback = init_nvs_nosave,
Rafael J. Wysocki7b330702011-01-06 23:37:01 +0100489 .ident = "Averatec AV1020-ED2",
490 .matches = {
491 DMI_MATCH(DMI_SYS_VENDOR, "AVERATEC"),
492 DMI_MATCH(DMI_PRODUCT_NAME, "1000 Series"),
493 },
494 },
Zhang Ruibb0c5ed2011-07-30 01:40:48 -0400495 {
496 .callback = init_old_suspend_ordering,
497 .ident = "Asus A8N-SLI DELUXE",
498 .matches = {
499 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
500 DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI DELUXE"),
501 },
502 },
503 {
504 .callback = init_old_suspend_ordering,
505 .ident = "Asus A8N-SLI Premium",
506 .matches = {
507 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
508 DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"),
509 },
510 },
Rafael J. Wysocki89e8ea12011-10-06 20:35:03 +0200511 {
512 .callback = init_nvs_nosave,
513 .ident = "Sony Vaio VGN-SR26GN_P",
514 .matches = {
515 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
516 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR26GN_P"),
517 },
518 },
Bogdan Radulescu731b25a2011-10-06 20:35:12 +0200519 {
520 .callback = init_nvs_nosave,
521 .ident = "Sony Vaio VGN-FW520F",
522 .matches = {
523 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
524 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW520F"),
525 },
526 },
Keng-Yu Lin5a50a7c2011-12-02 00:04:23 +0100527 {
528 .callback = init_nvs_nosave,
529 .ident = "Asus K54C",
530 .matches = {
531 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
532 DMI_MATCH(DMI_PRODUCT_NAME, "K54C"),
533 },
534 },
535 {
536 .callback = init_nvs_nosave,
537 .ident = "Asus K54HR",
538 .matches = {
539 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
540 DMI_MATCH(DMI_PRODUCT_NAME, "K54HR"),
541 },
542 },
Carlos Corbachoe41fb7c2008-07-23 21:28:43 -0700543 {},
544};
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200545#endif /* CONFIG_SUSPEND */
546
Rafael J. Wysockib0cb1a12007-07-29 23:24:36 +0200547#ifdef CONFIG_HIBERNATION
Shaohua Libdfe6b72008-07-23 21:28:41 -0700548static unsigned long s4_hardware_signature;
549static struct acpi_table_facs *facs;
550static bool nosigcheck;
551
552void __init acpi_no_s4_hw_signature(void)
553{
554 nosigcheck = true;
555}
556
Rafael J. Wysockicaea99e2008-01-08 00:08:44 +0100557static int acpi_hibernation_begin(void)
Rafael J. Wysocki74f270a2007-10-18 03:04:42 -0700558{
Rafael J. Wysocki3f4b0ef2008-10-26 20:52:15 +0100559 int error;
560
Rafael J. Wysocki72ad5d72010-07-23 22:59:09 +0200561 error = nvs_nosave ? 0 : suspend_nvs_alloc();
Rafael J. Wysocki3f4b0ef2008-10-26 20:52:15 +0100562 if (!error) {
563 acpi_target_sleep_state = ACPI_STATE_S4;
564 acpi_sleep_tts_switch(acpi_target_sleep_state);
565 }
566
567 return error;
568}
569
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700570static int acpi_hibernation_enter(void)
571{
572 acpi_status status = AE_OK;
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700573
574 ACPI_FLUSH_CPU_CACHE();
575
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700576 /* This shouldn't return. If it returns, we have a problem */
Len Brown3f6f49c2012-07-26 20:08:54 -0400577 status = acpi_enter_sleep_state(ACPI_STATE_S4);
578 /* Reprogram control registers */
579 acpi_leave_sleep_state_prep(ACPI_STATE_S4);
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700580
581 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
582}
583
Rafael J. Wysockic7e08312007-10-18 03:04:55 -0700584static void acpi_hibernation_leave(void)
585{
586 /*
587 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
588 * enable it here.
589 */
590 acpi_enable();
Len Brown3f6f49c2012-07-26 20:08:54 -0400591 /* Reprogram control registers */
592 acpi_leave_sleep_state_prep(ACPI_STATE_S4);
Shaohua Libdfe6b72008-07-23 21:28:41 -0700593 /* Check the hardware signature */
594 if (facs && s4_hardware_signature != facs->hardware_signature) {
595 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, "
596 "cannot resume!\n");
597 panic("ACPI S4 hardware signature mismatch");
598 }
Rafael J. Wysocki3f4b0ef2008-10-26 20:52:15 +0100599 /* Restore the NVS memory area */
Matthew Garrettdd4c4f12010-05-28 16:32:14 -0400600 suspend_nvs_restore();
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200601 /* Allow EC transactions to happen. */
Rafael J. Wysockife955682010-04-09 01:40:38 +0200602 acpi_ec_unblock_transactions_early();
Rafael J. Wysockic7e08312007-10-18 03:04:55 -0700603}
604
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200605static void acpi_pm_thaw(void)
Rafael J. Wysockif6bb13a2010-03-04 01:52:58 +0100606{
Rafael J. Wysockife955682010-04-09 01:40:38 +0200607 acpi_ec_unblock_transactions();
Lin Ming3d97e422008-12-16 16:57:46 +0800608 acpi_enable_all_runtime_gpes();
Rafael J. Wysockia634cc12007-07-19 01:47:30 -0700609}
610
Lionel Debroux073ef1f2010-11-09 21:48:49 +0100611static const struct platform_hibernation_ops acpi_hibernation_ops = {
Rafael J. Wysockicaea99e2008-01-08 00:08:44 +0100612 .begin = acpi_hibernation_begin,
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200613 .end = acpi_pm_end,
Rafael J. Wysockic5f7a1b2010-07-02 00:14:09 +0200614 .pre_snapshot = acpi_pm_prepare,
Matthew Garrett2a6b6972010-05-28 16:32:15 -0400615 .finish = acpi_pm_finish,
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200616 .prepare = acpi_pm_prepare,
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700617 .enter = acpi_hibernation_enter,
Rafael J. Wysockic7e08312007-10-18 03:04:55 -0700618 .leave = acpi_hibernation_leave,
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200619 .pre_restore = acpi_pm_freeze,
620 .restore_cleanup = acpi_pm_thaw,
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700621};
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200622
623/**
624 * acpi_hibernation_begin_old - Set the target system sleep state to
625 * ACPI_STATE_S4 and execute the _PTS control method. This
626 * function is used if the pre-ACPI 2.0 suspend ordering has been
627 * requested.
628 */
629static int acpi_hibernation_begin_old(void)
630{
Zhao Yakuie49f7112008-08-12 10:20:22 +0800631 int error;
632 /*
633 * The _TTS object should always be evaluated before the _PTS object.
634 * When the old_suspended_ordering is true, the _PTS object is
635 * evaluated in the acpi_sleep_prepare.
636 */
637 acpi_sleep_tts_switch(ACPI_STATE_S4);
638
639 error = acpi_sleep_prepare(ACPI_STATE_S4);
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200640
Rafael J. Wysocki3f4b0ef2008-10-26 20:52:15 +0100641 if (!error) {
Rafael J. Wysocki72ad5d72010-07-23 22:59:09 +0200642 if (!nvs_nosave)
Matthew Garrettdd4c4f12010-05-28 16:32:14 -0400643 error = suspend_nvs_alloc();
Rafael J. Wysocki3f4b0ef2008-10-26 20:52:15 +0100644 if (!error)
645 acpi_target_sleep_state = ACPI_STATE_S4;
646 }
647 return error;
648}
649
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200650/*
651 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
652 * been requested.
653 */
Lionel Debroux073ef1f2010-11-09 21:48:49 +0100654static const struct platform_hibernation_ops acpi_hibernation_ops_old = {
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200655 .begin = acpi_hibernation_begin_old,
656 .end = acpi_pm_end,
Rafael J. Wysockic5f7a1b2010-07-02 00:14:09 +0200657 .pre_snapshot = acpi_pm_pre_suspend,
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200658 .prepare = acpi_pm_freeze,
Matthew Garrett2a6b6972010-05-28 16:32:15 -0400659 .finish = acpi_pm_finish,
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200660 .enter = acpi_hibernation_enter,
661 .leave = acpi_hibernation_leave,
Rafael J. Wysockid5a64512010-04-09 01:39:40 +0200662 .pre_restore = acpi_pm_freeze,
663 .restore_cleanup = acpi_pm_thaw,
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200664 .recover = acpi_pm_finish,
665};
666#endif /* CONFIG_HIBERNATION */
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700667
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200668int acpi_suspend(u32 acpi_state)
669{
670 suspend_state_t states[] = {
671 [1] = PM_SUSPEND_STANDBY,
672 [3] = PM_SUSPEND_MEM,
673 [5] = PM_SUSPEND_MAX
674 };
675
676 if (acpi_state < 6 && states[acpi_state])
677 return pm_suspend(states[acpi_state]);
678 if (acpi_state == 4)
679 return hibernate();
680 return -EINVAL;
681}
682
Rafael J. Wysockiaa338602011-02-11 00:06:54 +0100683#ifdef CONFIG_PM
Shaohua Lifd4aff12007-07-17 22:40:25 +0200684/**
Rafael J. Wysockibdda27f2012-10-26 13:40:04 +0200685 * acpi_pm_device_sleep_state - Get preferred power state of ACPI device.
686 * @dev: Device whose preferred target power state to return.
687 * @d_min_p: Location to store the upper limit of the allowed states range.
688 * @d_max_in: Deepest low-power state to take into consideration.
689 * Return value: Preferred power state of the device on success, -ENODEV
690 * (if there's no 'struct acpi_device' for @dev) or -EINVAL on failure
Shaohua Lifd4aff12007-07-17 22:40:25 +0200691 *
Rafael J. Wysockibdda27f2012-10-26 13:40:04 +0200692 * The caller must ensure that @dev is valid before using this function.
Shaohua Lifd4aff12007-07-17 22:40:25 +0200693 */
Huang Yingee85f542012-06-23 10:23:48 +0800694int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in)
Shaohua Lifd4aff12007-07-17 22:40:25 +0200695{
696 acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
697 struct acpi_device *adev;
Shaohua Lifd4aff12007-07-17 22:40:25 +0200698
699 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
Rafael J. Wysocki86b38322012-11-02 01:40:18 +0100700 dev_dbg(dev, "ACPI handle without context in %s!\n", __func__);
Shaohua Lifd4aff12007-07-17 22:40:25 +0200701 return -ENODEV;
702 }
Rafael J. Wysocki8b713a82012-10-24 02:08:38 +0200703
Rafael J. Wysocki86b38322012-11-02 01:40:18 +0100704 return acpi_device_power_state(dev, adev, acpi_target_sleep_state,
705 d_max_in, d_min_p);
Shaohua Lifd4aff12007-07-17 22:40:25 +0200706}
Lin Ming3bd46600a72012-06-25 16:13:06 +0800707EXPORT_SYMBOL(acpi_pm_device_sleep_state);
Rafael J. Wysockiaa338602011-02-11 00:06:54 +0100708#endif /* CONFIG_PM */
Rafael J. Wysockieb9d0fe2008-07-07 03:34:48 +0200709
Rafael J. Wysockibdda27f2012-10-26 13:40:04 +0200710#ifdef CONFIG_PM_SLEEP
Lin Mingb24e5092012-03-27 15:43:25 +0800711/**
Rafael J. Wysockibdda27f2012-10-26 13:40:04 +0200712 * acpi_pm_device_sleep_wake - Enable or disable device to wake up the system.
713 * @dev: Device to enable/desible to wake up the system from sleep states.
714 * @enable: Whether to enable or disable @dev to wake up the system.
Rafael J. Wysockieb9d0fe2008-07-07 03:34:48 +0200715 */
716int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
717{
718 acpi_handle handle;
719 struct acpi_device *adev;
Rafael J. Wysockidf8db912009-09-08 23:13:49 +0200720 int error;
Rafael J. Wysockieb9d0fe2008-07-07 03:34:48 +0200721
Rafael J. Wysocki0baed8d2009-09-08 23:16:24 +0200722 if (!device_can_wakeup(dev))
Rafael J. Wysockieb9d0fe2008-07-07 03:34:48 +0200723 return -EINVAL;
724
725 handle = DEVICE_ACPI_HANDLE(dev);
726 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
Rafael J. Wysockidee83702012-11-02 01:40:36 +0100727 dev_dbg(dev, "ACPI handle without context in %s!\n", __func__);
Rafael J. Wysockieb9d0fe2008-07-07 03:34:48 +0200728 return -ENODEV;
729 }
730
Rafael J. Wysockidee83702012-11-02 01:40:36 +0100731 error = __acpi_device_sleep_wake(adev, acpi_target_sleep_state, enable);
Rafael J. Wysockidf8db912009-09-08 23:13:49 +0200732 if (!error)
Rafael J. Wysockidee83702012-11-02 01:40:36 +0100733 dev_info(dev, "System wakeup %s by ACPI\n",
Rafael J. Wysockidf8db912009-09-08 23:13:49 +0200734 enable ? "enabled" : "disabled");
735
736 return error;
Rafael J. Wysockieb9d0fe2008-07-07 03:34:48 +0200737}
Rafael J. Wysocki761afb82010-10-14 23:24:13 +0200738#endif /* CONFIG_PM_SLEEP */
Shaohua Lifd4aff12007-07-17 22:40:25 +0200739
Alexey Starikovskiyf216cc32007-09-20 21:32:35 +0400740static void acpi_power_off_prepare(void)
741{
742 /* Prepare to power off the system */
743 acpi_sleep_prepare(ACPI_STATE_S5);
Lin Ming3d97e422008-12-16 16:57:46 +0800744 acpi_disable_all_gpes();
Alexey Starikovskiyf216cc32007-09-20 21:32:35 +0400745}
746
747static void acpi_power_off(void)
748{
749 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
Frank Seidel4d939152009-02-04 17:03:07 +0100750 printk(KERN_DEBUG "%s called\n", __func__);
Alexey Starikovskiyf216cc32007-09-20 21:32:35 +0400751 local_irq_disable();
Len Brown3f6f49c2012-07-26 20:08:54 -0400752 acpi_enter_sleep_state(ACPI_STATE_S5);
Len Brown96f15ef2009-04-17 23:32:20 -0400753}
754
Alexey Starikovskiyaafbcd12007-02-10 01:32:16 -0500755int __init acpi_sleep_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756{
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200757 acpi_status status;
758 u8 type_a, type_b;
759#ifdef CONFIG_SUSPEND
Alexey Starikovskiye2a5b422005-03-18 16:20:46 -0500760 int i = 0;
Carlos Corbachoe41fb7c2008-07-23 21:28:43 -0700761
762 dmi_check_system(acpisleep_dmi_table);
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200763#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700764
765 if (acpi_disabled)
766 return 0;
767
Frans Pop5a50fe72007-09-20 22:27:44 +0200768 sleep_states[ACPI_STATE_S0] = 1;
769 printk(KERN_INFO PREFIX "(supports S0");
770
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200771#ifdef CONFIG_SUSPEND
Frans Pop5a50fe72007-09-20 22:27:44 +0200772 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
774 if (ACPI_SUCCESS(status)) {
775 sleep_states[i] = 1;
Kay Sieversbe964472012-05-08 17:24:20 +0200776 printk(KERN_CONT " S%d", i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200780 suspend_set_ops(old_suspend_ordering ?
781 &acpi_suspend_ops_old : &acpi_suspend_ops);
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200782#endif
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700783
Rafael J. Wysockib0cb1a12007-07-29 23:24:36 +0200784#ifdef CONFIG_HIBERNATION
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200785 status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
786 if (ACPI_SUCCESS(status)) {
Rafael J. Wysockid8f3de02008-06-12 23:24:06 +0200787 hibernation_set_ops(old_suspend_ordering ?
788 &acpi_hibernation_ops_old : &acpi_hibernation_ops);
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200789 sleep_states[ACPI_STATE_S4] = 1;
Kay Sieversbe964472012-05-08 17:24:20 +0200790 printk(KERN_CONT " S4");
Shaohua Libdfe6b72008-07-23 21:28:41 -0700791 if (!nosigcheck) {
Lin Ming3d97e422008-12-16 16:57:46 +0800792 acpi_get_table(ACPI_SIG_FACS, 1,
Shaohua Libdfe6b72008-07-23 21:28:41 -0700793 (struct acpi_table_header **)&facs);
794 if (facs)
795 s4_hardware_signature =
796 facs->hardware_signature;
797 }
Rafael J. Wysocki296699d2007-07-29 23:27:18 +0200798 }
Rafael J. Wysockia3d25c22007-05-09 02:33:18 -0700799#endif
Alexey Starikovskiyf216cc32007-09-20 21:32:35 +0400800 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
801 if (ACPI_SUCCESS(status)) {
802 sleep_states[ACPI_STATE_S5] = 1;
Kay Sieversbe964472012-05-08 17:24:20 +0200803 printk(KERN_CONT " S5");
Alexey Starikovskiyf216cc32007-09-20 21:32:35 +0400804 pm_power_off_prepare = acpi_power_off_prepare;
805 pm_power_off = acpi_power_off;
806 }
Kay Sieversbe964472012-05-08 17:24:20 +0200807 printk(KERN_CONT ")\n");
Zhao Yakuie49f7112008-08-12 10:20:22 +0800808 /*
809 * Register the tts_notifier to reboot notifier list so that the _TTS
810 * object can also be evaluated when the system enters S5.
811 */
812 register_reboot_notifier(&tts_notifier);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813 return 0;
814}