From 5394e6a0269a1af94437e618e1293d91862cf7e4 Mon Sep 17 00:00:00 2001 From: Mitsuru IWASAKI Date: Wed, 25 Jul 2001 16:08:58 +0000 Subject: [PATCH] Some minor fixes. - Set system power profile only when AC-line status has canged. - Get initial AC-line status after whole system is up. Reviewed by: msmith --- sys/dev/acpica/acpi_acad.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c index 85cd6665fd67..d55b809855b1 100644 --- a/sys/dev/acpica/acpi_acad.c +++ b/sys/dev/acpica/acpi_acad.c @@ -66,21 +66,25 @@ struct acpi_acad_softc { static void acpi_acad_get_status(void *context) { + int newstatus; device_t dev = context; struct acpi_acad_softc *sc = device_get_softc(dev); ACPI_HANDLE h = acpi_get_handle(dev); - if (acpi_EvaluateInteger(h, "_PSR", &sc->status) != AE_OK) { + if (acpi_EvaluateInteger(h, "_PSR", &newstatus) != AE_OK) { sc->status = -1; return; } + if (sc->status != newstatus) { + sc->status = newstatus; + /* set system power profile based on AC adapter status */ + powerprofile_set_state(sc->status ? POWERPROFILE_PERFORMANCE : POWERPROFILE_ECONOMY); + } + if (bootverbose) { device_printf(dev,"%s\n",(sc->status) ? "On Line" : "Off Line"); } - - /* set system power profile based on AC adapter status */ - powerprofile_set_state(sc->status ? POWERPROFILE_PERFORMANCE : POWERPROFILE_ECONOMY); } static void @@ -153,6 +157,9 @@ acpi_acad_attach(device_t dev) &sc->status, 0, acpi_acad_sysctl, "I", ""); } + /* Get initial status after whole system is up. */ + AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_acad_get_status, dev); + return(0); }