summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2021-01-05 17:10:31 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-19 05:51:26 +0000
commit06da8cbc7593528981c14ae23dd4b2748bd66b89 (patch)
treef0aaf608d86582a3bd3358965db12434070c1170 /baseboard
parent510297b805e9d76c99b72ac6e25053b153cab38d (diff)
downloadchrome-ec-06da8cbc7593528981c14ae23dd4b2748bd66b89.tar.gz
guybrush: hookup temp_sensors read function
get_temp_3v3_30k9_47k_4050b matches the voltage and resistance used in guybrush. Memory and charger thermistors are powered when EC is powered. SOC thermistor is not powered in G3 so an extra function is needed to guard against this case. BUG=None BRANCH=None TEST=Build Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I471d840c0442a022260c7e04704b46b8dc143767 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611519 Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/guybrush/baseboard.c21
-rw-r--r--baseboard/guybrush/baseboard.h3
2 files changed, 15 insertions, 9 deletions
diff --git a/baseboard/guybrush/baseboard.c b/baseboard/guybrush/baseboard.c
index 42804dbe68..b166167761 100644
--- a/baseboard/guybrush/baseboard.c
+++ b/baseboard/guybrush/baseboard.c
@@ -17,6 +17,7 @@
#include "driver/ppc/aoz1380.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/nct38xx.h"
+#include "driver/temp_sensor/sb_tsi.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
@@ -27,6 +28,7 @@
#include "power.h"
#include "temp_sensor.h"
#include "thermal.h"
+#include "thermistor.h"
#include "usb_mux.h"
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
@@ -160,30 +162,31 @@ const struct adc_t adc_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temp Sensors */
+static int board_get_soc_temp(int, int *);
const struct temp_sensor_t temp_sensors[] = {
[TEMP_SENSOR_SOC] = {
.name = "SOC",
.type = TEMP_SENSOR_TYPE_BOARD,
- .read = baseboard_get_temp,
+ .read = board_get_soc_temp,
.idx = TEMP_SENSOR_SOC,
},
[TEMP_SENSOR_CHARGER] = {
.name = "Charger",
.type = TEMP_SENSOR_TYPE_BOARD,
- .read = baseboard_get_temp,
+ .read = get_temp_3v3_30k9_47k_4050b,
.idx = TEMP_SENSOR_CHARGER,
},
[TEMP_SENSOR_MEMORY] = {
.name = "Memory",
.type = TEMP_SENSOR_TYPE_BOARD,
- .read = baseboard_get_temp,
+ .read = get_temp_3v3_30k9_47k_4050b,
.idx = TEMP_SENSOR_MEMORY,
},
[TEMP_SENSOR_CPU] = {
.name = "CPU",
.type = TEMP_SENSOR_TYPE_CPU,
- .read = baseboard_get_temp,
- .idx = TEMP_SENSOR_CPU,
+ .read = sb_tsi_get_val,
+ .idx = 0,
},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -236,6 +239,7 @@ struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = {
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
+
/*
* Battery info for all Guybrush battery types. Note that the fields
* start_charging_min/max and charging_min/max are not used for the charger.
@@ -603,10 +607,11 @@ void bc12_interrupt(enum gpio_signal signal)
}
}
-int baseboard_get_temp(int idx, int *temp_ptr)
+static int board_get_soc_temp(int idx, int *temp_k)
{
- /* TODO */
- return 0;
+ if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
+ return EC_ERROR_NOT_POWERED;
+ return get_temp_3v3_30k9_47k_4050b(idx, temp_k);
}
/**
diff --git a/baseboard/guybrush/baseboard.h b/baseboard/guybrush/baseboard.h
index abf3f412ef..07345765d7 100644
--- a/baseboard/guybrush/baseboard.h
+++ b/baseboard/guybrush/baseboard.h
@@ -50,8 +50,10 @@
/* Thermal Config */
#define CONFIG_ADC
+#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_THROTTLE_AP
#define CONFIG_TEMP_SENSOR_SB_TSI
+#define CONFIG_THERMISTOR
#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
/* Flash Config */
@@ -272,7 +274,6 @@ void bc12_interrupt(enum gpio_signal signal);
void ppc_interrupt(enum gpio_signal signal);
void sbu_fault_interrupt(enum ioex_signal signal);
-int baseboard_get_temp(int idx, int *temp_ptr);
void baseboard_en_pwr_pcore_s0(enum gpio_signal signal);
void baseboard_en_pwr_s0(enum gpio_signal signal);