summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohnwc_yeh <johnwc_yeh@compal.corp-partner.google.com>2021-05-13 13:24:19 +0800
committerCommit Bot <commit-bot@chromium.org>2021-05-13 18:42:29 +0000
commitb3dbf4f3bd30cc057801cad4d93ebca4d00331e7 (patch)
treea13297a518b4851922b9e4ead2c378bad5d0033d
parentc326589f9ba1f0b8a3a58020a4421c4ea8e66b6d (diff)
downloadchrome-ec-b3dbf4f3bd30cc057801cad4d93ebca4d00331e7.tar.gz
cret: Add thermistors
This change adds the temperature sensors for cret, which are hooked up to 2 of the ADCs. BUG=b:187894632 BRANCH=dedede TEST=build and test on cret board. Can obtain value via ectool cmd. Signed-off-by: johnwc_yeh <johnwc_yeh@compal.corp-partner.google.com> Change-Id: I7d07c36e80b95b149d503fd9e37999291c21d5f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2891675 Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/cret/board.c15
-rw-r--r--board/cret/board.h12
2 files changed, 27 insertions, 0 deletions
diff --git a/board/cret/board.c b/board/cret/board.c
index 9c156d03b5..bcba5138a9 100644
--- a/board/cret/board.c
+++ b/board/cret/board.c
@@ -20,6 +20,7 @@
#include "driver/charger/isl923x.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"
@@ -38,6 +39,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"
@@ -415,6 +417,19 @@ struct motion_sensor_t motion_sensors[] = {
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/cret/board.h b/board/cret/board.h
index eb7cd3faf1..e59292bd86 100644
--- a/board/cret/board.h
+++ b/board/cret/board.h
@@ -130,6 +130,12 @@
#define CONFIG_TABLET_MODE_SWITCH
#define CONFIG_GMR_TABLET_MODE
+/* 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"
@@ -149,6 +155,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_LED1_AMBER,