diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2020-05-29 14:29:53 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-07-07 17:22:46 +0000 |
commit | 46f6fcf88f2db397759f69d0c7ddf11d88b61e03 (patch) | |
tree | c520011ec212b4fae6522f4f49b0f5149c10c15b /src/acpi | |
parent | 3a9cde9ab630fa34240b16f7e6ae10b5a61aa67e (diff) |
dptf: Add support for Charger Performance States
This change generates the DPTF TCHG.PPSS table in the SSDT. This table
describes different charging rates which are available to use. DPTF
can pick different rates in order to passively cool (or not) the
system.
BUG=b:143539650
TEST=compiles
Change-Id: I6df6bfbac628fa4e4d313e38b8e6c53fce70a7f2
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41888
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 | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c index 88cf386bc8..c18caf673e 100644 --- a/src/acpi/acpigen_dptf.c +++ b/src/acpi/acpigen_dptf.c @@ -7,6 +7,8 @@ #define TOPLEVEL_DPTF_SCOPE "\\_SB.DPTF" /* Defaults */ +#define DEFAULT_RAW_UNIT "ma" + enum { ART_REVISION = 0, DEFAULT_PRIORITY = 100, @@ -280,3 +282,42 @@ void dptf_write_critical_policies(const struct dptf_critical_policy *policies, i acpigen_pop_len(); /* Scope */ } } + +void dptf_write_charger_perf(const struct dptf_charger_perf *states, int max_count) +{ + char *pkg_count; + int i; + + if (!max_count || !states[0].control) + return; + + dptf_write_scope(DPTF_CHARGER); + + /* PPSS - Participant Performance Supported States */ + acpigen_write_method("PPSS", 0); + acpigen_emit_byte(RETURN_OP); + + pkg_count = acpigen_write_package(0); + for (i = 0; i < max_count; ++i) { + if (!states[i].control) + break; + + (*pkg_count)++; + + /* + * 0, 0, 0, 0, # Reserved + * Control, Raw Performance, Raw Unit, 0 # Reserved + */ + acpigen_write_package(8); + write_zeros(4); + acpigen_write_integer(states[i].control); + acpigen_write_integer(states[i].raw_perf); + acpigen_write_string(DEFAULT_RAW_UNIT); + acpigen_write_integer(0); + acpigen_pop_len(); /* inner Package */ + } + + acpigen_pop_len(); /* outer Package */ + acpigen_pop_len(); /* Method PPSS */ + acpigen_pop_len(); /* Scope */ +} |