From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.58749.1598894767667547438 for ; Mon, 31 Aug 2020 10:26:07 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 592CA1045; Mon, 31 Aug 2020 10:26:07 -0700 (PDT) Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 524973F66F; Mon, 31 Aug 2020 10:26:07 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: Jeremy Linton , Leif Lindholm , Pete Batard , Andrei Warkentin , Ard Biesheuvel , Samer El-Haj-Mahmoud Subject: [PATCH v4 4/6] Platform/RaspberryPi4: Create ACPI fan object Date: Mon, 31 Aug 2020 12:25:47 -0500 Message-Id: <20200831172549.24079-5-jeremy.linton@arm.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200831172549.24079-1-jeremy.linton@arm.com> References: <20200831172549.24079-1-jeremy.linton@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Now that we have a thermal zone we can add active cooling by specifying active cooling points (_ACx) which can be tied to fan objects that turn fans on/off using GPIO pins. Cc: Leif Lindholm Cc: Pete Batard Cc: Andrei Warkentin Cc: Ard Biesheuvel Cc: Samer El-Haj-Mahmoud Signed-off-by: Jeremy Linton Reviewed-by: Pete Batard <@pbatard> --- Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 1 + Platform/RaspberryPi/AcpiTables/SsdtThermal.asl | 76 +++++++++++++++++++++= ++++ 2 files changed, 77 insertions(+) create mode 100644 Platform/RaspberryPi/AcpiTables/SsdtThermal.asl diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/Rasp= berryPi/AcpiTables/AcpiTables.inf index 28d2afe197..c40c32e16f 100644 --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf @@ -33,6 +33,7 @@ Csrt.aslc=0D Spcr.aslc=0D Pptt.aslc=0D + SsdtThermal.asl=0D =0D [Packages]=0D ArmPkg/ArmPkg.dec=0D diff --git a/Platform/RaspberryPi/AcpiTables/SsdtThermal.asl b/Platform/Ras= pberryPi/AcpiTables/SsdtThermal.asl new file mode 100644 index 0000000000..ee028173e1 --- /dev/null +++ b/Platform/RaspberryPi/AcpiTables/SsdtThermal.asl @@ -0,0 +1,76 @@ +/** @file + * + * Secondary System Description Table (SSDT) for active (fan) cooling + * + * Copyright (c) 2020, Arm Ltd. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include +#include +#include + +#include + +DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPITHFAN", 2) +{ + External (\_SB_.EC00, DeviceObj) + External (\_SB_.EC00.TZ00, DeviceObj) + + Scope (\_SB_.EC00) + { + // Define a NameOp we will modify during InstallTable + Name (GIOP, 0x2) //08 47 49 4f 50 0a 02 (value must be >1) + // Describe a fan + PowerResource (PFAN, 0, 0) { + OperationRegion (GPIO, SystemMemory, GPIO_BASE_ADDRESS, 0x1000) + Field (GPIO, DWordAcc, NoLock, Preserve) { + Offset (0x1C), + GPS0, 32, + GPS1, 32, + RES1, 32, + GPC0, 32, + GPC1, 32, + RES2, 32, + GPL1, 32, + GPL2, 32 + } + // We are hitting a GPIO pin to on/off a fan. + // This assumes that UEFI has programmed the + // direction as OUT. Given the current limitations + // on the GPIO pins, its recommended to use + // the GPIO to switch a larger voltage/current + // for the fan rather than driving it directly. + Method (_STA) { + if (GPL1 & (1 << GIOP)) { + Return (1) // present and enabled + } + Return (0) + } + Method (_ON) { // turn fan on + Store (1 << GIOP, GPS0) + } + Method (_OFF) { // turn fan off + Store (1 << GIOP, GPC0) + } + } + Device (FAN0) { + // Note, not currently an ACPIv4 fan + // the latter adds speed control/detection + // but in the case of linux needs FIF, FPS, FSL, and FST + Name (_HID, EISAID ("PNP0C0B")) + Name (_PR0, Package () { PFAN }) + } + } + + // merge in an active cooling point. + Scope (\_SB_.EC00.TZ00) + { + Method (_AC0) { Return (3332) } // (60C) active cooling trip po= int, + // if this is lower than PSV th= en we + // prefer active cooling + Name (_AL0, Package () { \_SB_.EC00.FAN0 }) // the fan used for AC0 ab= ove + } +} --=20 2.13.7