From 2ad8ffed6fc3d0865d8dc066dcbf6ef2e369794c Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Fri, 29 May 2020 14:39:02 -0600 Subject: dptf: Add support for Fan Performance States This change adds support for generating the _FPS table for the DPTF Fan object. The table describes different levels of fan activity that may be applied to the system in order to actively cool it. The information includes fan speed at a (rough) percentage level, fan speed in RPM, potential noise level in centibels, and power in mA. BUG=b:143539650 TEST=compiles Change-Id: I5591eb527f496d0c4c613352d2a87625d47d9273 Signed-off-by: Tim Wawrzynczak Reviewed-on: https://review.coreboot.org/c/coreboot/+/41889 Tested-by: build bot (Jenkins) Reviewed-by: Duncan Laurie --- src/acpi/acpigen_dptf.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/acpi') diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c index c18caf673e..6caf8bfcaf 100644 --- a/src/acpi/acpigen_dptf.c +++ b/src/acpi/acpigen_dptf.c @@ -12,6 +12,7 @@ enum { ART_REVISION = 0, DEFAULT_PRIORITY = 100, + DEFAULT_TRIP_POINT = 0xFFFFFFFFull, DEFAULT_WEIGHT = 100, DPTF_MAX_ART_THRESHOLDS = 10, }; @@ -321,3 +322,39 @@ void dptf_write_charger_perf(const struct dptf_charger_perf *states, int max_cou acpigen_pop_len(); /* Method PPSS */ acpigen_pop_len(); /* Scope */ } + +void dptf_write_fan_perf(const struct dptf_fan_perf *states, int max_count) +{ + char *pkg_count; + int i; + + if (!max_count || !states[0].percent) + return; + + dptf_write_scope(DPTF_FAN); + + /* _FPS - Fan Performance States */ + acpigen_write_name("_FPS"); + pkg_count = acpigen_write_package(0); + + for (i = 0; i < max_count; ++i) { + /* + * Some _FPS tables do include a last entry where Percent is 0, but Power is + * called out, so this table is finished when both are zero. + */ + if (!states[i].percent && !states[i].power) + break; + + (*pkg_count)++; + acpigen_write_package(5); + acpigen_write_integer(states[i].percent); + acpigen_write_integer(DEFAULT_TRIP_POINT); + acpigen_write_integer(states[i].speed); + acpigen_write_integer(states[i].noise_level); + acpigen_write_integer(states[i].power); + acpigen_pop_len(); /* inner Package */ + } + + acpigen_pop_len(); /* Package */ + acpigen_pop_len(); /* Scope */ +} -- cgit v1.2.3