summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2012-10-14 09:32:38 +0000
committeravg <avg@FreeBSD.org>2012-10-14 09:32:38 +0000
commite39cd478cdd56df8027997aa808056f42798db5a (patch)
tree03ec207427682e6e3632b73d98030fe68d0f2400 /sys/dev/acpica
parent4caea964890a5504c5a38124e1dc8a9c58aa7fb4 (diff)
downloadFreeBSD-src-e39cd478cdd56df8027997aa808056f42798db5a.zip
FreeBSD-src-e39cd478cdd56df8027997aa808056f42798db5a.tar.gz
acpi_thermal: when _ACx is tripped, all _ALi i>= x should be on
... and not just _ALx as it is now. MFC after: 20 days
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi_thermal.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index 32e5c2d..baa8205 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -121,6 +121,8 @@ struct acpi_tz_softc {
int tz_cooling_saved_freq;
};
+#define TZ_ACTIVE_LEVEL(act) ((act) >= 0 ? (act) : TZ_NUMLEVELS)
+
#define CPUFREQ_MAX_LEVELS 64 /* XXX cpufreq should export this */
static int acpi_tz_probe(device_t dev);
@@ -565,18 +567,21 @@ acpi_tz_monitor(void *Context)
}
if (newactive != sc->tz_active) {
- /* Turn off the cooling devices that are on, if any are */
- if (sc->tz_active != TZ_ACTIVE_NONE)
+ /* Turn off unneeded cooling devices that are on, if any are */
+ for (i = TZ_ACTIVE_LEVEL(sc->tz_active);
+ i < TZ_ACTIVE_LEVEL(newactive); i++) {
acpi_ForeachPackageObject(
- (ACPI_OBJECT *)sc->tz_zone.al[sc->tz_active].Pointer,
+ (ACPI_OBJECT *)sc->tz_zone.al[i].Pointer,
acpi_tz_switch_cooler_off, sc);
-
+ }
/* Turn on cooling devices that are required, if any are */
- if (newactive != TZ_ACTIVE_NONE) {
+ for (i = TZ_ACTIVE_LEVEL(sc->tz_active) - 1;
+ i >= TZ_ACTIVE_LEVEL(newactive); i--) {
acpi_ForeachPackageObject(
- (ACPI_OBJECT *)sc->tz_zone.al[newactive].Pointer,
+ (ACPI_OBJECT *)sc->tz_zone.al[i].Pointer,
acpi_tz_switch_cooler_on, sc);
}
+
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
"switched from %s to %s: %d.%dC\n",
acpi_tz_aclevel_string(sc->tz_active),
OpenPOWER on IntegriCloud