diff options
author | Frederic Cambus <fcambus@cvs.openbsd.org> | 2016-12-05 15:04:16 +0000 |
---|---|---|
committer | Frederic Cambus <fcambus@cvs.openbsd.org> | 2016-12-05 15:04:16 +0000 |
commit | 3d100bed7e17dd2604e5f1599df3b353a9eabe00 (patch) | |
tree | 8ab51667961a2f259b91394f5103bac5a41bf0d2 | |
parent | e26e2b336e58950e4f78039b9e6cc918f44932a3 (diff) |
Harmonize battery state thresholds accross platforms.
Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.
OK visa@
-rw-r--r-- | sys/arch/loongson/dev/kb3310.c | 5 | ||||
-rw-r--r-- | sys/arch/loongson/dev/stsec.c | 11 | ||||
-rw-r--r-- | sys/arch/macppc/dev/apm.c | 11 |
3 files changed, 12 insertions, 15 deletions
diff --git a/sys/arch/loongson/dev/kb3310.c b/sys/arch/loongson/dev/kb3310.c index d9887dc5a0e..044eccef39e 100644 --- a/sys/arch/loongson/dev/kb3310.c +++ b/sys/arch/loongson/dev/kb3310.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kb3310.c,v 1.21 2016/11/15 13:53:35 fcambus Exp $ */ +/* $OpenBSD: kb3310.c,v 1.22 2016/12/05 15:04:15 fcambus Exp $ */ /* * Copyright (c) 2010 Otto Moerbeek <otto@drijf.net> * @@ -408,8 +408,7 @@ ykbec_refresh(void *arg) ykbec_apmdata.battery_state = APM_BATT_CHARGING; else if (ISSET(bat_status, BAT_STATUS_BAT_LOW)) ykbec_apmdata.battery_state = APM_BATT_CRITICAL; - /* XXX arbitrary */ - else if (cap_pct > 60) + else if (cap_pct > 50) ykbec_apmdata.battery_state = APM_BATT_HIGH; else ykbec_apmdata.battery_state = APM_BATT_LOW; diff --git a/sys/arch/loongson/dev/stsec.c b/sys/arch/loongson/dev/stsec.c index 31a6387ff93..0dcd4c85b20 100644 --- a/sys/arch/loongson/dev/stsec.c +++ b/sys/arch/loongson/dev/stsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stsec.c,v 1.4 2010/03/08 20:56:20 miod Exp $ */ +/* $OpenBSD: stsec.c,v 1.5 2016/12/05 15:04:15 fcambus Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -323,13 +323,12 @@ stsec_sensors_update(void *vsc) } else { if (ISSET(control, STC_CHARGE_ENABLE)) stsec_apmdata.battery_state = APM_BATT_CHARGING; - /* XXX arbitrary */ - else if (cap_pct < 10) - stsec_apmdata.battery_state = APM_BATT_CRITICAL; - else if (cap_pct > 60) + else if (cap_pct > 50) stsec_apmdata.battery_state = APM_BATT_HIGH; - else + else if (cap_pct > 25) stsec_apmdata.battery_state = APM_BATT_LOW; + else + stsec_apmdata.battery_state = APM_BATT_CRITICAL; stsec_apmdata.minutes_left = -1; /* unknown */ } diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c index dfa03b6752e..92caa63e764 100644 --- a/sys/arch/macppc/dev/apm.c +++ b/sys/arch/macppc/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.18 2016/10/08 05:49:08 guenther Exp $ */ +/* $OpenBSD: apm.c,v 1.19 2016/12/05 15:04:15 fcambus Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -273,13 +273,12 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) power->minutes_left = ((batt.cur_charge * 3600) / (-batt.draw)) / 60; - /* XXX - Arbitrary */ - if (power->battery_life > 60) + if (power->battery_life > 50) power->battery_state = APM_BATT_HIGH; - else if (power->battery_life < 10) - power->battery_state = APM_BATT_CRITICAL; - else + else if (power->battery_life > 25) power->battery_state = APM_BATT_LOW; + else + power->battery_state = APM_BATT_CRITICAL; } break; case APM_IOC_STANDBY_REQ: |