From e4d8ebcef783f89fb9645d26d339dfb33065530f Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Fri, 29 May 2020 14:58:16 -0600 Subject: dptf: Add support for Fan and TSR options DPTF has several options on how to control the fan (fine-grained speed control, minimum speed change in percentage points, and whether or not the DPTF device should notify the Fan if it detects low speed). Individual TSRs can also set GTSH, which is the amount of hysteresis inherent in the measurement, either from circuitry (if analog), or in firmware (if digital). BUG=b:143539650 TEST=compiles Change-Id: I42d789d877da28c163e394d7de5fb1ff339264eb Signed-off-by: Tim Wawrzynczak Reviewed-on: https://review.coreboot.org/c/coreboot/+/41891 Tested-by: build bot (Jenkins) Reviewed-by: Duncan Laurie --- src/drivers/intel/dptf/dptf.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/drivers/intel/dptf/dptf.c') diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index 15a7d1297b..1fe9653eb7 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -62,6 +62,12 @@ static const char *dptf_acpi_name(const struct device *dev) static void dptf_fill_ssdt(const struct device *dev) { struct drivers_intel_dptf_config *config = config_of(dev); + enum dptf_participant p; + bool tsr_en[DPTF_MAX_TSR] = {false}; + int i; + + for (p = DPTF_TEMP_SENSOR_0, i = 0; p <= DPTF_TEMP_SENSOR_3; ++p, ++i) + tsr_en[i] = is_participant_used(config, p); dptf_write_active_policies(config->policies.active, DPTF_MAX_ACTIVE_POLICIES); @@ -77,6 +83,19 @@ static void dptf_fill_ssdt(const struct device *dev) dptf_write_fan_perf(config->controls.fan_perf, DPTF_MAX_FAN_PERF_STATES); dptf_write_power_limits(&config->controls.power_limits); + /* Fan options */ + dptf_write_fan_options(config->options.fan.fine_grained_control, + config->options.fan.step_size, + config->options.fan.low_speed_notify); + + /* TSR options */ + for (p = DPTF_TEMP_SENSOR_0, i = 0; p <= DPTF_TEMP_SENSOR_3; ++p, ++i) { + if (tsr_en[i]) { + dptf_write_tsr_hysteresis(config->options.tsr[i].hysteresis); + dptf_write_STR(config->options.tsr[i].desc); + } + } + printk(BIOS_INFO, "\\_SB.DPTF: %s at %s\n", dev->chip_ops->name, dev_path(dev)); } -- cgit v1.2.3