From 826e811493c5f6ead44a4a77ec39b2d3b3a9e042 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Thu, 15 Mar 2012 14:16:52 +0800 Subject: 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 BUG=chrome-os-partner:8466 TEST=Set threshold to current temperature. The fan turns on and does not immediately turns off. Change-Id: Iad1de05a409dbbc573a8ffd0ece0dc7961b20806 --- common/thermal.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.1