summaryrefslogtreecommitdiff
path: root/board/brya/sensors.c
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-08-23 18:23:00 -0700
committerCommit Bot <commit-bot@chromium.org>2021-08-27 01:27:51 +0000
commitbc1eadcd1df76ee9d698a3ce531b422654760726 (patch)
tree5da7a178ccc23ee61a9786e472a9722e8882b942 /board/brya/sensors.c
parent1943b1cb01ac1ee67cd8cfead61a2f1acdcdff08 (diff)
downloadchrome-ec-bc1eadcd1df76ee9d698a3ce531b422654760726.tar.gz
brya: Tune thermal_params, adc_channels for board ID 1
BRANCH=none BUG=b:183452273,b:181271666 TEST=verified tmep sensors report plausible values on board ID 1 and 2: > adc TEMP_DDR_SOC = 1749 mV TEMP_AMBIENT = 1749 mV TEMP_CHARGER = 1556 mV TEMP_WWAN = 1815 mV > > temps DDR and SOC : 304 K = 31 C 0% Ambient : 304 K = 31 C 0% Charger : 310 K = 37 C 0% WWAN : 302 K = 29 C 0% > > thermalget sensor warn high halt fan_off fan_max name 0 0 343 353 308 323 DDR and SOC 1 0 348 353 313 328 Ambient 2 0 348 353 313 328 Charger 3 0 348 353 313 328 WWAN > also, on board ID 1: > adc TEMP_DDR_SOC = 1784 mV TEMP_AMBIENT = 1168 mV TEMP_CHARGER = 1168 mV TEMP_WWAN = 1168 mV > > temps DDR and SOC : 303 K = 30 C 0% Ambient : 322 K = 49 C 60% Charger : 322 K = 49 C 60% WWAN : 322 K = 49 C 60% > > thermalget sensor warn high halt fan_off fan_max name 0 0 343 353 308 323 DDR and SOC 1 0 348 353 313 328 Ambient 2 0 348 353 313 328 Charger 3 0 348 353 313 328 WWAN > We simply see ambient, charger, WWAN report the same sensor. Change-Id: I1d6dd171b09ea2ebb22193d52ae57804920d740c Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3116991 Reviewed-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com> Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'board/brya/sensors.c')
-rw-r--r--board/brya/sensors.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/board/brya/sensors.c b/board/brya/sensors.c
index 55f6e6906c..6eebc070d2 100644
--- a/board/brya/sensors.c
+++ b/board/brya/sensors.c
@@ -16,7 +16,7 @@
#include "temp_sensor/thermistor.h"
/* ADC configuration */
-const struct adc_t adc_channels[] = {
+struct adc_t adc_channels[] = {
[ADC_TEMP_SENSOR_1_DDR_SOC] = {
.name = "TEMP_DDR_SOC",
.input_ch = NPCX_ADC_CH0,
@@ -386,3 +386,20 @@ struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_4_WWAN] = thermal_wwan,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
+
+static void board_thermals_init(void)
+{
+ if (get_board_id() == 1) {
+ /*
+ * Board ID 1 only has 3 sensors and the AMBIENT sensor
+ * ADC pins have been reassigned, so we're down to 2
+ * sensors that can easily be configured. So, alias the
+ * AMBIENT sensor ADC channel to the unimplemented ADC
+ * slots.
+ */
+ adc_channels[ADC_TEMP_SENSOR_3_CHARGER].input_ch = NPCX_ADC_CH1;
+ adc_channels[ADC_TEMP_SENSOR_4_WWAN].input_ch = NPCX_ADC_CH1;
+ }
+}
+
+DECLARE_HOOK(HOOK_INIT, board_thermals_init, HOOK_PRIO_INIT_CHIPSET);