From d62056460c5340cdce815779b47b8d8ffe65b7b0 Mon Sep 17 00:00:00 2001 From: "Constantine A. Murenin" Date: Sat, 20 Feb 2010 18:15:56 -0500 Subject: [PATCH] acpi_thinkpad(4): bring back relevant changes from 20b3fb for acpi_thinkpad_refresh --- sys/dev/acpica5/acpi_thinkpad/acpi_thinkpad.c | 57 +++++++++++++-------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/sys/dev/acpica5/acpi_thinkpad/acpi_thinkpad.c b/sys/dev/acpica5/acpi_thinkpad/acpi_thinkpad.c index 0327f6301a..bddbd293b8 100644 --- a/sys/dev/acpica5/acpi_thinkpad/acpi_thinkpad.c +++ b/sys/dev/acpica5/acpi_thinkpad/acpi_thinkpad.c @@ -958,45 +958,44 @@ acpi_thinkpad_notify(ACPI_HANDLE h, UINT32 notify, void *context) } } -static void +void acpi_thinkpad_refresh(void *arg) { struct acpi_thinkpad_softc *sc = (struct acpi_thinkpad_softc *)arg; - char temp_cmd[] = "TMP0"; - int data, i; - ACPI_INTEGER speed; + int i, data; for (i = 0; i < THINKPAD_TEMP_SENSORS; i++) { + char temp_cmd[] = "TMP0"; + temp_cmd[3] = '0' + i; - - /* - * The TMPx methods seem to return +/- 128 or 0 - * when the respecting sensor is not available - */ - sc->sensors[i].flags &= ~SENSOR_FINVALID; - if (ACPI_FAILURE(acpi_GetInteger(sc->ec_handle, temp_cmd, - &data)) || ABS(data) == 128 || data == 0) { + /* + * The TMPx methods seem to return +/- 128 or 0 + * when the respecting sensor is not available + */ + if (ACPI_FAILURE(acpi_GetInteger(sc->ec_handle, temp_cmd, + &data)) || ABS(data) == 128 || data == 0) { sc->sensors[i].flags |= SENSOR_FINVALID; - data = 0; - } - else if (sc->thermal_updt_supported) { - /* Temperature is reported in tenth of Kelvin */ - sc->sensors[i].value = data * 100000; + continue; } - sc->sensors[i].value = data * 1000000 + 273150000; - } - - sc->sensors[i].flags &= ~SENSOR_FINVALID; + if (sc->thermal_updt_supported) + /* Temperature is reported in tenth of Kelvin */ + sc->sensors[i].value = data * 100000 - 50000; + else + sc->sensors[i].value = data * 1000000 + 273150000; + sc->sensors[i].flags &= ~SENSOR_FINVALID; + } + if (sc->fan_handle) { if (ACPI_FAILURE(acpi_GetInteger(sc->fan_handle, NULL, &data))) sc->sensors[i].flags |= SENSOR_FINVALID; - data = -1; - } - else { - ACPI_EC_READ(sc->ec_dev, THINKPAD_EC_FANSPEED, &speed, 2); - data = speed; - } - - sc->sensors[i].value = data; + sc->sensors[i].value = data; + sc->sensors[i].flags &= ~SENSOR_FINVALID; + } else { + ACPI_INTEGER speed; + + ACPI_EC_READ(sc->ec_dev, THINKPAD_EC_FANSPEED, &speed, 2); + sc->sensors[i].value = speed; + sc->sensors[i].flags &= ~SENSOR_FINVALID; + } } -- 2.11.4.GIT