#
# ACPI Bus and Device Drivers
#
+obj-y += sleep/
obj-$(CONFIG_ACPI_BUS) += bus.o
obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_THERMAL) += thermal.o
obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o
obj-$(CONFIG_ACPI_DEBUG) += debug.o
-obj-$(CONFIG_ACPI_SLEEP) += sleep/
obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-$(CONFIG_ACPI_BUS) += scan.o
/*
* sleep.c - ACPI sleep support.
*
- * Copyright (c) 2000-2002 Patrick Mochel
+ * Copyright (c) 2000-2003 Patrick Mochel
*
* Portions are
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
#include <linux/delay.h>
#include <linux/irq.h>
-#include <linux/pm.h>
#include <linux/device.h>
#include <linux/suspend.h>
-
-#include <asm/acpi.h>
-
#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-
#include "sleep.h"
#define _COMPONENT ACPI_SYSTEM_COMPONENT
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
* @state: sleep state we're exiting
static int __init acpi_sleep_init(void)
{
- acpi_status status = AE_OK;
int i = 0;
ACPI_FUNCTION_TRACE("acpi_system_add_fs");
printk(KERN_INFO PREFIX "(supports");
for (i=0; i<ACPI_S_STATE_COUNT; i++) {
+ acpi_status status;
u8 type_a, type_b;
status = acpi_get_sleep_type_data(i, &type_a, &type_b);
if (ACPI_SUCCESS(status)) {
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);
}
--- /dev/null
+/*
+ * 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);