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.
This commit is contained in:
parent
d49d0ca7fb
commit
ece50487e9
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user