From 8f886b40f4335a43bde5da9096308ae91935c7eb Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Fri, 27 May 2016 13:01:03 -0700 Subject: lucid: Add battery temp to temp_sensors list BUG=none BRANCH=none TEST=verify "ectool temps 0" displays the battery temperature Change-Id: If8f58886f84b2aaffd8a517bf85633c34c9b7ca2 Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/347990 Reviewed-by: Aseda Aboagye Reviewed-by: Shawn N --- board/lucid/board.c | 16 ++++++++++++++++ board/lucid/board.h | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/board/lucid/board.c b/board/lucid/board.c index 86a423b653..f2c5467f87 100644 --- a/board/lucid/board.c +++ b/board/lucid/board.c @@ -18,6 +18,7 @@ #include "led_common.h" #include "registers.h" #include "task.h" +#include "temp_sensor.h" #include "usb_charge.h" #include "usb_pd.h" #include "util.h" @@ -142,6 +143,21 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); +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); + /* Initialize board. */ static void board_init(void) { diff --git a/board/lucid/board.h b/board/lucid/board.h index 2163d28517..f063ad9c7c 100644 --- a/board/lucid/board.h +++ b/board/lucid/board.h @@ -52,6 +52,7 @@ #define CONFIG_STM_HWTIMER32 #define CONFIG_STM32_CHARGER_DETECT #undef CONFIG_TASK_PROFILING +#define CONFIG_TEMP_SENSOR #define CONFIG_USB_POWER_DELIVERY #define CONFIG_USB_PD_ALT_MODE #define CONFIG_USB_PD_ALT_MODE_DFP @@ -100,6 +101,12 @@ enum adc_channel { ADC_CH_COUNT }; +enum temp_sensor_id { + TEMP_SENSOR_BATTERY, + + TEMP_SENSOR_COUNT +}; + #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED /* we are never a source : don't care about power supply */ -- cgit v1.2.1