summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/temp_sensor.c3
-rw-r--r--common/tmp006.c3
-rw-r--r--include/ec_commands.h9
-rw-r--r--util/ectool.c7
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;