diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c index 38fd7c27847..85cd6665fd6 100644 --- a/sys/dev/acpica/acpi_acad.c +++ b/sys/dev/acpica/acpi_acad.c @@ -78,6 +78,9 @@ acpi_acad_get_status(void *context) 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 diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index f529a4cded0..c2bf1afe0a3 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -267,11 +267,24 @@ extern int acpi_avoid(ACPI_HANDLE handle); extern int acpi_disabled(char *subsys); /* - * Battery Abstruction and Generalized Power Management interface. + * Battery Abstruction. */ struct acpi_battinfo; extern int acpi_battery_register(int, int); -extern int acpi_acad_get_acline(void); extern int acpi_cmbat_get_battinfo(int, struct acpi_battinfo *); +/* + * System power API. + * + * XXX should this be further generalised? + * + */ +#define POWERPROFILE_PERFORMANCE 0 +#define POWERPROFILE_ECONOMY 1 + +extern int powerprofile_get_state(void); +extern void powerprofile_set_state(int state); + +typedef void (*powerprofile_change_hook)(void *); +EVENTHANDLER_DECLARE(powerprofile_change, powerprofile_change_hook);