diff options
-rw-r--r-- | board/sasuke/board.c | 16 | ||||
-rw-r--r-- | board/sasuke/board.h | 12 |
2 files changed, 28 insertions, 0 deletions
diff --git a/board/sasuke/board.c b/board/sasuke/board.c index 4f1afd4d4e..138926c936 100644 --- a/board/sasuke/board.c +++ b/board/sasuke/board.c @@ -19,6 +19,7 @@ #include "driver/retimer/nb7v904m.h" #include "driver/tcpm/raa489000.h" #include "driver/tcpm/tcpci.h" +#include "driver/temp_sensor/thermistor.h" #include "driver/usb_mux/pi3usb3x532.h" #include "extpower.h" #include "gpio.h" @@ -32,6 +33,7 @@ #include "switch.h" #include "system.h" #include "task.h" +#include "temp_sensor.h" #include "usb_mux.h" #include "usb_pd.h" #include "usb_pd_tcpm.h" @@ -108,6 +110,20 @@ const struct adc_t adc_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); +/* Thermistors */ +const struct temp_sensor_t temp_sensors[] = { + [TEMP_SENSOR_1] = {.name = "Memory", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_1}, + [TEMP_SENSOR_2] = {.name = "Charger", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_2}, +}; +BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); + + void board_init(void) { int on; diff --git a/board/sasuke/board.h b/board/sasuke/board.h index 84cfb4aaee..ccb430d947 100644 --- a/board/sasuke/board.h +++ b/board/sasuke/board.h @@ -57,6 +57,12 @@ /* PWM */ #define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */ +/* Thermistors */ +#define CONFIG_TEMP_SENSOR +#define CONFIG_THERMISTOR +#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B +#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_PP3300_A + /* USB */ #define CONFIG_BC12_DETECT_PI3USB9201 #define CONFIG_USBC_RETIMER_NB7V904M @@ -122,6 +128,12 @@ enum chg_id { CHARGER_NUM, }; +enum temp_sensor_id { + TEMP_SENSOR_1, + TEMP_SENSOR_2, + TEMP_SENSOR_COUNT +}; + enum adc_channel { ADC_TEMP_SENSOR_1, /* ADC0 */ ADC_TEMP_SENSOR_2, /* ADC1 */ |