summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_acad.c
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2001-07-25 16:08:58 +0000
committeriwasaki <iwasaki@FreeBSD.org>2001-07-25 16:08:58 +0000
commit021ebeaa900b648ddf12f44bfaabfe4b46e09db9 (patch)
tree6ec8555b9f481721aedb7e20dc4859c7fe4db965 /sys/dev/acpica/acpi_acad.c
parent16840ac973fc9dba929e59c9311557f3f2c35890 (diff)
downloadFreeBSD-src-021ebeaa900b648ddf12f44bfaabfe4b46e09db9.zip
FreeBSD-src-021ebeaa900b648ddf12f44bfaabfe4b46e09db9.tar.gz
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
Diffstat (limited to 'sys/dev/acpica/acpi_acad.c')
-rw-r--r--sys/dev/acpica/acpi_acad.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c
index 85cd666..d55b809 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);
}
OpenPOWER on IntegriCloud