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:41:03 +0000
commiteec2c382a593240e40f76f780cea339781658c25 (patch)
tree9556fa34b93c3623ac9c300f6c46385f74905c75
parent9867f8379a09d60b3df8c62c269627714e97b2ac (diff)
downloadchrome-ec-eec2c382a593240e40f76f780cea339781658c25.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: Ic505a95500d58608ed5d99a15a2918a9cdde8963 Reviewed-on: https://chromium-review.googlesource.com/182258 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;