From 9802a28f19df1e0e948d085b6bdfe99f2698eda6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 11 Jan 2018 17:23:41 -0800 Subject: grunt: Enable the CPU temperature sensor Set this up so we can measure the CPU temperature. BUG=b:71868256 BRANCH=none TEST=on EC: > temps Charger : 312 K = 39 C SOC : 321 K = 48 C CPU : 331 K = 58 C CPU shows 58 C (which seems a lot cooler than it actually is) Change-Id: Ia625e36b95a566aa436eff751c2ebf5863d984ad Signed-off-by: Simon Glass Reviewed-on: https://chromium-review.googlesource.com/862885 Reviewed-by: Edward Hill Reviewed-by: Justin TerAvest --- board/grunt/board.c | 2 ++ board/grunt/board.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/board/grunt/board.c b/board/grunt/board.c index 8f03880128..92b1a69eb5 100644 --- a/board/grunt/board.c +++ b/board/grunt/board.c @@ -20,6 +20,7 @@ #include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx74xx.h" #include "driver/tcpm/ps8xxx.h" +#include "driver/temp_sensor/sb_tsi.h" #include "ec_commands.h" #include "extpower.h" #include "gpio.h" @@ -415,6 +416,7 @@ static int board_get_temp(int idx, int *temp_k) const struct temp_sensor_t temp_sensors[] = { {"Charger", TEMP_SENSOR_TYPE_BOARD, board_get_temp, 0, 1}, {"SOC", TEMP_SENSOR_TYPE_BOARD, board_get_temp, 1, 5}, + {"CPU", TEMP_SENSOR_TYPE_CPU, sb_tsi_get_val, 0, 4}, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); diff --git a/board/grunt/board.h b/board/grunt/board.h index 117da4eb3f..5175424082 100644 --- a/board/grunt/board.h +++ b/board/grunt/board.h @@ -133,6 +133,9 @@ #define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL #define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +/* Thermal */ +#define CONFIG_TEMP_SENSOR_SB_TSI + /* FIFO size is a power of 2. */ #define CONFIG_ACCEL_FIFO 1024 /* TODO(teravest): Check this value. */ @@ -162,6 +165,7 @@ enum power_signal { enum temp_sensor_id { TEMP_SENSOR_CHARGER = 0, TEMP_SENSOR_SOC, + TEMP_SENSOR_CPU, TEMP_SENSOR_COUNT }; -- cgit v1.2.1