summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKo_Ko <Ko_Ko@compal.corp-partner.google.com>2020-09-30 14:48:49 +0800
committerCommit Bot <commit-bot@chromium.org>2020-10-06 04:46:12 +0000
commitb536c348359487f0408a17af8d9d506f5a1d18a6 (patch)
tree39d5595942aaab817975055f90ac10fe80f0b57b
parent8005492bd201911633303fced48e0105dd41117e (diff)
downloadchrome-ec-stabilize-rust-13514.B-master.tar.gz
Madoo: Add thermistorsstabilize-rust-13514.B-master
This change adds the temperature sensors for madoo, which are hooked up to 2 of the ADCs. BUG=b:169729477 BRANCH=None TEST=build and test on madoo board. Can obtain value via ectool cmd. Signed-off-by: Ko_Ko <Ko_Ko@compal.corp-partner.google.com> Change-Id: Id57a669006db04f9a83ad3b6ebe65b2df7c80b11 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437723 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Ko Ko <ko_ko@compal.corp-partner.google.com> Tested-by: Ko Ko <ko_ko@compal.corp-partner.google.com>
-rw-r--r--board/madoo/board.c15
-rw-r--r--board/madoo/board.h12
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,