summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_button.c
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2002-07-22 12:52:54 +0000
committeriwasaki <iwasaki@FreeBSD.org>2002-07-22 12:52:54 +0000
commit39615709135ccb3ccbc54ac2a0a1540692d913cd (patch)
treeb7be83e0557f6498766c14cd562d2172d12e3f8f /sys/dev/acpica/acpi_button.c
parentfcb9022bbd197d29db9969eb8ddad8754296f8d0 (diff)
downloadFreeBSD-src-39615709135ccb3ccbc54ac2a0a1540692d913cd.zip
FreeBSD-src-39615709135ccb3ccbc54ac2a0a1540692d913cd.tar.gz
Add device(power/sleep button and lid) wake function from sleeping state.
This is required for some Thinkpad (and maybe VAIO) machines to wake the system up from sleep. Currently partially implemented, more complete implementation will come later.
Diffstat (limited to 'sys/dev/acpica/acpi_button.c')
-rw-r--r--sys/dev/acpica/acpi_button.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi_button.c b/sys/dev/acpica/acpi_button.c
index 1506895..a4bebc2 100644
--- a/sys/dev/acpica/acpi_button.c
+++ b/sys/dev/acpica/acpi_button.c
@@ -53,6 +53,8 @@ struct acpi_button_softc {
static int acpi_button_probe(device_t dev);
static int acpi_button_attach(device_t dev);
+static int acpi_button_suspend(device_t dev);
+static int acpi_button_resume(device_t dev);
static void acpi_button_notify_handler(ACPI_HANDLE h,UINT32 notify, void *context);
static void acpi_button_notify_pressed_for_sleep(void *arg);
static void acpi_button_notify_pressed_for_wakeup(void *arg);
@@ -61,6 +63,8 @@ static device_method_t acpi_button_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, acpi_button_probe),
DEVMETHOD(device_attach, acpi_button_attach),
+ DEVMETHOD(device_suspend, acpi_button_suspend),
+ DEVMETHOD(device_resume, acpi_button_resume),
{0, 0}
};
@@ -114,9 +118,27 @@ acpi_button_attach(device_t dev)
device_printf(sc->button_dev, "couldn't install Notify handler - %s\n", AcpiFormatException(status));
return_VALUE(ENXIO);
}
+ acpi_device_enable_wake_capability(sc->button_handle, 1);
return_VALUE(0);
}
+static int
+acpi_button_suspend(device_t dev)
+{
+ struct acpi_button_softc *sc;
+
+ sc = device_get_softc(dev);
+ acpi_device_enable_wake_event(sc->button_handle);
+ return (0);
+}
+
+static int
+acpi_button_resume(device_t dev)
+{
+
+ return (0);
+}
+
static void
acpi_button_notify_pressed_for_sleep(void *arg)
{
OpenPOWER on IntegriCloud