diff options
-rw-r--r-- | board/madoo/board.c | 15 | ||||
-rw-r--r-- | board/madoo/board.h | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/board/madoo/board.c b/board/madoo/board.c index 75e705cd76..9ced2a0ecb 100644 --- a/board/madoo/board.c +++ b/board/madoo/board.c @@ -22,6 +22,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" @@ -40,6 +41,7 @@ #include "system.h" #include "tablet_mode.h" #include "task.h" +#include "temp_sensor.h" #include "usb_mux.h" #include "usb_pd.h" #include "usb_pd_tcpm.h" @@ -392,6 +394,19 @@ struct motion_sensor_t motion_sensors[] = { const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); +/* 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); + __override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki, int *ki_div, int *kd, int *kd_div) diff --git a/board/madoo/board.h b/board/madoo/board.h index 3685a1017f..100e39e842 100644 --- a/board/madoo/board.h +++ b/board/madoo/board.h @@ -110,6 +110,12 @@ #define CONFIG_USB_MUX_RUNTIME_CONFIG +/* 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 + #ifndef __ASSEMBLER__ #include "gpio_signal.h" @@ -136,6 +142,12 @@ enum sensor_id { SENSOR_COUNT }; +enum temp_sensor_id { + TEMP_SENSOR_1, + TEMP_SENSOR_2, + TEMP_SENSOR_COUNT +}; + enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT, |