From nobody Tue Feb 10 06:26:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+64258+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64258+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1597359704; cv=none; d=zohomail.com; s=zohoarc; b=Y8IDEsdAnb6MEGpYihbNSriuWSVpfi6cNMTemoc/lVZ3L1g7NPASwadlMY0LzYEwGPQipK6ZpO8CKFmZNm2Ttp38R1rHv+5ZFIhMkiyJgzDf3w/SxD+VWWwVDHw5vcjzsDNrByEHlzkGLhPSGwaB/LP9RJGxDbYyfKyvrpXT25k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597359704; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gnBoCXhgtnOuiBe1j1SO2kirsZShR0C6W4BSQ/eMDzM=; b=GpZlRVLxCUxcaq3Jl4Gysa5haL8gxs01ohklVLW6VFnBmURfLAiaZtxJBpPNoyUOrUfThiEIJ234YKFPp8eW5DO43G6U0Bvd1LLd0cq3Gz0ojMma+imbgLQzc/fJKj618PZFqtQ73xK0XQkleAT7xoEy3JHJxj10JGAEXIZfAKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64258+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1597359704136910.8898309392827; Thu, 13 Aug 2020 16:01:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id i8wVYY1788612x40ZSbX6Lme; Thu, 13 Aug 2020 16:01:43 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.7167.1597359702140890521 for ; Thu, 13 Aug 2020 16:01:42 -0700 X-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 B8CB1113E; Thu, 13 Aug 2020 16:01:41 -0700 (PDT) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6BF8B3F22E; Thu, 13 Aug 2020 16:01:41 -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: [edk2-devel] [PATCH 2/3] Platform/RaspberryPi4: Create ACPI fan object Date: Thu, 13 Aug 2020 18:00:55 -0500 Message-Id: <20200813230056.40526-3-jeremy.linton@arm.com> In-Reply-To: <20200813230056.40526-1-jeremy.linton@arm.com> References: <20200813230056.40526-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: x5aVBDn1oGEqFrydkd8Kinfpx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1597359703; bh=DZEeG3nXKM9X2fYAkCYZ751VGBOkqnaUH3ZLXgQqVDo=; h=Cc:Date:From:Reply-To:Subject:To; b=qrDmXa1uqEE13B9su24pLXQOaPEMzq1XPaMQGrLbHNVejypalCr+3y1AYDOlwJIZhfj gnBTutvx5hiIgWAhD8zq2Yam0YLLwj15ObTJ+Jk9kQFzbVDXXYAgVDXxCXtEkJBE0EwFm VMw1leYTxywEuImRfrZiOZISSFFcDQZnheU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 --- .../RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl | 83 ++++++++++++++++++= ++++ 1 file changed, 83 insertions(+) create mode 100644 Platform/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl b/Platf= orm/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl new file mode 100644 index 0000000000..c87bda6dbc --- /dev/null +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl @@ -0,0 +1,83 @@ +/** @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) +{ +#if (GPIO_FAN_PIN !=3D 0) + External(\_SB_.EC0, DeviceObj) + External(\_SB_.EC0.TZ0, DeviceObj) + + Scope (\_SB_.EC0) + { + // 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 the fan + // this assumes that UEFI has programmed the + // direction as OUT. + // (search "rpi gpio fan controller" for how to + // wire this up if your not electrically inclined + // the basic idea is to use a BJT/etc to switch a + // larger voltage through a fan where the GPIO pin + // feeds a NPN/PNP base. Thats because its unlikly + // that the fan can be driven directly from the GPIO + // pin due to hitting the current limit on the pins. + // Matching a resistor between the GPIO->Base can + // allow pretty much any random NPN with a reasonable + // EC current to work (to limit the GPIO current).) + Method (_STA) { + if ( GPL1 & (1 << GPIO_FAN_PIN) ) { + Return ( 1 ) // present and enabled + } + Return ( 0 ) + } + Method (_ON) { //turn fan on + Store((1 << GPIO_FAN_PIN), GPS0) + } + Method (_OFF) { //turn fan off + Store((1 << GPIO_FAN_PIN), GPC0) + } + } + Device(FAN) { + // 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_.EC0.TZ0) + { + Method(_AC0) { return(3332) } // (60K) active cooling trip poin= t, + // if this is lower than PSV then= we + // prefer active cooling + Name(_AL0, Package(){\_SB_.EC0.FAN}) // the fan used for AC0 above + } +#endif +} --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64258): https://edk2.groups.io/g/devel/message/64258 Mute This Topic: https://groups.io/mt/76178275/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-