summaryrefslogtreecommitdiff
path: root/common/thermal.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-11 11:06:29 -0700
committerGerrit <chrome-bot@google.com>2012-10-11 14:24:36 -0700
commit22e03a1de6d525e84e511f4b25531caf6f1a93fd (patch)
tree4b060ef35e12ea2d551518489244bdf59f9a14b8 /common/thermal.c
parent8f2e99da75152c428c6c92b20a13a62a5fcb40d1 (diff)
downloadchrome-ec-22e03a1de6d525e84e511f4b25531caf6f1a93fd.tar.gz
link: Temp sensors can return not-powered error code
This removes the need for a separate method to check sensor power, and gets rid of temp_sensor.c knowledge of what powers each sensor. BUG=chrome-os-partner:15174 BRANCH=link TEST=manual - reboot - within a second, type 'temps'; I2C sensors should return error 1 - type 'temps' again; all sensors should return data - power off system - type 'temps' again; I2C sensors and PECI should return error 8 - 'gpioset enable_vs 1' - type 'temps' again; I2C sensors should return valid data; PECI should still return error 8. Change-Id: I17c353b3c483bc320769307c7715008ec729089b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35287 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/thermal.c')
-rw-r--r--common/thermal.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/thermal.c b/common/thermal.c
index 6b4f3fa355..a300497bde 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -173,6 +173,7 @@ static void thermal_process(void)
int i, j;
int cur_temp;
int flag;
+ int rv;
for (i = 0; i < THRESHOLD_COUNT + THERMAL_FAN_STEPS; ++i)
overheated[i] = 0;
@@ -185,11 +186,12 @@ static void thermal_process(void)
flag = thermal_config[type].config_flags;
- if (!temp_sensor_powered(i))
+ rv = temp_sensor_read(i, &cur_temp);
+ if (rv == EC_ERROR_NOT_POWERED) {
+ /* Sensor not powered; ignore it */
continue;
-
- if (temp_sensor_read(i, &cur_temp)) {
- /* Sensor failure. */
+ } else if (rv) {
+ /* Other sensor failure */
if (flag & THERMAL_CONFIG_WARNING_ON_FAIL)
smi_sensor_failure_warning();
continue;