diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-10-11 11:21:00 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-10-11 14:24:40 -0700 |
commit | 23fe5ed867b2811a84171755137021608dda5777 (patch) | |
tree | ccff2ade4feb00e18ea4f10ff76634f11f8d8db7 | |
parent | 22e03a1de6d525e84e511f4b25531caf6f1a93fd (diff) | |
download | chrome-ec-23fe5ed867b2811a84171755137021608dda5777.tar.gz |
link: Added sensor-not-calibrated error for TMP006
BUG=chrome-os-partner:15174
BRANCH=link
TEST=manual, from root shell
- ectool temps all -> prints all temps
- ectool tmp006cal 1 0 0 0 0
- ectool temps all -> sensor 3 not calibrated
Change-Id: I16ee818c948fe90ac7c18b230c5d9f9a0ec83ded
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35288
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | common/temp_sensor.c | 3 | ||||
-rw-r--r-- | common/tmp006.c | 3 | ||||
-rw-r--r-- | include/ec_commands.h | 9 | ||||
-rw-r--r-- | util/ectool.c | 7 |
4 files changed, 18 insertions, 4 deletions
diff --git a/common/temp_sensor.c b/common/temp_sensor.c index ee1299f78d..799f4f609e 100644 --- a/common/temp_sensor.c +++ b/common/temp_sensor.c @@ -75,6 +75,9 @@ static void update_mapped_memory(void) case EC_ERROR_NOT_POWERED: *mptr = EC_TEMP_SENSOR_NOT_POWERED; break; + case EC_ERROR_NOT_CALIBRATED: + *mptr = EC_TEMP_SENSOR_NOT_CALIBRATED; + break; case EC_SUCCESS: *mptr = t - EC_TEMP_SENSOR_OFFSET; break; diff --git a/common/tmp006.c b/common/tmp006.c index d7407397a7..93d4d8c0de 100644 --- a/common/tmp006.c +++ b/common/tmp006.c @@ -135,6 +135,9 @@ static int tmp006_read_object_temp(const struct tmp006_data_t *tdata, if (tdata->fail) return EC_ERROR_UNKNOWN; + if (!tdata->s0) + return EC_ERROR_NOT_CALIBRATED; + v = tmp006_correct_object_voltage( t, tdata->t[(pidx + 3) & 3], diff --git a/include/ec_commands.h b/include/ec_commands.h index e8f406cae7..ee893c8065 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -96,10 +96,11 @@ * * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2. */ -#define EC_TEMP_SENSOR_B_ENTRIES 8 -#define EC_TEMP_SENSOR_NOT_PRESENT 0xff -#define EC_TEMP_SENSOR_ERROR 0xfe -#define EC_TEMP_SENSOR_NOT_POWERED 0xfd +#define EC_TEMP_SENSOR_B_ENTRIES 8 +#define EC_TEMP_SENSOR_NOT_PRESENT 0xff +#define EC_TEMP_SENSOR_ERROR 0xfe +#define EC_TEMP_SENSOR_NOT_POWERED 0xfd +#define EC_TEMP_SENSOR_NOT_CALIBRATED 0xfc /* * The offset of temperature value stored in mapped memory. This allows * reporting a temperature range of 200K to 454K = -73C to 181C. diff --git a/util/ectool.c b/util/ectool.c index fbfa9be214..9fb8a19635 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -730,6 +730,10 @@ int cmd_temperature(int argc, char *argv[]) case EC_TEMP_SENSOR_NOT_POWERED: fprintf(stderr, "Sensor %d disabled\n", id); break; + case EC_TEMP_SENSOR_NOT_CALIBRATED: + fprintf(stderr, "Sensor %d not calibrated\n", + id); + break; default: printf("%d: %d\n", id, rv + EC_TEMP_SENSOR_OFFSET); @@ -763,6 +767,9 @@ int cmd_temperature(int argc, char *argv[]) case EC_TEMP_SENSOR_NOT_POWERED: printf("Sensor disabled/unpowered\n"); return -1; + case EC_TEMP_SENSOR_NOT_CALIBRATED: + fprintf(stderr, "Sensor not calibrated\n"); + return -1; default: printf("%d\n", rv + EC_TEMP_SENSOR_OFFSET); return 0; |