From cdcd824fa6f7b0a7b04ba9d7d9154aeee5938271 Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Tue, 23 Jun 2015 11:15:46 -0700 Subject: [PATCH] glados: Add battery temp to temp_sensors list. BUG=chrome-os-partner:15461 BUG=chrome-os-partner:40599 BRANCH=none TEST=Flashed EC image on glados and verified "temps" command on EC console displayed battery temperature. TEST=make -j buildall tests Change-Id: I1df6aab054aee0b5658a90ad736af7dc9a9679e3 Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/281213 Reviewed-by: Alec Berg Tested-by: Alec Berg Commit-Queue: Aseda Aboagye Trybot-Ready: Aseda Aboagye Tested-by: Shawn N --- board/glados/board.c | 16 ++++++++++++++++ board/glados/board.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/board/glados/board.c b/board/glados/board.c index 3bfc0139bb..123d478385 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -23,6 +23,7 @@ #include "power_button.h" #include "switch.h" #include "task.h" +#include "temp_sensor.h" #include "timer.h" #include "usb_charge.h" #include "usb_pd.h" @@ -169,6 +170,21 @@ struct motion_sensor_t motion_sensors[] = { }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); +const struct temp_sensor_t temp_sensors[] = { + {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_temp_sensor_get_val, 0, 4}, +}; +BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); + +/* + * Thermal limits for each temp sensor. All temps are in degrees K. Must be in + * same order as enum temp_sensor_id. To always ignore any temp, use 0. + */ +struct ec_thermal_config thermal_params[] = { + /* {Twarn, Thigh, Thalt}, fan_off, fan_max */ + {{0, 0, 0}, 0, 0}, /* Battery */ +}; +BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); + const struct button_config buttons[CONFIG_BUTTON_COUNT] = { { 0 }, { 0 }, diff --git a/board/glados/board.h b/board/glados/board.h index 5317c19e63..6768b61749 100644 --- a/board/glados/board.h +++ b/board/glados/board.h @@ -55,6 +55,7 @@ #define CONFIG_SPI_FLASH_SIZE 524288 #define CONFIG_SPI_FLASH_W25Q64 +#define CONFIG_TEMP_SENSOR /* * Allow dangerous commands. * TODO(shawnn): Remove this config before production. @@ -103,6 +104,13 @@ enum power_signal { POWER_SIGNAL_COUNT }; +enum temp_sensor_id { + /* Battery temperature sensor */ + TEMP_SENSOR_BATTERY, + + TEMP_SENSOR_COUNT +}; + /* start as a sink in case we have no other power supply/battery */ #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED