Commit 4cc75b3d authored by Patrick Mochel's avatar Patrick Mochel

acpi sleep: divorce sleep functionality from power off functionality.

When ACPI turns the system off on shutdown, it actually enters S5, a sleep
state. This functionality is dependent on CONFIG_ACPI_SLEEP, which is 
dependent on CONFIG_SOFTWARE_SUSPEND.

This patch breaks the power off functionality into a separate file, and 
removes the dependency on the above-mentioned crap. Finally, power off works
for me again. 

Thanks to Tobias Ringstrom for the original patch.
parent 684750a2
...@@ -30,6 +30,7 @@ obj-$(CONFIG_ACPI_INTERPRETER) += osl.o utils.o \ ...@@ -30,6 +30,7 @@ obj-$(CONFIG_ACPI_INTERPRETER) += osl.o utils.o \
# #
# ACPI Bus and Device Drivers # ACPI Bus and Device Drivers
# #
obj-y += sleep/
obj-$(CONFIG_ACPI_BUS) += bus.o obj-$(CONFIG_ACPI_BUS) += bus.o
obj-$(CONFIG_ACPI_AC) += ac.o obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BATTERY) += battery.o
...@@ -42,7 +43,6 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o ...@@ -42,7 +43,6 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
obj-$(CONFIG_ACPI_THERMAL) += thermal.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o
obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o
obj-$(CONFIG_ACPI_DEBUG) += debug.o obj-$(CONFIG_ACPI_DEBUG) += debug.o
obj-$(CONFIG_ACPI_SLEEP) += sleep/
obj-$(CONFIG_ACPI_NUMA) += numa.o obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-$(CONFIG_ACPI_BUS) += scan.o obj-$(CONFIG_ACPI_BUS) += scan.o
obj-y := main.o obj-y := poweroff.o
obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_ACPI_SLEEP) += main.o
obj-$(CONFIG_PROC_FS) += proc.o
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
/* /*
* sleep.c - ACPI sleep support. * sleep.c - ACPI sleep support.
* *
* Copyright (c) 2000-2002 Patrick Mochel * Copyright (c) 2000-2003 Patrick Mochel
* *
* Portions are * Portions are
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
...@@ -10,15 +10,9 @@ ...@@ -10,15 +10,9 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/pm.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <asm/acpi.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include "sleep.h" #include "sleep.h"
#define _COMPONENT ACPI_SYSTEM_COMPONENT #define _COMPONENT ACPI_SYSTEM_COMPONENT
...@@ -26,14 +20,6 @@ ACPI_MODULE_NAME ("sleep") ...@@ -26,14 +20,6 @@ ACPI_MODULE_NAME ("sleep")
u8 sleep_states[ACPI_S_STATE_COUNT]; u8 sleep_states[ACPI_S_STATE_COUNT];
static void
acpi_power_off (void)
{
acpi_enter_sleep_state_prep(ACPI_STATE_S5);
ACPI_DISABLE_IRQS();
acpi_enter_sleep_state(ACPI_STATE_S5);
}
/** /**
* acpi_system_restore_state - OS-specific restoration of state * acpi_system_restore_state - OS-specific restoration of state
* @state: sleep state we're exiting * @state: sleep state we're exiting
...@@ -265,7 +251,6 @@ acpi_suspend ( ...@@ -265,7 +251,6 @@ acpi_suspend (
static int __init acpi_sleep_init(void) static int __init acpi_sleep_init(void)
{ {
acpi_status status = AE_OK;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_system_add_fs"); ACPI_FUNCTION_TRACE("acpi_system_add_fs");
...@@ -275,6 +260,7 @@ static int __init acpi_sleep_init(void) ...@@ -275,6 +260,7 @@ static int __init acpi_sleep_init(void)
printk(KERN_INFO PREFIX "(supports"); printk(KERN_INFO PREFIX "(supports");
for (i=0; i<ACPI_S_STATE_COUNT; i++) { for (i=0; i<ACPI_S_STATE_COUNT; i++) {
acpi_status status;
u8 type_a, type_b; u8 type_a, type_b;
status = acpi_get_sleep_type_data(i, &type_a, &type_b); status = acpi_get_sleep_type_data(i, &type_a, &type_b);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
...@@ -286,16 +272,6 @@ static int __init acpi_sleep_init(void) ...@@ -286,16 +272,6 @@ static int __init acpi_sleep_init(void)
acpi_sleep_proc_init(); acpi_sleep_proc_init();
/* Install the soft-off (S5) handler. */
if (sleep_states[ACPI_STATE_S5]) {
pm_power_off = acpi_power_off;
/* workaround: some systems don't claim S4 support, but they
do support S5 (power-down). That is all we need, so
indicate support. */
sleep_states[ACPI_STATE_S4] = 1;
}
return_VALUE(0); return_VALUE(0);
} }
......
/*
* poweroff.c - ACPI handler for powering off the system.
*
* AKA S5, but it is independent of whether or not the kernel supports
* any other sleep support in the system.
*/
#include <linux/pm.h>
#include <linux/init.h>
#include <acpi/acpi_bus.h>
static void
acpi_power_off (void)
{
printk("%s called\n",__FUNCTION__);
acpi_enter_sleep_state_prep(ACPI_STATE_S5);
ACPI_DISABLE_IRQS();
acpi_enter_sleep_state(ACPI_STATE_S5);
}
static int acpi_poweroff_init(void)
{
if (!acpi_disabled) {
u8 type_a, type_b;
acpi_status status;
status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
if (ACPI_SUCCESS(status))
pm_power_off = acpi_power_off;
}
return 0;
}
late_initcall(acpi_poweroff_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment