public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pete Batard" <pete@akeo.ie>
To: Jeremy Linton <jeremy.linton@arm.com>, devel@edk2.groups.io
Cc: Leif Lindholm <leif@nuviainc.com>,
	Andrei Warkentin <awarkentin@vmware.com>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Subject: Re: [PATCH v3 4/5] Platform/RaspberryPi4: Create ACPI fan object
Date: Mon, 31 Aug 2020 14:17:39 +0100	[thread overview]
Message-ID: <24f61aff-0815-28f6-6cba-1f6a9f817d56@akeo.ie> (raw)
In-Reply-To: <20200828220215.101919-5-jeremy.linton@arm.com>

3 non-blocking whitespace in comments remarks, for consistency.

And of course, same non blocking general remark as 1/5 of whether we may 
ultimately prefer to go with 4-char names for EC0/TZ0...

On 2020.08.28 23:02, Jeremy Linton wrote:
> 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 <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>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> 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/RaspberryPi/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
> 
>     Spcr.aslc
> 
>     Pptt.aslc
> 
> +  SsdtThermal.asl
> 
>   
> 
>   [Packages]
> 
>     ArmPkg/ArmPkg.dec
> 
> diff --git a/Platform/RaspberryPi/AcpiTables/SsdtThermal.asl b/Platform/RaspberryPi/AcpiTables/SsdtThermal.asl
> new file mode 100644
> index 0000000000..28c88cd640
> --- /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 <IndustryStandard/Bcm2711.h>
> +#include <IndustryStandard/Bcm2836.h>
> +#include <IndustryStandard/Bcm2836Gpio.h>
> +
> +#include <IndustryStandard/Acpi.h>
> +
> +DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPITHFAN", 2)
> +{
> +  External (\_SB_.EC0, DeviceObj)
> +  External (\_SB_.EC0.TZ0, DeviceObj)
> +
> +  Scope (\_SB_.EC0)
> +  {
> +    // Define a NameOp we will modify during InstallTable
> +    Name (GIOP, 0x2) //08 47 49 4f 50 0a 02 (value must be >1)

To be consistent with the other comments I'd put a space after //

> +    // 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

Space after //

> +        Store (1 << GIOP, GPS0)
> +      }
> +      Method (_OFF) {                //turn fan off

Space after //

> +        Store (1 << GIOP, 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) }        // (60C) active cooling trip point,
> +                                           // if this is lower than PSV then we
> +                                           // prefer active cooling
> +    Name (_AL0, Package () { \_SB_.EC0.FAN }) // the fan used for AC0 above
> +  }
> +}
> 

Reviewed-by: Pete Batard <pete@akeo.ie>

  reply	other threads:[~2020-08-31 13:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 22:02 [PATCH v3 0/5] Platform/RasberryPi: Thermal zone Jeremy Linton
2020-08-28 22:02 ` [PATCH v3 1/5] Platform/RaspberryPi4: Add a basic thermal zone Jeremy Linton
2020-08-31 13:15   ` Pete Batard
2020-08-31 15:13     ` Jeremy Linton
2020-08-31 15:33       ` Ard Biesheuvel
2020-08-31 15:49         ` Jeremy Linton
2020-08-28 22:02 ` [PATCH v3 2/5] Platform/RaspberryPi: Monitor ACPI Table installs Jeremy Linton
2020-08-31 13:17   ` Pete Batard
2020-08-28 22:02 ` [PATCH v3 3/5] Platform/RaspberryPi: Add entry for user fan control Jeremy Linton
2020-08-31 13:17   ` Pete Batard
2020-08-28 22:02 ` [PATCH v3 4/5] Platform/RaspberryPi4: Create ACPI fan object Jeremy Linton
2020-08-31 13:17   ` Pete Batard [this message]
2020-08-28 22:02 ` [PATCH v3 5/5] Platform/RaspberryPi: Trivial whitespace cleanup Jeremy Linton
2020-08-31 13:17   ` Pete Batard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24f61aff-0815-28f6-6cba-1f6a9f817d56@akeo.ie \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox