summaryrefslogtreecommitdiff
path: root/board/npcx9_evb
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-06-03 16:23:50 -0600
committerCommit Bot <commit-bot@chromium.org>2021-06-07 13:51:53 +0000
commite0a14f2a16299e91c7fd29a7ee4f83bcfa406789 (patch)
tree58cea1f28c07c029fa43eff4da36bb34e7485f8e /board/npcx9_evb
parent40c9302f2e73be8009914fa6091a65b0d90c1300 (diff)
downloadchrome-ec-e0a14f2a16299e91c7fd29a7ee4f83bcfa406789.tar.gz
TMP112: Support multiple sensors
A board may have more than one TMP112, in which case we need an array to know which address to use for each sensor and for retrieving that sensor's last read temperature. BRANCH=None BUG=b:188539950 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If3ad286010698683f25825872bd8bfd53b8795e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2938044 Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Rob Barnes <robbarnes@google.com>
Diffstat (limited to 'board/npcx9_evb')
-rw-r--r--board/npcx9_evb/board.c9
-rw-r--r--board/npcx9_evb/board.h5
2 files changed, 13 insertions, 1 deletions
diff --git a/board/npcx9_evb/board.c b/board/npcx9_evb/board.c
index 5b72579be3..2a7b1e2945 100644
--- a/board/npcx9_evb/board.c
+++ b/board/npcx9_evb/board.c
@@ -81,9 +81,16 @@ const struct fan_t fans[] = {
BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
+/* TMP112 sensors. Must be in the exactly same order as in enum tmp112_sensor */
+const struct tmp112_sensor_t tmp112_sensors[] = {
+ { I2C_PORT_THERMAL, TMP112_I2C_ADDR_FLAGS0 },
+};
+BUILD_ASSERT(ARRAY_SIZE(tmp112_sensors) == TMP112_COUNT);
+
+/******************************************************************************/
/* Temperature sensor. */
const struct temp_sensor_t temp_sensors[] = {
- { "System", TEMP_SENSOR_TYPE_BOARD, tmp112_get_val, 0 },
+ { "System", TEMP_SENSOR_TYPE_BOARD, tmp112_get_val, TMP112_0 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/npcx9_evb/board.h b/board/npcx9_evb/board.h
index bec4e7f2c4..345f601e91 100644
--- a/board/npcx9_evb/board.h
+++ b/board/npcx9_evb/board.h
@@ -88,6 +88,11 @@ enum adc_channel {
ADC_CH_COUNT
};
+enum tmp112_sensor {
+ TMP112_0,
+ TMP112_COUNT,
+};
+
enum temp_sensor_id {
TEMP_SENSOR_SYSTHERM0, /* TMP100 */
TEMP_SENSOR_COUNT