diff options
author | Vic Yang <victoryang@chromium.org> | 2012-02-15 15:38:06 -0800 |
---|---|---|
committer | Vic Yang <victoryang@chromium.org> | 2012-02-18 13:37:53 +0800 |
commit | 0fefd25c0c7d6517f47aac2da974495f72312014 (patch) | |
tree | d67e0071040aa53f3b3922f2ca39cce6ed4e4617 /board/bds | |
parent | 737fbbd032ef937b37f2e5e833fa52455aa19c64 (diff) | |
download | chrome-ec-0fefd25c0c7d6517f47aac2da974495f72312014.tar.gz |
Temperature polling and temporal correction
A temperature polling task is added to achieve temporal correction and
also reduce the latency of reading temperature.
Factor out sensor specific part to keep code clean.
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:7801
TEST=On link, 'temps' shows all temperature readings.
Cover each sensor with hand and see object temperature rise.
Compilation succeeded on bds/adv/daisy/discovery.
Change-Id: I3c44c8b2e3ab2aa9ce640d3fc25e7fba56534b86
Diffstat (limited to 'board/bds')
-rw-r--r-- | board/bds/board.h | 6 | ||||
-rw-r--r-- | board/bds/board_temp_sensor.c | 16 | ||||
-rw-r--r-- | board/bds/ec.tasklist | 1 |
3 files changed, 19 insertions, 4 deletions
diff --git a/board/bds/board.h b/board/bds/board.h index 7bd484edaf..dc96aa73c2 100644 --- a/board/bds/board.h +++ b/board/bds/board.h @@ -8,6 +8,9 @@ #ifndef __BOARD_H #define __BOARD_H +/* Config flags */ +#define CONFIG_TMP006 + /* 66.667 Mhz clock frequency */ #define CPU_CLOCK 66666667 @@ -125,10 +128,13 @@ enum gpio_signal { enum temp_sensor_id { TEMP_SENSOR_EC_INTERNAL = 0, /* EC internal temperature sensor */ TEMP_SENSOR_CASE_DIE, + TEMP_SENSOR_OBJECT, TEMP_SENSOR_COUNT }; +#define TMP006_COUNT 1 + void configure_board(void); #endif /* __BOARD_H */ diff --git a/board/bds/board_temp_sensor.c b/board/bds/board_temp_sensor.c index 2efa002cb9..5bc9a154f5 100644 --- a/board/bds/board_temp_sensor.c +++ b/board/bds/board_temp_sensor.c @@ -9,14 +9,22 @@ #include "chip_temp_sensor.h" #include "board.h" #include "i2c.h" +#include "tmp006.h" +#include "util.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) +/* Temperature sensors data. Must be in the same order as enum + * temp_sensor_id. + */ const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = { - {"ECInternal", TEMP_SENSOR_NO_ADDR, - chip_temp_sensor_read, TEMP_SENSOR_NO_PRINT}, - {"CaseDie", TEMP_CASE_DIE_ADDR, - temp_sensor_tmp006_read_die_temp, temp_sensor_tmp006_print} + {"ECInternal", chip_temp_sensor_get_val, 0}, + {"CaseDie", tmp006_get_val, 0}, + {"Object", tmp006_get_val, 0}, +}; + +const struct tmp006_t tmp006_sensors[TMP006_COUNT] = { + {"TMP006", TEMP_CASE_DIE_ADDR}, }; diff --git a/board/bds/ec.tasklist b/board/bds/ec.tasklist index a56e6769e1..a17d39199f 100644 --- a/board/bds/ec.tasklist +++ b/board/bds/ec.tasklist @@ -15,6 +15,7 @@ */ #define CONFIG_TASK_LIST \ TASK(WATCHDOG, watchdog_task, NULL) \ + TASK(TEMPSENSOR, temp_sensor_task, NULL) \ TASK(KEYSCAN, keyboard_scan_task, NULL) \ TASK(POWERBTN, power_button_task, NULL) \ TASK(X86POWER, x86_power_task, NULL) \ |