summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2012-03-15 14:16:52 +0800
committerVic Yang <victoryang@google.com>2012-03-16 07:25:37 +0800
commit826e811493c5f6ead44a4a77ec39b2d3b3a9e042 (patch)
treed2dc660c97a2342e064c8e0513063c421670b8c7
parent0cde4cfec35d34fb77c75d655d098390b70c8655 (diff)
downloadchrome-ec-826e811493c5f6ead44a4a77ec39b2d3b3a9e042.tar.gz
Prevent fan from keep turning on and off.
Modify thermal engine to treat temperature threshold as a 3-degree range instead of a certain value. This way the fan do not keep turning on and off, while the temperature floating around the threshold value. Signed-off-by: Vic Yang <victoryang@google.com> BUG=chrome-os-partner:8466 TEST=Set threshold to current temperature. The fan turns on and does not immediately turns off. Change-Id: Iad1de05a409dbbc573a8ffd0ece0dc7961b20806
-rw-r--r--common/thermal.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/thermal.c b/common/thermal.c
index 650b6ca5c3..1bdeaadaec 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -130,7 +130,15 @@ static inline void update_and_check_stat(int temp,
overheated[threshold_id] = 1;
}
}
- else
+ else if (ot_count[sensor_id][threshold_id] >= 10 &&
+ temp >= threshold - 3) {
+ /* Once the threshold is reached, only if the temperature
+ * drops to 3 degrees below threshold do we deassert
+ * overheated signal. This is to prevent temperature
+ * oscillating around the threshold causing threshold
+ * keep being triggered. */
+ overheated[threshold_id] = 1;
+ } else
ot_count[sensor_id][threshold_id] = 0;
}