summaryrefslogtreecommitdiff
path: root/board/bds
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2012-01-12 17:02:10 +0800
committerVic Yang <victoryang@google.com>2012-02-04 14:37:04 +0800
commit000a6d57423e96ffaa2061bd764b8141ea46bb8e (patch)
tree528dd0d5f798101470a1d45f9480bc7b2ecebcb0 /board/bds
parent249467b9f291e2b10a7aafdbb584c68c8b0a4e88 (diff)
downloadchrome-ec-000a6d57423e96ffaa2061bd764b8141ea46bb8e.tar.gz
Refactor temperature sensor code and add support of Link I2C temp sensor.
Refactor board/chip-specific code into corresponding directories. Add support of the four I2C temp sensor in Link. Use table lookup to handle different types of temperature sensors. BUG=chrome-os-partner:7527 TEST=Correctly read EC internal temperature on bds. Compile for link succeeded. Change-Id: I694cfa54e1545798d877fafdf18c5585ab5f03e2
Diffstat (limited to 'board/bds')
-rw-r--r--board/bds/board.h7
-rw-r--r--board/bds/board_temp_sensor.c22
-rw-r--r--board/bds/build.mk1
3 files changed, 30 insertions, 0 deletions
diff --git a/board/bds/board.h b/board/bds/board.h
index fbd4f153ca..e5cab1f212 100644
--- a/board/bds/board.h
+++ b/board/bds/board.h
@@ -117,6 +117,13 @@ enum gpio_signal {
GPIO_COUNT
};
+enum temp_sensor_id {
+ TEMP_SENSOR_EC_INTERNAL = 0, /* EC internal temperature sensor */
+ TEMP_SENSOR_CASE_DIE,
+
+ TEMP_SENSOR_COUNT
+};
+
void configure_board(void);
#endif /* __BOARD_H */
diff --git a/board/bds/board_temp_sensor.c b/board/bds/board_temp_sensor.c
new file mode 100644
index 0000000000..709ca8226a
--- /dev/null
+++ b/board/bds/board_temp_sensor.c
@@ -0,0 +1,22 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* BDS-specific temp sensor module for Chrome EC */
+
+#include "temp_sensor.h"
+#include "chip_temp_sensor.h"
+#include "board.h"
+#include "i2c.h"
+
+#define TEMP_CASE_DIE_REG_ADDR ((0x40 << 1) | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_CASE_DIE_ADDR \
+ TMP006_ADDR(I2C_PORT_THERMAL, TEMP_CASE_DIE_REG_ADDR)
+
+const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = {
+ {"ECInternal", TEMP_SENSOR_EC_INTERNAL, TEMP_SENSOR_NO_ADDR,
+ chip_temp_sensor_read, TEMP_SENSOR_NO_PRINT},
+ {"CaseDie", TEMP_SENSOR_CASE_DIE, TEMP_CASE_DIE_ADDR,
+ temp_sensor_tmp006_read, temp_sensor_tmp006_print}
+};
diff --git a/board/bds/build.mk b/board/bds/build.mk
index d026221342..c3fae48c4b 100644
--- a/board/bds/build.mk
+++ b/board/bds/build.mk
@@ -5,3 +5,4 @@
CHIP:=lm4
board-y=board.o
+board-$(CONFIG_TEMP_SENSOR)+=board_temp_sensor.o