diff options
author | Jett Rink <jettrink@chromium.org> | 2018-06-12 15:30:26 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-06-15 10:56:45 -0700 |
commit | 727c5dad9bad954c4b62144dc1a536dccd281666 (patch) | |
tree | 70aae0aae09ec97919e61987a3ef289bfb3fd5ec /board/phaser | |
parent | 945109b4887fa0db5dd521c2a8a552ba2ca8376f (diff) | |
download | chrome-ec-727c5dad9bad954c4b62144dc1a536dccd281666.tar.gz |
phaser: add temperature sensors
Thermistors on phaser have the same nominal value, B value, and are in
the same resistor divider circuit. The same common lookup table should
apply here as well.
BRANCH=none
BUG=b:110106359
TEST=builds
Change-Id: I136a2c1b1c4cf671a149beb867154ae21bba0668
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1098022
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'board/phaser')
-rw-r--r-- | board/phaser/board.c | 23 | ||||
-rw-r--r-- | board/phaser/board.h | 12 |
2 files changed, 35 insertions, 0 deletions
diff --git a/board/phaser/board.c b/board/phaser/board.c index b2fcb11c09..4fdb56b64d 100644 --- a/board/phaser/board.c +++ b/board/phaser/board.c @@ -7,6 +7,7 @@ #include "adc.h" #include "adc_chip.h" +#include "charge_state.h" #include "common.h" #include "console.h" #include "cros_board_info.h" @@ -20,6 +21,9 @@ #include "power_button.h" #include "switch.h" #include "tcpci.h" +#include "temp_sensor.h" +#include "thermistor.h" +#include "util.h" static void tcpc_alert_event(enum gpio_signal signal) { @@ -61,6 +65,25 @@ const struct adc_t adc_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); +const struct temp_sensor_t temp_sensors[] = { + [TEMP_SENSOR_BATTERY] = {.name = "Battery", + .type = TEMP_SENSOR_TYPE_BATTERY, + .read = charge_get_battery_temp, + .idx = 0, + .action_delay_sec = 1}, + [TEMP_SENSOR_AMBIENT] = {.name = "Ambient", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_AMB, + .action_delay_sec = 5}, + [TEMP_SENSOR_CHARGER] = {.name = "Charger", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_13k7_47k_4050b, + .idx = ADC_TEMP_SENSOR_CHARGER, + .action_delay_sec = 1}, +}; +BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); + static void customize_based_on_board_id(void) { uint32_t board_id = 0; diff --git a/board/phaser/board.h b/board/phaser/board.h index 61d911af24..bcb8fcbe91 100644 --- a/board/phaser/board.h +++ b/board/phaser/board.h @@ -16,6 +16,11 @@ /* Optional features */ #define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */ +#define CONFIG_TEMP_SENSOR +#define CONFIG_THERMISTOR +#define CONFIG_STEINHART_HART_3V3_13K7_47K_4050B +#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B + #ifndef __ASSEMBLER__ #include "gpio_signal.h" @@ -27,6 +32,13 @@ enum adc_channel { ADC_CH_COUNT, }; +enum temp_sensor_id { + TEMP_SENSOR_BATTERY, + TEMP_SENSOR_AMBIENT, + TEMP_SENSOR_CHARGER, + TEMP_SENSOR_COUNT +}; + enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT |