summaryrefslogtreecommitdiff
path: root/common/temp_sensor.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-11 12:37:23 -0700
committerGerrit <chrome-bot@google.com>2012-10-11 14:24:41 -0700
commit25c6574da67335b0a6ab36429cc2e3c7fe87afc0 (patch)
treef52ff17529f0b519d89c801023cdff6e40373ab8 /common/temp_sensor.c
parent23fe5ed867b2811a84171755137021608dda5777 (diff)
downloadchrome-ec-25c6574da67335b0a6ab36429cc2e3c7fe87afc0.tar.gz
link: TMP006 S0 param is uncalibrated by default
S0 values are incorrect and may even need to be calibrated on a per-system basis. Set them to 0 by default so that the EC doesn't return inaccurate remote temperature readings before calibration data is sent. BUG=chrome-os-partner:15174 BRANCH=link TEST=manual - temps -> remote temps are all not calibrated - t6cal 1 s0 9301 - temps -> PCH D-Object temp now returns a temperature Change-Id: I43facc60cf947ebd9441a8a629a76f7ffc8f3959 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35302 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/temp_sensor.c')
-rw-r--r--common/temp_sensor.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/common/temp_sensor.c b/common/temp_sensor.c
index 799f4f609e..7f5a5e7a53 100644
--- a/common/temp_sensor.c
+++ b/common/temp_sensor.c
@@ -139,11 +139,22 @@ static int command_temps(int argc, char **argv)
for (i = 0; i < TEMP_SENSOR_COUNT; ++i) {
ccprintf(" %-20s: ", temp_sensors[i].name);
rv = temp_sensor_read(i, &t);
- if (rv) {
- ccprintf("Error %d\n", rv);
+ if (rv)
rv1 = rv;
- } else
+
+ switch (rv) {
+ case EC_SUCCESS:
ccprintf("%d K = %d C\n", t, t - 273);
+ break;
+ case EC_ERROR_NOT_POWERED:
+ ccprintf("Not powered\n");
+ break;
+ case EC_ERROR_NOT_CALIBRATED:
+ ccprintf("Not calibrated\n");
+ break;
+ default:
+ ccprintf("Error %d\n", rv);
+ }
}
return rv1;