diff options
author | Alec Berg <alecaberg@chromium.org> | 2013-11-25 17:14:58 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-12-09 20:27:33 +0000 |
commit | 78992e730bb663180e947650787b4c4c8253fc53 (patch) | |
tree | ec122c1b6cb6799450833cd28a7712eb3f7c63d4 | |
parent | bc11760a58e08284afb98dcf5d448bec0b8a0cac (diff) | |
download | chrome-ec-78992e730bb663180e947650787b4c4c8253fc53.tar.gz |
lm4: Fix potential false over-temperature on entry to S0
This fixes a rare problem in which the EC could shutdown due to
a false over-temperature when entering S0 on Haswell architectures.
The fix involves requiring two valid reads of the temperature
sensor (out of the last 4 readings) in order to report it.
BUG=chrome-os-partner:24204
BRANCH=none
TEST=See bug report for a patch that recreates the bug at a
significantly higher rate then it would occur on its own. Using
that patch, I implemented this fix, and made sure that there
were no false over-temperatures reported.
Change-Id: I0454eca1b96fd2fa1833b080026ed8f1caeeddc4
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177963
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | chip/lm4/peci.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chip/lm4/peci.c b/chip/lm4/peci.c index d3fbd30947..d66956202b 100644 --- a/chip/lm4/peci.c +++ b/chip/lm4/peci.c @@ -75,7 +75,15 @@ int peci_temp_sensor_get_val(int idx, int *temp_ptr) } } - if (!success_cnt) + /* + * Require at least two valid samples. When the AP transitions into S0, + * it is possible, depending on the timing of the PECI sample, to read + * an invalid temperature. This is very rare, but when it does happen + * the temperature returned is PECI_TJMAX. Requiring two valid samples + * here assures us that one bad maximum temperature reading when + * entering S0 won't cause us to trigger an over temperature. + */ + if (success_cnt < 2) return EC_ERROR_UNKNOWN; *temp_ptr = sum / success_cnt; |