CVSROOT:        /cvs
Module name:    src
Changes by:     k...@cvs.openbsd.org    2021/04/01 04:34:21

Modified files:
        sys/dev/fdt    : cwfg.c 

Log message:
Hardcode meaningful alert level, track apm's battery state better

The current code looks for the nonexistent "cellwise,alert-level" property
and falls back to zero as threshold (like the original NetBSD code).
It also updates the CONFIG register with that very threshold to let the
hardware set a bit and thus alert us when it has been reached.

Since our sensor framework is designed to poll every N seconds and this
driver does not actually look at whether the hardware alerted, neither
using a default threshold of zero nor updating the hardware with it makes
sense.

Remove the alert level code and simply map >50%, >25% and <=25% of
remaining battery life to apm(4)'s "high", "low" and "critical" battery
state respectively;  this matches exactly what acpibat(4) does and provides
more meaningful sensor readings without relying on nonexistent device tree
bindings.

Feedback OK patrick

Reply via email to