diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2001-06-23 10:38:25 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2001-06-23 10:38:25 +0000 |
commit | 0a170022469cb414eaf2fe65a3f07b5b0874d123 (patch) | |
tree | 2700c24fbec6ebb29d833bcb6825a2497ca61eb9 /sys/dev/acpica/acpi_thermal.c | |
parent | b3aa602e23ece34e47cebfa021714069fe78231a (diff) | |
download | FreeBSD-src-0a170022469cb414eaf2fe65a3f07b5b0874d123.zip FreeBSD-src-0a170022469cb414eaf2fe65a3f07b5b0874d123.tar.gz |
Add sysctl interface (Read-only) for temprature, AC-line and Battery.
Patches for acpi_cmbat.c submitted by Munehiro Matsuda.
Diffstat (limited to 'sys/dev/acpica/acpi_thermal.c')
-rw-r--r-- | sys/dev/acpica/acpi_thermal.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c index 0475d28..7b3cd4e 100644 --- a/sys/dev/acpica/acpi_thermal.c +++ b/sys/dev/acpica/acpi_thermal.c @@ -48,6 +48,7 @@ MODULE_NAME("THERMAL") struct acpi_tz_softc { device_t tz_dev; ACPI_HANDLE tz_handle; + int tz_tmp; }; static int acpi_tz_probe(device_t dev); @@ -90,7 +91,7 @@ static int acpi_tz_attach(device_t dev) { struct acpi_tz_softc *sc; - ACPI_STATUS status; + struct acpi_softc *acpi_sc; FUNCTION_TRACE(__func__); @@ -101,6 +102,14 @@ acpi_tz_attach(device_t dev) AcpiInstallNotifyHandler(sc->tz_handle, ACPI_DEVICE_NOTIFY, acpi_tz_notify_handler, dev); + if (device_get_unit(dev) == 0) { + acpi_sc = acpi_device_get_parent_softc(dev); + SYSCTL_ADD_UINT(&acpi_sc->acpi_sysctl_ctx, + SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), + OID_AUTO, "temperature", CTLFLAG_RD, + &sc->tz_tmp, 0, ""); + } + /* * Don't bother evaluating/printing the temperature at this point; * on many systems it'll be bogus until the EC is running. @@ -124,7 +133,10 @@ acpi_tz_check_tripping_point(void *context) return_VOID; } - device_printf(dev,"%d.%dC\n", TZ_KELVTOC(tp)); + sc->tz_tmp = (tp - TZ_ZEROC) / 10; + if (bootverbose) { + device_printf(dev, "%dC\n", sc->tz_tmp); + } return_VOID; } @@ -145,8 +157,3 @@ acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) return_VOID; } - - - - - |