summaryrefslogtreecommitdiff
path: root/include/temp_sensor.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-11 10:23:16 -0700
committerGerrit <chrome-bot@google.com>2012-10-11 13:47:17 -0700
commit8f2e99da75152c428c6c92b20a13a62a5fcb40d1 (patch)
treec2d3dc52372a79a03c2d503c55ead568c066a7e1 /include/temp_sensor.h
parentd1bebbbe66f78d2dcfb9380456a80e7c2f26a662 (diff)
downloadchrome-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 'include/temp_sensor.h')
-rw-r--r--include/temp_sensor.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/temp_sensor.h b/include/temp_sensor.h
index db3a8536e9..9de57a0c71 100644
--- a/include/temp_sensor.h
+++ b/include/temp_sensor.h
@@ -38,8 +38,8 @@ struct temp_sensor_t {
int8_t power_flags;
/* Temperature sensor type. */
enum temp_sensor_type type;
- /* Read sensor value and return temperature in K. */
- int (*read)(int idx);
+ /* Read sensor value in K into temp_ptr; return non-zero if error. */
+ int (*read)(int idx, int *temp_ptr);
/* Index among the same kind of sensors. */
int idx;
/* Delay between reading temperature and taking action about it,
@@ -47,9 +47,15 @@ struct temp_sensor_t {
int action_delay_sec;
};
-/* Return the most recently measured temperature for the sensor in K,
- * or -1 if error. */
-int temp_sensor_read(enum temp_sensor_id id);
+/**
+ * Get the most recently measured temperature for the sensor.
+ *
+ * @param id Sensor ID
+ * @param temp_ptr Destination for temperature
+ *
+ * @return EC_SUCCESS, or non-zero if error.
+ */
+int temp_sensor_read(enum temp_sensor_id id, int *temp_ptr);
/* Return non-zero if sensor is powered. */
int temp_sensor_powered(enum temp_sensor_id id);