diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2002-03-04 18:46:13 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2002-03-04 18:46:13 +0000 |
commit | 3f245d8dd193f05b337f1358ec6b33ed212f9cc1 (patch) | |
tree | 8012c8174b9cc8503bad897aec51d04ec2c4490b /sys/i386/bios | |
parent | 3fe10323bf98b7928a3f885f578ec703252ee6b7 (diff) | |
download | FreeBSD-src-3f245d8dd193f05b337f1358ec6b33ed212f9cc1.zip FreeBSD-src-3f245d8dd193f05b337f1358ec6b33ed212f9cc1.tar.gz |
Add generalized power profile code.
This makes other power-management system (APM for now) to be able to
generate power profile change events (ie. AC-line status changes), and
other kernel components, not only the ACPI components, can be notified
the events.
- move subroutines in acpi_powerprofile.c (removed) to kern/subr_power.c
- call power_profile_set_state() also from APM driver when AC-line
status changes
- add call-back function for Crusoe LongRun controlling on power
profile changes for a example
Diffstat (limited to 'sys/i386/bios')
-rw-r--r-- | sys/i386/bios/apm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 85d4bd2..9749e0c 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -906,6 +906,24 @@ apm_record_event(struct apm_softc *sc, u_int event_type) return (sc->sc_flags & SCFLAG_OCTL) ? 0 : 1; /* user may handle */ } +/* Power profile */ +static void +apm_power_profile(struct apm_softc *sc) +{ + int state; + struct apm_info info; + static int apm_acline = 0; + + if (apm_get_info(&info)) + return; + + if (apm_acline != info.ai_acline) { + apm_acline = info.ai_acline; + state = apm_acline ? POWER_PROFILE_PERFORMANCE : POWER_PROFILE_ECONOMY; + power_profile_set_state(state); + } +} + /* Process APM event */ static void apm_processevent(void) @@ -975,6 +993,7 @@ apm_processevent(void) break; OPMEV_DEBUGMESSAGE(PMEV_POWERSTATECHANGE); apm_record_event(sc, apm_event); + apm_power_profile(sc); break; OPMEV_DEBUGMESSAGE(PMEV_UPDATETIME); apm_record_event(sc, apm_event); @@ -982,6 +1001,7 @@ apm_processevent(void) break; OPMEV_DEBUGMESSAGE(PMEV_CAPABILITIESCHANGE); apm_record_event(sc, apm_event); + apm_power_profile(sc); break; case PMEV_NOEVENT: break; |