diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2001-12-09 18:02:36 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2001-12-09 18:02:36 +0000 |
commit | 7c555201d37cd90a6599a216c7e2badfa943a6d4 (patch) | |
tree | 016df338e42d8567264b34640792ceea1dfbe796 /sys | |
parent | 915c6a9163411e9ef9369d91dfac3efc96aadc1e (diff) | |
download | FreeBSD-src-7c555201d37cd90a6599a216c7e2badfa943a6d4.zip FreeBSD-src-7c555201d37cd90a6599a216c7e2badfa943a6d4.tar.gz |
Disable sleep requests for 5 sec after wakeup. This is needed for
some Toshiba and Thinkpad laptops.
Wakeup event is generated by power button or sleep button on some
laptops but this also generates SCI interrupt, and shutdown the system
as result. So this is introduced so that acpi driver ignore given
requests for certain period.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/acpica/acpi.c | 16 | ||||
-rw-r--r-- | sys/dev/acpica/acpivar.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 8aba3cc..5bbc688 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -458,6 +458,7 @@ acpi_attach(device_t dev) */ sc->acpi_enabled = 1; sc->acpi_sstate = ACPI_STATE_S0; + sc->acpi_sleep_disabled = 0; /* * Create the control device @@ -1296,6 +1297,13 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOURCE *res) return(AE_OK); } +#define ACPI_MINIMUM_AWAKETIME 5 + +static void +acpi_sleep_enable(void *arg) +{ + ((struct acpi_softc *)arg)->acpi_sleep_disabled = 0; +} /* * Set the system sleep state @@ -1315,6 +1323,9 @@ acpi_SetSleepState(struct acpi_softc *sc, int state) if (sc->acpi_sstate != ACPI_STATE_S0) return_ACPI_STATUS(AE_BAD_PARAMETER); /* avoid reentry */ + if (sc->acpi_sleep_disabled) + return_ACPI_STATUS(AE_OK); + switch (state) { case ACPI_STATE_S0: /* XXX only for testing */ status = AcpiEnterSleepState((UINT8)state); @@ -1356,6 +1367,7 @@ acpi_SetSleepState(struct acpi_softc *sc, int state) } sc->acpi_sstate = state; + sc->acpi_sleep_disabled = 1; if (state != ACPI_STATE_S1) { acpi_sleep_machdep(sc, state); @@ -1392,6 +1404,10 @@ acpi_SetSleepState(struct acpi_softc *sc, int state) status = AE_BAD_PARAMETER; break; } + + if (sc->acpi_sleep_disabled) + timeout(acpi_sleep_enable, (caddr_t)sc, hz * ACPI_MINIMUM_AWAKETIME); + return_ACPI_STATUS(status); } diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 72c264e..6191859 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -47,6 +47,7 @@ struct acpi_softc { int acpi_enabled; int acpi_sstate; + int acpi_sleep_disabled; struct sysctl_ctx_list acpi_sysctl_ctx; struct sysctl_oid *acpi_sysctl_tree; |