Platform/RaspberryPi/AcpiTables/Dsdt.asl | 31 ++++++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 55 ++++++++++++++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 3 + .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 ++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++ .../RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl | 83 ++++++++++++++++++++++ Platform/RaspberryPi/Include/ConfigVars.h | 4 ++ Platform/RaspberryPi/RPi3/RPi3.dsc | 5 ++ Platform/RaspberryPi/RPi4/RPi4.dsc | 8 +++ Platform/RaspberryPi/RaspberryPi.dec | 1 + .../Bcm27xx/Include/IndustryStandard/Bcm2711.h | 2 + 11 files changed, 214 insertions(+) create mode 100644 Platform/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl
This set creates a basic thermal zone, which reads the SOC temp via a direct register read in AML. It also adds an active cooling policy using a GPIO pin for fan control that can optionally be enabled/disabled by the user from the BDS. With the fan enabled it should be possible to see the soc temp like: # sensors acpitz-acpi-0 Adapter: ACPI interface temp1: +57.6C (crit = +90.0C) and the fan state may be read/cycled with: /sys/bus/acpi/devices/PNP0C06:00/PNP0C0B:00/physical_node/thermal_cooling/cur_state Cc: Leif Lindholm <leif@nuviainc.com> Cc: Pete Batard <pete@akeo.ie> Cc: Andrei Warkentin <awarkentin@vmware.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com> Jeremy Linton (3): Platform/RaspberryPi4: Add a basic thermal zone Platform/RaspberryPi4: Create ACPI fan object Platform/RaspberryPi: Add entry for user fan control Platform/RaspberryPi/AcpiTables/Dsdt.asl | 31 ++++++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 55 ++++++++++++++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 3 + .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 ++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++ .../RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl | 83 ++++++++++++++++++++++ Platform/RaspberryPi/Include/ConfigVars.h | 4 ++ Platform/RaspberryPi/RPi3/RPi3.dsc | 5 ++ Platform/RaspberryPi/RPi4/RPi4.dsc | 8 +++ Platform/RaspberryPi/RaspberryPi.dec | 1 + .../Bcm27xx/Include/IndustryStandard/Bcm2711.h | 2 + 11 files changed, 214 insertions(+) create mode 100644 Platform/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl -- 2.13.7 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64256): https://edk2.groups.io/g/devel/message/64256 Mute This Topic: https://groups.io/mt/76178262/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
On 8/14/20 1:00 AM, Jeremy Linton wrote: > This set creates a basic thermal zone, which reads the > SOC temp via a direct register read in AML. It also > adds an active cooling policy using a GPIO pin for fan > control that can optionally be enabled/disabled by the > user from the BDS. > > With the fan enabled it should be possible to see the > soc temp like: > > # sensors > acpitz-acpi-0 > Adapter: ACPI interface > temp1: +57.6C (crit = +90.0C) > > and the fan state may be read/cycled with: > > /sys/bus/acpi/devices/PNP0C06:00/PNP0C0B:00/physical_node/thermal_cooling/cur_state > > Cc: Leif Lindholm <leif@nuviainc.com> > Cc: Pete Batard <pete@akeo.ie> > Cc: Andrei Warkentin <awarkentin@vmware.com> > Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> > Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com> > > Jeremy Linton (3): > Platform/RaspberryPi4: Add a basic thermal zone > Platform/RaspberryPi4: Create ACPI fan object > Platform/RaspberryPi: Add entry for user fan control > I like this code a lot. It is very helpful to have working sample AML code that implements a thermal zone. Could you elaborate on the additional components that are needed for this? Is this a standard cape (or whatever rpi calls it)? I assume the fan just switches between 0 and max rpm depending on the actual temp wrt the trip point? > Platform/RaspberryPi/AcpiTables/Dsdt.asl | 31 ++++++++ > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 55 ++++++++++++++ > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 3 + > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 ++ > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++ > .../RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl | 83 ++++++++++++++++++++++ > Platform/RaspberryPi/Include/ConfigVars.h | 4 ++ > Platform/RaspberryPi/RPi3/RPi3.dsc | 5 ++ > Platform/RaspberryPi/RPi4/RPi4.dsc | 8 +++ > Platform/RaspberryPi/RaspberryPi.dec | 1 + > .../Bcm27xx/Include/IndustryStandard/Bcm2711.h | 2 + > 11 files changed, 214 insertions(+) > create mode 100644 Platform/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64320): https://edk2.groups.io/g/devel/message/64320 Mute This Topic: https://groups.io/mt/76178262/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi, On 8/17/20 9:31 AM, Ard Biesheuvel via groups.io wrote: > On 8/14/20 1:00 AM, Jeremy Linton wrote: >> This set creates a basic thermal zone, which reads the >> SOC temp via a direct register read in AML. It also >> adds an active cooling policy using a GPIO pin for fan >> control that can optionally be enabled/disabled by the >> user from the BDS. >> >> With the fan enabled it should be possible to see the >> soc temp like: ^ That should have read something like: "Even without the fan enabled it is possible to see the SOC temp like:" >> >> # sensors >> acpitz-acpi-0 >> Adapter: ACPI interface >> temp1: +57.6C (crit = +90.0C) >> >> and the fan state may be read/cycled with: >> >> /sys/bus/acpi/devices/PNP0C06:00/PNP0C0B:00/physical_node/thermal_cooling/cur_state >> >> >> Cc: Leif Lindholm <leif@nuviainc.com> >> Cc: Pete Batard <pete@akeo.ie> >> Cc: Andrei Warkentin <awarkentin@vmware.com> >> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> >> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com> >> >> Jeremy Linton (3): >> Platform/RaspberryPi4: Add a basic thermal zone >> Platform/RaspberryPi4: Create ACPI fan object >> Platform/RaspberryPi: Add entry for user fan control >> > > I like this code a lot. It is very helpful to have working sample AML > code that implements a thermal zone. Could you elaborate on the > additional components that are needed for this? Is this a standard cape > (or whatever rpi calls it)? I assume the fan just switches between 0 and > max rpm depending on the actual temp wrt the trip point? I've got something similar to this circuit: https://www.raspberrypi.org/forums/viewtopic.php?t=194621#p1220502 wired up. There are a number of variations on the web (https://www.instructables.com/id/PWM-Regulated-Fan-Based-on-CPU-Temperature-for-Ras/), frequently including python control scripts, which are unnecessary given this AML/patch. Most of the variation is simply matching an appropriate resistor between the GPIO and transistor base for the given transistor's gain. A board which implements a similar circuit can be purchased here: https://shop.pimoroni.com/products/fan-shim Most of these circuits are designed for simple On/Off control. So as it stands, the kernel calls the ON() method, when it polls the zone temp, and discovers that it exceeds the active cooling threshold. Or the OFF() if the temp falls below. The slow polling and large heatsink on my rpi tends to keep it from excessive hunting/cycling since the kernel doesn't implement much in the way of hysteresis control. The GPIO pin I selected also (AFAIK) has a PWM function that could be leveraged in the future for variable speed control. That said, most of these little 5V fans seem to be basically silent (well the ones I have, or they are 12V already running at low voltage), so there is little advantage to slowing them down. The big variation is which GPIO controls the fan. This patch at the moment has a #define setting the pin, but the general plan was to add some additional user controllable options for board/GPIO pin selection. Originally I was planning on just compiling the ASL multiple times for each GPIO and then picking one at runtime, but now I'm thinking dynamically editing the binary AML before calling InstallTable() on it might be a better choice to reduce bloat. A few of the fan boards/cases implement their own fan controllers with programmable thermal profiles over I2C. This patch won't support those boards. (yet! :) > > > >> Platform/RaspberryPi/AcpiTables/Dsdt.asl | 31 ++++++++ >> Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 55 ++++++++++++++ >> .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 3 + >> .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 ++ >> .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++ >> .../RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl | 83 >> ++++++++++++++++++++++ >> Platform/RaspberryPi/Include/ConfigVars.h | 4 ++ >> Platform/RaspberryPi/RPi3/RPi3.dsc | 5 ++ >> Platform/RaspberryPi/RPi4/RPi4.dsc | 8 +++ >> Platform/RaspberryPi/RaspberryPi.dec | 1 + >> .../Bcm27xx/Include/IndustryStandard/Bcm2711.h | 2 + >> 11 files changed, 214 insertions(+) >> create mode 100644 >> Platform/RaspberryPi/Drivers/ConfigDxe/SsdtThermal.asl >> > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64332): https://edk2.groups.io/g/devel/message/64332 Mute This Topic: https://groups.io/mt/76178262/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.