aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/sleep')
-rw-r--r--drivers/acpi/sleep/main.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index be616317fe53..f3d3867303ec 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -49,7 +49,7 @@ int acpi_sleep_prepare(u32 acpi_state)
49} 49}
50 50
51#ifdef CONFIG_SUSPEND 51#ifdef CONFIG_SUSPEND
52static struct pm_ops acpi_pm_ops; 52static struct platform_suspend_ops acpi_pm_ops;
53 53
54extern void do_suspend_lowlevel(void); 54extern void do_suspend_lowlevel(void);
55 55
@@ -84,13 +84,12 @@ static int acpi_pm_set_target(suspend_state_t pm_state)
84 84
85/** 85/**
86 * acpi_pm_prepare - Do preliminary suspend work. 86 * acpi_pm_prepare - Do preliminary suspend work.
87 * @pm_state: ignored
88 * 87 *
89 * If necessary, set the firmware waking vector and do arch-specific 88 * If necessary, set the firmware waking vector and do arch-specific
90 * nastiness to get the wakeup code to the waking vector. 89 * nastiness to get the wakeup code to the waking vector.
91 */ 90 */
92 91
93static int acpi_pm_prepare(suspend_state_t pm_state) 92static int acpi_pm_prepare(void)
94{ 93{
95 int error = acpi_sleep_prepare(acpi_target_sleep_state); 94 int error = acpi_sleep_prepare(acpi_target_sleep_state);
96 95
@@ -159,13 +158,12 @@ static int acpi_pm_enter(suspend_state_t pm_state)
159 158
160/** 159/**
161 * acpi_pm_finish - Finish up suspend sequence. 160 * acpi_pm_finish - Finish up suspend sequence.
162 * @pm_state: ignored
163 * 161 *
164 * 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
165 * failed). 163 * failed).
166 */ 164 */
167 165
168static int acpi_pm_finish(suspend_state_t pm_state) 166static void acpi_pm_finish(void)
169{ 167{
170 u32 acpi_state = acpi_target_sleep_state; 168 u32 acpi_state = acpi_target_sleep_state;
171 169
@@ -183,7 +181,6 @@ static int acpi_pm_finish(suspend_state_t pm_state)
183 init_8259A(0); 181 init_8259A(0);
184 } 182 }
185#endif 183#endif
186 return 0;
187} 184}
188 185
189static int acpi_pm_state_valid(suspend_state_t pm_state) 186static int acpi_pm_state_valid(suspend_state_t pm_state)
@@ -202,7 +199,7 @@ static int acpi_pm_state_valid(suspend_state_t pm_state)
202 } 199 }
203} 200}
204 201
205static struct pm_ops acpi_pm_ops = { 202static struct platform_suspend_ops acpi_pm_ops = {
206 .valid = acpi_pm_state_valid, 203 .valid = acpi_pm_state_valid,
207 .set_target = acpi_pm_set_target, 204 .set_target = acpi_pm_set_target,
208 .prepare = acpi_pm_prepare, 205 .prepare = acpi_pm_prepare,
@@ -214,7 +211,7 @@ static struct pm_ops acpi_pm_ops = {
214 * Toshiba fails to preserve interrupts over S1, reinitialization 211 * Toshiba fails to preserve interrupts over S1, reinitialization
215 * of 8259 is needed after S1 resume. 212 * of 8259 is needed after S1 resume.
216 */ 213 */
217static int __init init_ints_after_s1(struct dmi_system_id *d) 214static int __init init_ints_after_s1(const struct dmi_system_id *d)
218{ 215{
219 printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); 216 printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
220 init_8259A_after_S1 = 1; 217 init_8259A_after_S1 = 1;
@@ -232,6 +229,12 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
232#endif /* CONFIG_SUSPEND */ 229#endif /* CONFIG_SUSPEND */
233 230
234#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
235static int acpi_hibernation_prepare(void) 238static int acpi_hibernation_prepare(void)
236{ 239{
237 return acpi_sleep_prepare(ACPI_STATE_S4); 240 return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -253,6 +256,15 @@ static int acpi_hibernation_enter(void)
253 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 256 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
254} 257}
255 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
256static void acpi_hibernation_finish(void) 268static void acpi_hibernation_finish(void)
257{ 269{
258 /* 270 /*
@@ -265,6 +277,8 @@ static void acpi_hibernation_finish(void)
265 277
266 /* reset firmware waking vector */ 278 /* reset firmware waking vector */
267 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;
268} 282}
269 283
270static int acpi_hibernation_pre_restore(void) 284static int acpi_hibernation_pre_restore(void)
@@ -281,10 +295,13 @@ static void acpi_hibernation_restore_cleanup(void)
281 acpi_hw_enable_all_runtime_gpes(); 295 acpi_hw_enable_all_runtime_gpes();
282} 296}
283 297
284static 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,
285 .prepare = acpi_hibernation_prepare, 302 .prepare = acpi_hibernation_prepare,
286 .enter = acpi_hibernation_enter, 303 .enter = acpi_hibernation_enter,
287 .finish = acpi_hibernation_finish, 304 .leave = acpi_hibernation_leave,
288 .pre_restore = acpi_hibernation_pre_restore, 305 .pre_restore = acpi_hibernation_pre_restore,
289 .restore_cleanup = acpi_hibernation_restore_cleanup, 306 .restore_cleanup = acpi_hibernation_restore_cleanup,
290}; 307};
@@ -421,7 +438,7 @@ int __init acpi_sleep_init(void)
421 } 438 }
422 } 439 }
423 440
424 pm_set_ops(&acpi_pm_ops); 441 suspend_set_ops(&acpi_pm_ops);
425#endif 442#endif
426 443
427#ifdef CONFIG_HIBERNATION 444#ifdef CONFIG_HIBERNATION