From 3d100bed7e17dd2604e5f1599df3b353a9eabe00 Mon Sep 17 00:00:00 2001 From: Frederic Cambus Date: Mon, 5 Dec 2016 15:04:16 +0000 Subject: Harmonize battery state thresholds accross platforms. Use the same values hardcoded in sys/dev/acpi/acpi.c where possible. OK visa@ --- sys/arch/loongson/dev/kb3310.c | 5 ++--- sys/arch/loongson/dev/stsec.c | 11 +++++------ 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'sys/arch/loongson') 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 * @@ -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 */ } -- cgit v1.2.3