From bcadefc89b159dd9bc70c1e1cd651c4ea03924d6 Mon Sep 17 00:00:00 2001 From: Paul Fagerburg Date: Tue, 6 Aug 2019 14:43:55 -0600 Subject: kohaku: add TEMP_SENSOR_3 and TEMP_SENSOR_4 to DPTF The Kohaku V24 schematic adds two additional temperature sensors to the EC. Add these to the DPTF tables. BRANCH=none BUG=b:138578073 TEST=Rebuild EC and BIOS, look for new thermal sensors in kernel. 1. Build EC ``cd ~/trunk/src/platform/ec`` ``make -j BOARD=kohaku`` 2. Program EC ``./util/flash_ec --board=kohaku`` 3. Reboot device 4. Rebuild BIOS ``cd ~/trunk/src/third_party/coreboot`` ``FEATURES="noclean" FW_NAME=kohaku emerge-hatch chromeos-ec depthcharge vboot_reference libpayload coreboot-private-files intel-cmlfsp coreboot-private-files-hatch coreboot chromeos-bootimage`` 5. Use flashrom to program the BIOS 6. Reboot device 7. Log into the root console (ctrl-alt-F2 or servo) 8. Example thermal sensor information ``grep . /sys/class/thermal/t*/type`` Look for "TSR0" through "TSR3" in the output. Change-Id: Ifb0cc83418e684cf6b2a66eb046267f07bf3e7f8 Signed-off-by: Paul Fagerburg Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1740186 Reviewed-by: Scott Collyer --- board/kohaku/board.c | 43 ++++++++++++++++++++++++++++++++++++++++++- board/kohaku/board.h | 4 ++++ board/kohaku/gpio.inc | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/board/kohaku/board.c b/board/kohaku/board.c index 9bc7609022..e7ef0933c4 100644 --- a/board/kohaku/board.c +++ b/board/kohaku/board.c @@ -372,6 +372,10 @@ const struct adc_t adc_channels[] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0}, [ADC_TEMP_SENSOR_2] = { "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0}, + [ADC_TEMP_SENSOR_3] = { + "TEMP_IA", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0}, + [ADC_TEMP_SENSOR_4] = { + "TEMP_GT", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0}, }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); @@ -386,10 +390,47 @@ const struct temp_sensor_t temp_sensors[] = { .read = get_temp_3v3_30k9_47k_4050b, .idx = ADC_TEMP_SENSOR_2, .action_delay_sec = 1}, + [TEMP_SENSOR_3] = {.name = "Temp3", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_3, + .action_delay_sec = 1}, + [TEMP_SENSOR_4] = {.name = "Temp4", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_4, + .action_delay_sec = 1}, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; +/* Kohaku Temperature sensors */ +/* + * TODO(b/138578073): These setting need to be reviewed and set appropriately + * for Kohaku. They matter when the EC is controlling the fan as opposed to DPTF + * control. + */ +const static struct ec_thermal_config thermal_a = { + .temp_host = { + [EC_TEMP_THRESH_WARN] = 0, + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), + [EC_TEMP_THRESH_HALT] = C_TO_K(80), + }, + .temp_host_release = { + [EC_TEMP_THRESH_WARN] = 0, + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), + [EC_TEMP_THRESH_HALT] = 0, + }, + .temp_fan_off = C_TO_K(25), + .temp_fan_max = C_TO_K(50), +}; + +struct ec_thermal_config thermal_params[] = { + [TEMP_SENSOR_1] = thermal_a, + [TEMP_SENSOR_2] = thermal_a, + [TEMP_SENSOR_3] = thermal_a, + [TEMP_SENSOR_4] = thermal_a, +}; +BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); enum gpio_signal gpio_en_pp5000_a = GPIO_EN_PP5000_A; diff --git a/board/kohaku/board.h b/board/kohaku/board.h index eb2a205465..3670f5a27b 100644 --- a/board/kohaku/board.h +++ b/board/kohaku/board.h @@ -136,6 +136,8 @@ extern enum gpio_signal gpio_en_pp5000_a; enum adc_channel { ADC_TEMP_SENSOR_1, /* ADC0 */ ADC_TEMP_SENSOR_2, /* ADC1 */ + ADC_TEMP_SENSOR_3, /* ADC2 */ + ADC_TEMP_SENSOR_4, /* ADC3 */ ADC_CH_COUNT }; @@ -158,6 +160,8 @@ enum pwm_channel { enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, + TEMP_SENSOR_3, + TEMP_SENSOR_4, TEMP_SENSOR_COUNT }; diff --git a/board/kohaku/gpio.inc b/board/kohaku/gpio.inc index 8ea88cc9ce..e105f5230a 100644 --- a/board/kohaku/gpio.inc +++ b/board/kohaku/gpio.inc @@ -141,7 +141,7 @@ ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UA ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* PWM3 - Keyboard backlight */ /* ADC */ -ALTERNATE(PIN_MASK(4, 0x30), 0, MODULE_ADC, 0) /* ADC0-1 */ +ALTERNATE(PIN_MASK(4, 0x3C), 0, MODULE_ADC, 0) /* ADC0-3 */ /* Power Switch Logic (PSL) inputs */ ALTERNATE(PIN_MASK(D, 0x04), 0, MODULE_PMU, 0) /* GPIOD2 = LID_OPEN */ -- cgit v1.2.1