diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2020-05-29 14:39:02 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-07-07 17:23:01 +0000 |
commit | 2ad8ffed6fc3d0865d8dc066dcbf6ef2e369794c (patch) | |
tree | 65b322f3ee2f04ab8ca8bfbf632ba260426cb4dd /src/acpi | |
parent | 46f6fcf88f2db397759f69d0c7ddf11d88b61e03 (diff) | |
download | coreboot-2ad8ffed6fc3d0865d8dc066dcbf6ef2e369794c.tar.xz |
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 <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41889
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src/acpi')
-rw-r--r-- | src/acpi/acpigen_dptf.c | 37 |
1 files changed, 37 insertions, 0 deletions
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 */ +} |