From f736ed2e60b751d5f4aaddc7fa804ac4ad21ccb9 Mon Sep 17 00:00:00 2001 From: Divya Sasidharan Date: Tue, 15 May 2018 16:31:27 -0700 Subject: [PATCH] yorp: Add battery temperature sensor BUG=b:79940719 BRANCH=None TEST=On yorp: Test if ectool tempsinfo all lists battery sensor. Change-Id: Ib70872cc8f91d322120714a9147dbdd8e40432aa Signed-off-by: Divya Sasidharan Reviewed-on: https://chromium-review.googlesource.com/1060577 Commit-Ready: Sumeet R Pawnikar Tested-by: Divya S Sasidharan Reviewed-by: Sumeet R Pawnikar Reviewed-by: Jett Rink --- board/yorp/board.c | 23 +++++++++++++++++++++-- board/yorp/board.h | 3 ++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/board/yorp/board.c b/board/yorp/board.c index 2b062171cd..388421ff29 100644 --- a/board/yorp/board.c +++ b/board/yorp/board.c @@ -169,8 +169,27 @@ int board_get_ambient_temp(int idx, int *temp_ptr) } const struct temp_sensor_t temp_sensors[] = { - {"Ambient", TEMP_SENSOR_TYPE_BOARD, board_get_ambient_temp, 0, 5}, - {"Charger", TEMP_SENSOR_TYPE_BOARD, board_get_charger_temp, 1, 1}, + { + .name = "Battery", + .type = TEMP_SENSOR_TYPE_BATTERY, + .read = charge_get_battery_temp, + .idx = 0, + .action_delay_sec = 1 + }, + { + .name = "Ambient", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = board_get_ambient_temp, + .idx = 0, + .action_delay_sec = 5 + }, + { + .name = "Charger", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = board_get_charger_temp, + .idx = 1, + .action_delay_sec = 1 + }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); diff --git a/board/yorp/board.h b/board/yorp/board.h index 85fa2130c2..9cd7e65909 100644 --- a/board/yorp/board.h +++ b/board/yorp/board.h @@ -60,7 +60,8 @@ enum adc_channel { }; enum temp_sensor_id { - TEMP_SENSOR_AMBIENT = 0, + TEMP_SENSOR_BATTERY, + TEMP_SENSOR_AMBIENT, TEMP_SENSOR_CHARGER, TEMP_SENSOR_COUNT };