From a90aebbf2a471b901bd1aa40e12e4f6a021b8ecc Mon Sep 17 00:00:00 2001 From: Tim Van Patten Date: Tue, 16 Aug 2022 12:09:23 -0600 Subject: soc/amd/acpi: Add low/no battery mode to DPTC Update acpigen_write_alib_dptc() to support "low/no battery mode", which throttles the SOC when there is no battery connected or the battery charge is critically low. This is in preparation for enabling this functionality for Mendocino. BUG=b:217911928 TEST=Build zork TEST=Boot nipperkin TEST=Boot skyrim Signed-off-by: Tim Van Patten Change-Id: Icea10a3876a29744ad8485be1557e184bcbfa397 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66804 Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/soc/amd/common/acpi/dptc.asl | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/soc/amd/common/acpi') diff --git a/src/soc/amd/common/acpi/dptc.asl b/src/soc/amd/common/acpi/dptc.asl index 611024cb02..e97aade50c 100644 --- a/src/soc/amd/common/acpi/dptc.asl +++ b/src/soc/amd/common/acpi/dptc.asl @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ External(\_SB.DDEF, MethodObj) +External(\_SB.DTHL, MethodObj) External(\_SB.DTAB, MethodObj) Scope (\_SB) @@ -13,6 +14,17 @@ Scope (\_SB) Return (Zero) } + /* If _SB.DTHL is not present, then DPTC Tablet Mode is not enabled. + * Throttle the SOC if the battery is not present (BTEX), the battery level is critical + * (BFCR), or the battery is cutoff (BFCT). */ + If (CondRefOf (\_SB.DTHL) && + (!\_SB.PCI0.LPCB.EC0.BTEX || \_SB.PCI0.LPCB.EC0.BFCR || \_SB.PCI0.LPCB.EC0.BFCT)) + { + \_SB.DTHL() + Return (Zero) + } + + /* If _SB.DTAB is not present, then DPTC Tablet Mode is not enabled. */ If (CondRefOf (\_SB.DTAB) && (\_SB.PCI0.LPCB.EC0.TBMD == One)) { \_SB.DTAB() -- cgit v1.2.3