summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2023-04-27 19:06:58 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2023-04-27 19:06:58 +0000
commit16aa3a8c2422569dea10a290f8a5f6b80ce533a7 (patch)
tree2161b25f062fc565ced9e515677715d801e07856 /sys/dev
parent2c3605ddf2edf068ec3264596164754ca64733b5 (diff)
Mark the fan speed sensor as invalid when it reports -1 RPM. This happens for
a short while after suspend. ok deraadt@ kn@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpithinkpad.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/acpi/acpithinkpad.c b/sys/dev/acpi/acpithinkpad.c
index 76257e0cb3c..d749588f27e 100644
--- a/sys/dev/acpi/acpithinkpad.c
+++ b/sys/dev/acpi/acpithinkpad.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpithinkpad.c,v 1.71 2023/04/09 17:50:02 jcs Exp $ */
+/* $OpenBSD: acpithinkpad.c,v 1.72 2023/04/27 19:06:57 miod Exp $ */
/*
* Copyright (c) 2008 joshua stein <jcs@openbsd.org>
*
@@ -287,7 +287,12 @@ thinkpad_sensor_refresh(void *arg)
/* Read fan RPM */
acpiec_read(sc->sc_ec, THINKPAD_ECOFFSET_FANLO, 1, &lo);
acpiec_read(sc->sc_ec, THINKPAD_ECOFFSET_FANHI, 1, &hi);
- sc->sc_sens[THINKPAD_SENSOR_FANRPM].value = ((hi << 8L) + lo);
+ if (hi == 0xff && lo == 0xff) {
+ sc->sc_sens[THINKPAD_SENSOR_FANRPM].flags = SENSOR_FINVALID;
+ } else {
+ sc->sc_sens[THINKPAD_SENSOR_FANRPM].value = ((hi << 8L) + lo);
+ sc->sc_sens[THINKPAD_SENSOR_FANRPM].flags = 0;
+ }
}
void