summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/pc98/apm/apm.c20
1 files changed, 20 insertions, 0 deletions
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;
OpenPOWER on IntegriCloud