diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-10-11 10:23:16 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-10-11 13:47:17 -0700 |
commit | 8f2e99da75152c428c6c92b20a13a62a5fcb40d1 (patch) | |
tree | c2d3dc52372a79a03c2d503c55ead568c066a7e1 /chip/lm4/peci.c | |
parent | d1bebbbe66f78d2dcfb9380456a80e7c2f26a662 (diff) | |
download | chrome-ec-8f2e99da75152c428c6c92b20a13a62a5fcb40d1.tar.gz |
link: Temp sensor read can return an error code
This will be used in a follow-up CL to return specific error codes
(not powered, not calibrated, etc.)
BUG=chrome-os-partner:15174
BRANCH=link
TEST=manual
Power on system.
'temps' should return all good temps.
Power off system (into S5)
Only ECInternal temp should work; others should return Error 1
'gpioset enable_vs 1' and wait a second
Now all the I2C temps should display good data, but PECI will still be error 1.
Change-Id: I925434e71653ad53ad76bad992a7a8fdeadb088c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35286
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'chip/lm4/peci.c')
-rw-r--r-- | chip/lm4/peci.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/chip/lm4/peci.c b/chip/lm4/peci.c index 4091ee8640..210fb4e6c9 100644 --- a/chip/lm4/peci.c +++ b/chip/lm4/peci.c @@ -69,7 +69,7 @@ int peci_temp_sensor_poll(void) } -int peci_temp_sensor_get_val(int idx) +int peci_temp_sensor_get_val(int idx, int *temp_ptr) { int sum = 0; int success_cnt = 0; @@ -82,10 +82,11 @@ int peci_temp_sensor_get_val(int idx) } } - if (success_cnt) - return sum / success_cnt; - else - return -1; + if (!success_cnt) + return EC_ERROR_UNKNOWN; + + *temp_ptr = sum / success_cnt; + return EC_SUCCESS; } |