From a36826905cb959c8259cfbe2e8e5015c838dcd8b Mon Sep 17 00:00:00 2001 From: nyan Date: Fri, 8 Mar 2002 11:38:00 +0000 Subject: MFi386: revision 1.125 --- sys/pc98/apm/apm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sys/pc98/apm/apm.c') diff --git a/sys/pc98/apm/apm.c b/sys/pc98/apm/apm.c index 925d616..3313512 100644 --- a/sys/pc98/apm/apm.c +++ b/sys/pc98/apm/apm.c @@ -1000,6 +1000,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) @@ -1069,6 +1087,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); @@ -1076,6 +1095,7 @@ apm_processevent(void) break; OPMEV_DEBUGMESSAGE(PMEV_CAPABILITIESCHANGE); apm_record_event(sc, apm_event); + apm_power_profile(sc); break; case PMEV_NOEVENT: break; -- cgit v1.1