Subject: MobilePro 800 force-suspending
To: None <port-hpcmips@netbsd.org>
From: Miles Nordin <carton@Ivy.NET>
List: port-hpcmips
Date: 02/27/2003 00:34:10
The hpcmips port will force-suspend a MobilePro 800 when the battery
gets low. This is bad because:
* suspending doesn't use less power since there is no screen
backlight control on this port. It does no good.
* sometimes suspending leaves a Microdrive spinning constantly, so it
can actually use more power. It does harm.
* The battery measurement is so inaccurate that the machine can keep
running for an hour or more after it starts force-suspending, so
the force-suspend feature effectively cuts the battery life by
somewhere between 1/2 and 1/5.
This patch against current-20021205 backs out the force-suspend
feature on all hpcmips platforms. This helps, but it's wrong.
The ``right thing'' would probably be to use some platform switch to
disable it except where screen backlight control is available, but I
don't know how to do that. It might also be appropriate to make the
force-suspend happen only once and then never again until AC power is
applied and removed, so you can press [Power] and use the last hour
remaining in your battery. Granted this is not what real laptops do,
but real laptops have real battery meters.
Anyway, whatever. this crude back-out works much better for me, at
least.
Index: vr/vrpiu.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/hpcmips/vr/vrpiu.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 vrpiu.c
--- vr/vrpiu.c 10 Dec 2002 22:01:00 -0000 1.1.1.3
+++ vr/vrpiu.c 23 Feb 2003 19:44:27 -0000
@@ -815,7 +815,9 @@
#ifdef VRPIU_ADHOC_BATTERY_EVENT
static int batteryhigh = 0;
static int batterylow = 0;
+#ifdef HPCMIPS_RETARDED_FORCESUSPEND
static int critical = 0;
+#endif
if (sc->sc_battery_spec == NULL
|| sc->sc_battery_spec->main_port == -1)
@@ -828,6 +830,7 @@
CONFIG_HOOK_PMEVENT_BATTERY,
(void *)CONFIG_HOOK_BATT_CRITICAL);
batterylow = 3;
+#ifdef HPCMIPS_RETARDED_FORCESUSPEND
if (critical) {
config_hook_call(CONFIG_HOOK_PMEVENT,
CONFIG_HOOK_PMEVENT_SUSPENDREQ,
@@ -836,6 +839,7 @@
batterylow = 0;
}
critical++;
+#endif
} else if (sc->sc_battery.value[sc->sc_battery_spec->main_port]
<= sc->sc_battery_spec->dc_20p) {
batteryhigh = 0;
Index: vr/vrpmu.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/hpcmips/vr/vrpmu.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 vrpmu.c
--- vr/vrpmu.c 10 Dec 2002 22:01:00 -0000 1.1.1.3
+++ vr/vrpmu.c 23 Feb 2003 19:06:03 -0000
@@ -283,8 +283,12 @@
if (intstat1 & PMUINT_RTC)
;
if (intstat1 & PMUINT_BATT)
+#ifdef HPCMIPS_RETARDED_FORCESUSPEND
config_hook_call(CONFIG_HOOK_PMEVENT,
CONFIG_HOOK_PMEVENT_SUSPENDREQ, NULL);
+#else
+ ;
+#endif
if (intstat1 & PMUINT_TIMOUTRST)
;
if (intstat1 & PMUINT_RTCRST)
@@ -294,8 +298,12 @@
if (intstat1 & PMUINT_DMSWRST)
;
if (intstat1 & PMUINT_BATTINTR)
+#ifdef HPCMIPS_RETARDED_FORCESUSPEND
config_hook_call(CONFIG_HOOK_PMEVENT,
CONFIG_HOOK_PMEVENT_SUSPENDREQ, NULL);
+#else
+ ;
+#endif
if (intstat1 & PMUINT_POWERSW) {
/*
* you can't detect when the button is released
--
While the new wave of New-Wave comic-book artists strives to make
heard their scream of primal rage, the ultimate effect is too often
nothing more than the crybaby yowl of teen angst.
-- Steranko