summaryrefslogtreecommitdiff
path: root/common/thermal.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2014-01-08 14:16:52 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-01-10 00:12:01 +0000
commit24b39823b5bb3e207e1060fc684a3dec0f8d91c1 (patch)
treead63db111f3629e308d3e2d6a596f668fbbb409b /common/thermal.c
parent94172eba44f741204566cd6548f625169f11c589 (diff)
downloadchrome-ec-24b39823b5bb3e207e1060fc684a3dec0f8d91c1.tar.gz
thermal: dptf: Don't clear threshold condition on set
The DPTF framework will sometimes set thresholds and not expect to get another event if the current temperature is above both the previous threshold and the new threshold. When a threshold is set only initialize the over condition if the threshold was previously disabled in order to prevent it from firing again. BUG=chrome-os-partner:23970 BRANCH=rambi TEST=build and boot on rambi, start DPTF framework and observe that when a threshold is crossed (going high) and a new threshold is set at a lower value that it does not immediately result in a new event. Change-Id: I6bad956fb5a49027a5c5f9c49a6fd68a0a96d693 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182004 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'common/thermal.c')
-rw-r--r--common/thermal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/thermal.c b/common/thermal.c
index 7113564f82..bbb90a5229 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -102,8 +102,10 @@ void dptf_set_temp_threshold(int sensor_id, int temp, int idx, int enable)
sensor_id, K_TO_C(temp), idx, enable ? "en" : "dis");
if (enable) {
+ /* Don't update threshold condition if already enabled */
+ if (dptf_threshold[sensor_id][idx].temp == -1)
+ cond_init(&dptf_threshold[sensor_id][idx].over, 0);
dptf_threshold[sensor_id][idx].temp = temp;
- cond_init(&dptf_threshold[sensor_id][idx].over, 0);
atomic_clear(&dptf_seen, (1 << sensor_id));
} else {
dptf_threshold[sensor_id][idx].temp = -1;