summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2014-01-08 14:16:52 -0800
committerDave Parker <dparker@chromium.org>2014-01-13 06:40:33 +0000
commitc7af7a79b1fe93ecb58e88ed732b1406195bbcdc (patch)
treeaaf401c886364cd3b6c1e8652e6e02cb4731318d
parentb09de941551ba6f084044f08f5fafd59556df953 (diff)
downloadchrome-ec-c7af7a79b1fe93ecb58e88ed732b1406195bbcdc.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=None Original-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. Original-Change-Id: I6bad956fb5a49027a5c5f9c49a6fd68a0a96d693 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182004 (cherry picked from commit 24b39823b5bb3e207e1060fc684a3dec0f8d91c1) Reviewed-on: https://chromium-review.googlesource.com/182077 Change-Id: I93a812e73bfbf5d42878b29632319e081baae3b1 Reviewed-on: https://chromium-review.googlesource.com/182257 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
-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;