summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-05-20 00:01:25 -0700
committerCommit Bot <commit-bot@chromium.org>2021-08-27 01:27:33 +0000
commit4f9ecfc0861ec20e315934bce6e390b9ea4b3a3e (patch)
treebbb5a9d3f25f13f33bc9b7edf07c8ce0c8fd82be
parenteb67dbe36cac069f85962f9947fae27f5a2d25f1 (diff)
downloadchrome-ec-4f9ecfc0861ec20e315934bce6e390b9ea4b3a3e.tar.gz
brya: Support temp sensors on board ID 2
Brya board ID 2 has 4 temp sensors. This updates adc_channels, temp_sensors, and thermal_params accordingly. BRANCH=none BUG=b:183452273,b:181271666 TEST=verified tmep sensors report plausible values on board ID 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 > Cq-Depend: chromium:3116991 Change-Id: I5a973f8ad281f11713c64974ac2848a3655eee17 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3116989 Reviewed-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com> Reviewed-by: Boris Mittelberg <bmbm@google.com>
-rw-r--r--board/brya/board.h6
-rw-r--r--board/brya/sensors.c69
2 files changed, 64 insertions, 11 deletions
diff --git a/board/brya/board.h b/board/brya/board.h
index d7ca163bad..b7bb197c80 100644
--- a/board/brya/board.h
+++ b/board/brya/board.h
@@ -212,7 +212,7 @@
enum adc_channel {
ADC_TEMP_SENSOR_1_DDR_SOC,
- ADC_TEMP_SENSOR_2_FAN,
+ ADC_TEMP_SENSOR_2_AMBIENT,
ADC_TEMP_SENSOR_3_CHARGER,
ADC_TEMP_SENSOR_4_WWAN,
ADC_CH_COUNT
@@ -220,7 +220,9 @@ enum adc_channel {
enum temp_sensor_id {
TEMP_SENSOR_1_DDR_SOC,
- TEMP_SENSOR_2_FAN,
+ TEMP_SENSOR_2_AMBIENT,
+ TEMP_SENSOR_3_CHARGER,
+ TEMP_SENSOR_4_WWAN,
TEMP_SENSOR_COUNT
};
diff --git a/board/brya/sensors.c b/board/brya/sensors.c
index e80d5f912a..950194c50e 100644
--- a/board/brya/sensors.c
+++ b/board/brya/sensors.c
@@ -24,8 +24,8 @@ const struct adc_t adc_channels[] = {
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
},
- [ADC_TEMP_SENSOR_2_FAN] = {
- .name = "TEMP_FAN",
+ [ADC_TEMP_SENSOR_2_AMBIENT] = {
+ .name = "TEMP_AMBIENT",
.input_ch = NPCX_ADC_CH1,
.factor_mul = ADC_MAX_VOLT,
.factor_div = ADC_READ_MAX + 1,
@@ -274,13 +274,25 @@ const struct temp_sensor_t temp_sensors[] = {
.name = "DDR and SOC",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC,
},
- [TEMP_SENSOR_2_FAN] = {
- .name = "FAN",
+ [TEMP_SENSOR_2_AMBIENT] = {
+ .name = "Ambient",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_FAN
+ .idx = ADC_TEMP_SENSOR_2_AMBIENT,
+ },
+ [TEMP_SENSOR_3_CHARGER] = {
+ .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER,
+ },
+ [TEMP_SENSOR_4_WWAN] = {
+ .name = "WWAN",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_WWAN,
},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -317,7 +329,45 @@ static const struct ec_thermal_config thermal_cpu = {
* Inductors: limit of 125c
* PCB: limit is 80c
*/
-static const struct ec_thermal_config thermal_fan = {
+static const struct ec_thermal_config thermal_ambient = {
+ .temp_host = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75),
+ [EC_TEMP_THRESH_HALT] = C_TO_K(80),
+ },
+ .temp_host_release = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(65),
+ },
+ .temp_fan_off = C_TO_K(40),
+ .temp_fan_max = C_TO_K(55),
+};
+
+/*
+ * Inductor limits - used for both charger and PP3300 regulator
+ *
+ * Need to use the lower of the charger IC, PP3300 regulator, and the inductors
+ *
+ * Charger max recommended temperature 100C, max absolute temperature 125C
+ * PP3300 regulator: operating range -40 C to 145 C
+ *
+ * Inductors: limit of 125c
+ * PCB: limit is 80c
+ */
+const static struct ec_thermal_config thermal_charger = {
+ .temp_host = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75),
+ [EC_TEMP_THRESH_HALT] = C_TO_K(80),
+ },
+ .temp_host_release = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(65),
+ },
+ .temp_fan_off = C_TO_K(40),
+ .temp_fan_max = C_TO_K(55),
+};
+
+/*
+ * TODO(b/180681346): update for brya WWAN module
+ */
+static const struct ec_thermal_config thermal_wwan = {
.temp_host = {
[EC_TEMP_THRESH_HIGH] = C_TO_K(75),
[EC_TEMP_THRESH_HALT] = C_TO_K(80),
@@ -329,9 +379,10 @@ static const struct ec_thermal_config thermal_fan = {
.temp_fan_max = C_TO_K(55),
};
-/* this should really be "const" */
struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_1_DDR_SOC] = thermal_cpu,
- [TEMP_SENSOR_2_FAN] = thermal_fan,
+ [TEMP_SENSOR_2_AMBIENT] = thermal_ambient,
+ [TEMP_SENSOR_3_CHARGER] = thermal_charger,
+ [TEMP_SENSOR_4_WWAN] = thermal_wwan,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);