summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-03-15 14:33:45 -0600
committerCommit Bot <commit-bot@chromium.org>2021-03-15 23:08:10 +0000
commit00cf3579a0e7fa9944f6b77821e05691ea5b4820 (patch)
treeddd5d36cd326d1e84375b5349ed9049811be00fa
parentdc368a591bc1c6f4bb4b480d4caf8eeb89872031 (diff)
downloadchrome-ec-00cf3579a0e7fa9944f6b77821e05691ea5b4820.tar.gz
Mancomb: Add TEMP_AMBIENT_VR
Add temperature sensor for ambient temperature. Additionally, simplify the temperature reads since all sensors are hooked up to the same PP3300_S5. BRANCH=None BUG=b:182601210 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I27b1a078e9bfe5db8e043eb9d5b9c7eb29cc1eaf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2762800 Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Rob Barnes <robbarnes@google.com>
-rw-r--r--baseboard/mancomb/base_gpio.inc1
-rw-r--r--baseboard/mancomb/baseboard.c44
-rw-r--r--baseboard/mancomb/baseboard.h3
3 files changed, 30 insertions, 18 deletions
diff --git a/baseboard/mancomb/base_gpio.inc b/baseboard/mancomb/base_gpio.inc
index 11de24fc57..c2a2dde336 100644
--- a/baseboard/mancomb/base_gpio.inc
+++ b/baseboard/mancomb/base_gpio.inc
@@ -64,6 +64,7 @@ ALTERNATE(/*TEMP_SOC|MEM*/ PIN_MASK(4, BIT(3) | BIT(5)), 0, MODULE_ADC, 0) /*
ALTERNATE( PIN_MASK(4, BIT(4)), 0, MODULE_ADC, 0) /* ANALOG_PPVAR_PWR_IN_IMON */
ALTERNATE( PIN_MASK(4, BIT(1) | BIT(2)), 0, MODULE_ADC, 0) /* EC_ADC_CORE_IMON1, EC_ADC_SOC_IMON2 */
ALTERNATE( PIN_MASK(3, BIT(7)), 0, MODULE_ADC, 0) /* SNS_PPVAR_PWR_IN */
+ALTERNATE( PIN_MASK(3, BIT(4)), 0, MODULE_ADC, 0) /* TEMP_AMBIENT_VR */
/* LED Signals */
GPIO(EC_DISABLE_DISP_BL, PIN(A, 6), GPIO_OUT_HIGH) /* Disable Display Backlight */
diff --git a/baseboard/mancomb/baseboard.c b/baseboard/mancomb/baseboard.c
index 80fd0b87c2..19172b4728 100644
--- a/baseboard/mancomb/baseboard.c
+++ b/baseboard/mancomb/baseboard.c
@@ -153,26 +153,37 @@ const struct adc_t adc_channels[] = {
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
},
+ [ADC_TEMP_SENSOR_AMBIENT] = {
+ .name = "AMBIENT",
+ .input_ch = NPCX_ADC_CH6,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temp Sensors */
-static int board_get_memory_temp(int, int *);
-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 = board_get_soc_temp,
+ .read = get_temp_3v3_30k9_47k_4050b,
.idx = TEMP_SENSOR_SOC,
},
[TEMP_SENSOR_MEMORY] = {
.name = "Memory",
.type = TEMP_SENSOR_TYPE_BOARD,
- .read = board_get_memory_temp,
+ .read = get_temp_3v3_30k9_47k_4050b,
.idx = TEMP_SENSOR_MEMORY,
},
+ [TEMP_SENSOR_AMBIENT] = {
+ .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = TEMP_SENSOR_AMBIENT,
+ },
[TEMP_SENSOR_CPU] = {
.name = "CPU",
.type = TEMP_SENSOR_TYPE_CPU,
@@ -205,6 +216,17 @@ struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = {
.temp_fan_off = 0,
.temp_fan_max = 0,
},
+ [TEMP_SENSOR_AMBIENT] = {
+ .temp_host = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(90),
+ [EC_TEMP_THRESH_HALT] = C_TO_K(92),
+ },
+ .temp_host_release = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
+ },
+ .temp_fan_off = 0,
+ .temp_fan_max = 0,
+ },
[TEMP_SENSOR_CPU] = {
.temp_host = {
[EC_TEMP_THRESH_HIGH] = C_TO_K(90),
@@ -612,20 +634,6 @@ void bc12_interrupt(enum gpio_signal signal)
}
}
-static int board_get_memory_temp(int idx, int *temp_k)
-{
- if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
- return EC_ERROR_NOT_POWERED;
- return get_temp_3v3_30k9_47k_4050b(idx, temp_k);
-}
-
-static int board_get_soc_temp(int idx, int *temp_k)
-{
- if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
- return EC_ERROR_NOT_POWERED;
- return get_temp_3v3_30k9_47k_4050b(idx, temp_k);
-}
-
/**
* b/175324615: On G3->S5, wait for RSMRST_L to be deasserted before asserting
* PCH_PWRBTN_L.
diff --git a/baseboard/mancomb/baseboard.h b/baseboard/mancomb/baseboard.h
index 5aeb82787b..afcdd3fd3c 100644
--- a/baseboard/mancomb/baseboard.h
+++ b/baseboard/mancomb/baseboard.h
@@ -77,6 +77,7 @@
#define CONFIG_THERMISTOR
#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_PWR_S5
/* Flash Config */
/* See config_chip-npcx9.h for SPI flash configuration */
@@ -255,6 +256,7 @@ enum adc_channel {
ANALOG_PPVAR_PWR_IN_IMON,
ADC_TEMP_SENSOR_MEMORY,
SNS_PPVAR_PWR_IN,
+ ADC_TEMP_SENSOR_AMBIENT,
ADC_CH_COUNT
};
@@ -262,6 +264,7 @@ enum adc_channel {
enum temp_sensor_id {
TEMP_SENSOR_SOC = 0,
TEMP_SENSOR_MEMORY,
+ TEMP_SENSOR_AMBIENT,
TEMP_SENSOR_CPU,
TEMP_SENSOR_COUNT
};