ACPI Device Runtime Power Management

This page captures the investigation notes and references to implementation for ACPI device runtime power management.

Device power management on NXP I.MX8MP Platform

We have implemented device power management for few devices (I2C, UART) in IMX8MP platform. Changes to different components are given below.

EDK2

https://gitlab.com/LinaroLtd/clientpc/edk2-platforms/-/merge_requests/4

  • Implements SCMI protocol support

  • SCMI AML methods to set clock state and get clock rate

  • Device power management for I2C and UART

  • GCLK AML method to get clock rate using SCMI

TF-A

https://gitlab.com/LinaroLtd/clientpc/tf-a/-/merge_requests/2/

  • Add support for SCMI protocol

  • Implements a simple clock driver for I.MX8MP platform and SCMI clock management support

The implementation includes an SCMI server implemented in TF-A and a SCMI agent implemented in AML.

AML Code

Device (I2C1) { Name (_HID, "NXP0104") Name (_HRV, 0x1) Name (_UID, 0x1) Name (_CLK, 13) Method (_STA) { Return(0xf) } Name (_PRS, ResourceTemplate () // _PRS: Possible Resource Settings { Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 67 } }) Method (_CRS, 0x0, NotSerialized) { Name ( RBUF, ResourceTemplate () { MEMORY32FIXED(ReadWrite, 0x30A20000, 0x14, ) Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 67 } }) Return(RBUF) } Method (_PS0, 0, NotSerialized) // _PS0: Power State 0 { SC07(_CLK, 1) } Method (_PS3, 0, NotSerialized) // _PS3: Power State 3 { SC07(_CLK, 0) } } // Operation Region for Shared memory transport OperationRegion(SHM, SystemMemory, 0x403f0000, 44) Field(SHM, ByteAcc, NoLock, Preserve) { RES1, 32, SCHS, 32, RES2, 64, SCHF, 32, SLEN, 32, SMSH, 32, SPLD, 128, } // SC07 - SCMI CLOCK_CONFIG_SET // Arg0: SCMI Clock ID // Arg1: Clock Attributes ( 1 -> Enable, 0 -> Disable) // Returns: 1 if config is set succesfully, 0 otherwise Method (SC07, 2, Serialized) { Name(BUFF, Buffer(8){}) CreateDWordField(BUFF, 0, PLW0) CreateDWordField(BUFF, 4, PLW1) PLW0 = Arg0 PLW1 = Arg1 local0 = SMT(0x14, 0x7, BUFF) CreateDWordField(local0, 0, RET) Return (RET) } // SMT - Interface to send SCMI message over shared memory channel // Arg0: SCMI Protocol ID // Arg1: SCMI Message ID // Arg2: SCMI Input Argument Buffer // Returns: SCMI Payload Method (SMT, 3, Serialized) { // SCMI Message header with SCMI protocol and message ID Name(MSGH, Buffer(8){}) CreateField(MSGH, 10, 8, PROI) CreateField(MSGH, 0, 8, MSGI) PROI = Arg0 MSGI = Arg1 SCHS = 0x0 SCHF = 0x0 SMSH = MSGH SLEN = 4 + sizeof(Arg2) SPLD = Arg2 // SMC call OperationRegion(AFFH, FFixedHW, 1, 8) Field (AFFH, BufferAcc, NoLock, Preserve) { SMCC, 64 } Name(BUFF, Buffer(8){}) CreateQWordField(BUFF, 0x00, BFX0) BFX0 = 0xC20000FE // SCMI FID BUFF = (SMCC = BUFF) Return (SPLD) }

Power Management with SCMI on RD-N2 Platform

ACPI power management with SCMI on RdN2 platforms