diff options
author | Sean Rhodes <sean@starlabs.systems> | 2021-10-14 20:58:15 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-11-22 14:46:20 +0000 |
commit | 296994bec80d27c0dc1f155530fd495fa00bda6c (patch) | |
tree | 94049a26b84e3c92e32ece723f0291f21fc29542 /src/ec/starlabs/merlin/acpi | |
parent | 6973a3e7c481efc89845ecc3c78d7994a3e48b3c (diff) |
ec/starlabs: Add standardised ITE EC support
Add EC support that supports different Q Events and EC memory.
Created from the ITE IT5570E and IT8987E datasheets, all using
data port 0x4e.
Tested with Ubuntu 20.04.3 and Windows 10 on:
* StarBook Mk V (TGL + IT5570E):
* ITE Firmware 1.00
* Merlin Firmware 1.00
* LabTop Mk IV (CML + IT8987E):
* ITE Firmware 1.04
* LabTop Mk III (KBL + IT8987E):
* ITE Firmware 3.12
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I8023c26de23c874c84106fda96e64dcfa0c5ba32
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58343
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Andy Pont <andy.pont@sdcsystems.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec/starlabs/merlin/acpi')
-rw-r--r-- | src/ec/starlabs/merlin/acpi/ac.asl | 21 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/battery.asl | 68 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/cmos.asl | 33 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/ec.asl | 166 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/hid.asl | 371 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/keyboard.asl | 59 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/lid.asl | 16 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/suspend.asl | 19 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/typec.asl | 82 | ||||
-rw-r--r-- | src/ec/starlabs/merlin/acpi/ubtc.asl | 50 |
10 files changed, 885 insertions, 0 deletions
diff --git a/src/ec/starlabs/merlin/acpi/ac.asl b/src/ec/starlabs/merlin/acpi/ac.asl new file mode 100644 index 0000000000..808d5754ab --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/ac.asl @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Device (ADP1) +{ + Name (_HID, "ACPI0003") + Method (_STA) + { + Return (0x0F) + } + Method (_PSR, 0) + { + PWRS = ECPS & 0x01 + Return(PWRS) + } + Method (_PCL, 0) + { + Return ( + Package() { _SB } + ) + } +} diff --git a/src/ec/starlabs/merlin/acpi/battery.asl b/src/ec/starlabs/merlin/acpi/battery.asl new file mode 100644 index 0000000000..b428458b2b --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/battery.asl @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Device (BAT0) +{ + Name (_HID, EisaId("PNP0C0A")) + Name (_UID, 0) + Method (_STA, 0, NotSerialized) + { + // Battery Status + // 0x80 BIT1 0x01 = Present + // 0x80 BIT1 0x00 = Not Present + If(ECPS & 0x02) + { + Return(0x1F) + } + Return(0x0F) + } + Name (BPKG, Package(13) + { + 1, // 0: Power Unit + 0xFFFFFFFF, // 1: Design Capacity + 0xFFFFFFFF, // 2: Last Full Charge Capacity + 1, // 3: Battery Technology(Rechargeable) + 0xFFFFFFFF, // 4: Design Voltage 10.8V + 0, // 5: Design capacity of warning + 0, // 6: Design capacity of low + 100, // 7: Battery capacity granularity 1 + 0, // 8: Battery capacity granularity 2 + "597077-3S", // 9: Model Number + "3ICP6/70/77", // 10: Serial Number + "Real", // 11: Battery Type + "DGFGE" // 12: OEM Information + }) + Method (_BIF, 0, Serialized) + { + BPKG[1] = B1DC + BPKG[2] = B1FC + BPKG[4] = B1DV + If(B1FC) + { + BPKG[5] = B1FC / 10 + BPKG[6] = B1FC / 100 + BPKG[7] = B1DC / 100 + } + Return(BPKG) + } + Name (PKG1, Package (4) + { + 0xFFFFFFFF, // Battery State + 0xFFFFFFFF, // Battery Present Rate + 0xFFFFFFFF, // Battery Remaining Capacity + 0xFFFFFFFF, // Battery Present Voltage + }) + Method (_BST, 0, NotSerialized) + { + PKG1[0] = (B1ST & 0x07) + PKG1[1] = B1PR + PKG1[2] = B1RC + PKG1[3] = B1PV + Return(PKG1) + } + Method (_PCL, 0, NotSerialized) + { + Return ( + Package() { _SB } + ) + } +} diff --git a/src/ec/starlabs/merlin/acpi/cmos.asl b/src/ec/starlabs/merlin/acpi/cmos.asl new file mode 100644 index 0000000000..b6ef5a0c93 --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/cmos.asl @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +OperationRegion (CMOS, SystemIO, 0x70, 0x2) +Field (CMOS, ByteAcc, NoLock, Preserve) +{ + IND1, 8, + DAT1, 8, +} + +IndexField (IND1, DAT1, ByteAcc, NoLock, Preserve) +{ + Offset (0x4b), + KLTC, 8, // Keyboard Backlight Timeout + FCLS, 8, // Ctrl Fn Reverse (make keyboard Apple-like) + MXCH, 8, // Max Charge Level + FNMD, 8, // Fan Mode +} + +OperationRegion (CMS2, SystemIO, 0x72, 0x2) +Field (CMS2, ByteAcc, NoLock, Preserve) +{ + IND2, 8, + DAT2, 8, +} + +IndexField (IND2, DAT2, ByteAcc, NoLock, Preserve) +{ + Offset (0x80), + FLKS, 8, // Function Lock State + TPLS, 8, // Trackpad State + KLBC, 8, // Keyboard Backlight Brightness + KLSC, 8, // Keyboard Backlight State +} diff --git a/src/ec/starlabs/merlin/acpi/ec.asl b/src/ec/starlabs/merlin/acpi/ec.asl new file mode 100644 index 0000000000..905916c3a2 --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/ec.asl @@ -0,0 +1,166 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include "ubtc.asl" + +Scope (\_SB.PCI0.LPCB) +{ + #include "cmos.asl" + + Device (EC) + { + Name (_HID, EisaId ("PNP0C09")) + Name (_UID, 0x01) + Name (_GPE, EC_GPE_SCI) + Name (ECAV, 0x00) + Name (ECTK, 0x01) + Name (B2ST, 0x00) + Name (CFAN, 0x00) + Name (CMDR, 0x00) + Name (DOCK, 0x00) + Name (PLMX, 0x00) + Name (PECH, 0x00) + Name (PECL, 0x00) + Name (PENV, 0x00) + Name (PINV, 0x00) + Name (PPSH, 0x00) + Name (PPSL, 0x00) + Name (PSTP, 0x00) + Name (RPWR, 0x00) + Name (VPWR, 0x00) + Name (WTMS, 0x00) + Name (AWT2, 0x00) + Name (AWT1, 0x00) + Name (AWT0, 0x00) + Name (DLED, 0x00) + Name (SPT2, 0x00) + Name (PB10, 0x00) + Name (IWCW, 0x00) + Name (IWCR, 0x00) + Name (PVOL, 0x00) + Mutex (ECMT, 0x00) + + Name(BFFR, ResourceTemplate() + { + IO(Decode16, 0x0062, 0x0062, 0x00, 0x01) + IO(Decode16, 0x0066, 0x0066, 0x00, 0x01) + }) + + Method (_CRS, 0, Serialized) + { + + Return(BFFR) + } + + Method (_STA, 0, NotSerialized) + { + \LIDS = 0x03 + Return (0x0F) + } + + OperationRegion (SIPR, SystemIO, 0xB2, 0x1) + Field (SIPR, ByteAcc, Lock, Preserve) { + SMB2, 8 + } + + #include "emem.asl" + + // ECRD (Embedded Controller Read Method) + // + // Handle all commands sent to EC by BIOS + // + // Arguments: + // Arg0 = Object to Read + // + // Return Value: + // Read Value + // + Method (ECRD, 1, Serialized, 0, IntObj, FieldUnitObj) + { + // + // Check for ECDT support, set ECAV to One if ECDT is supported by OS + // Only check once at beginning since ECAV might be clear later in certain conditions + // + If (ECTK) { + If (_REV >= 0x02) { + ECAV = 0x01 + } + ECTK = 0x00 // Clear flag for checking once only + } + + Local0 = Acquire (ECMT, 1000) // Save Acquired Result + If (Local0 == 0x00) // Check for Mutex Acquisition + { + If (ECAV) { + Local1 = DerefOf (Arg0) // Execute Read from EC + Release (ECMT) + Return (Local1) + } Else { + Release (ECMT) + } + } + Return(0) // Return in case Arg0 doesn't exist + } + + // ECWR (Embedded Controller Write Method) + // + // Handle all commands sent to EC by BIOS + // + // Arguments: + // Arg0 = Value to Write + // Arg1 = Object to Write to + // + // Return Value: + // None + // + Method (ECWR, 2, Serialized,,,{IntObj, FieldUnitObj}) + { + Local0 = Acquire (ECMT, 1000) // Save Acquired Result + If (Local0 == 0x00) // Check for Mutex Acquisition + { + If (ECAV) { + Arg1 = Arg0 // Execute Write to EC + Local1 = 0x00 + While (1) { + If (Arg0 == DerefOf (Arg1)) { + Break + } + Sleep (1) + Arg1 = Arg0 + Add (Local1, 1, Local1) + If (Local1 == 0x03) { + Break + } + } + } + Release (ECMT) + } + } + + #include "ac.asl" + #include "battery.asl" + #include "events.asl" + #include "lid.asl" + #include "typec.asl" + + Method (_REG, 2, NotSerialized) + { + If ((Arg0 == 0x03) && (Arg1 == 0x01)) + { + // Load EC Driver + ECAV = 0x01 + + // Initialise the Lid State + \LIDS = LSTE + + // Initialise the OS State + OSFG = 0x01 + + // Initialise the Power State + PWRS = (ECRD (RefOf(ECPS)) & 0x01) + + // Inform the platform code + PNOT() + } + } + } +} diff --git a/src/ec/starlabs/merlin/acpi/hid.asl b/src/ec/starlabs/merlin/acpi/hid.asl new file mode 100644 index 0000000000..1d2b2260aa --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/hid.asl @@ -0,0 +1,371 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Device (HIDD) // HID Device +{ + Name (_HID, "INTC1051") // Intel Ultrabook HID Platform Event Driver. + Name (HBSY, 0) // HID Busy + Name (HIDX, 0) // HID Index + Name (HMDE, 0) // HID Mode + Name (HRDY, 0) // HID Ready + Name (BTLD, 0) // Button Driver Loaded + Name (BTS1, 0) // Button Status + Method (_STA, 0, Serialized) // Status Method + { + // Usually, ACPI will check if the OS is 0x07DD (2013 - Windows 8.1ish) + // before showing the HID event filter. Seeing as we use Linux we show + // it regardless. + Return (0x0F) + } + // + // HID Driver Descriptor Method - Called by HID Driver during initialization + // to obtain HID Descriptor information. + // + // Input: + // None + // + // Output: + // Package containing a complete HID Descriptor information. + // + Name(DPKG, Package(4) + { + 0x11111111, + 0x22222222, + 0x33333333, + 0x44444444, + }) + Method (HDDM, 0, Serialized) + { + Return(DPKG) + } + // + // HID Driver Event Method - Called by HID Driver to get the specific + // platform event. + // + // Input: + // None + // + // Output: + // Mode 0 = Index of HID Input Report, per pre-defined Table. + // Mode 1 = Package containing a complete HID Input Report. + // + Method (HDEM, 0, Serialized) + { + HBSY = 0x00 // Clear HID Busy. + // Simple Mode is hardcoded for now. Return Simple Mode HID Index Value. + If (HMDE == 0x00) + { + Return(HIDX) + } + Return(HMDE) + } + // + // HID Driver Mode Method - Called by HID Driver during initialization to get + // the platform mode of operation. + // + // Input: + // None + // + // Output: + // 0 = Simple Mode. + // 1 = Advanced Mode. + // + Method (HDMM, 0, Serialized) + { + Return(HMDE) // Return Mode of operation. + } + // + // HID Driver Status Method - called by HID Driver to report platform readiness status. + // + // Input: Driver Status. + // 0 = Driver Unloaded. + // 1 = Driver Loaded and Ready. + // + // Output: None + // + Method (HDSM, 1, Serialized) + { + HRDY = Arg0 // Store HID Ready Status. + // Eventually code will communicate to platform the Driver status (enabled/disabled). + } + // + // HID Platform Event Method - called by Platform to communicate HID Event to Driver. + // + // Input: + // Mode 0 = Index of HID Event. + // Mode 1 = Package containing a complete HID Report. + // + Method (HPEM, 1, Serialized) // HID Platform Event Method. + { + HBSY = 0x01 // Set HID Busy. + // Simple Mode is hardcoded for now. Simply store HID Index value. + If (HMDE == 0x00) + { + HIDX = Arg0 + } Else { + HIDX = Arg0 + } + Notify (\_SB.HIDD, 0xC0) // Notify Driver to get HID Event. + Local0 = 0x00 // Initialize Local0 as a timeout counter. + While((Local0 < 250) && HBSY) // Wait <= 1 second for Driver to ACK success. + { + Sleep (4) // Delay 4 ms. + Local0++ // Increment Timeout. + } + If (HBSY == 0x01) // Failure? + { + HBSY = 0x00 // Yes. Clear HID Busy Flag. + HIDX = 0x00 // Set HID Simple Mode Index = 0 = Undefined. + Return (0x01) // Return Failure. + } Else { + Return (0x00) // Return Success. + } + } + // + // HID Button Load Method - called by Platform to say HID driver is capable of receiving + // 5-button array notifications. + // + // Input: + // None + // + // Output: + // None + // + Method (BTNL, 0, Serialized) // HID Button Enable/Disable Method + { + BTS1 = 0x00 + } + // + // HID Button Enable/Disable Method - called by Platform to disable/enable notification based + // on button press + // + // Input: + // Arg0 = Bit mask of buttons to Enable or Disable: + // 1 == Button should be Enabled + // 0 == Button should be Disabled + // Bits[0]: Power Button N/A to disable + // Bits[1]: Windows Button + // Bits[2]: Volume Up Button + // Bits[3]: Volume Down Button + // Bits[4]: Rotation Lock Button + // Bits[5:31]: Reserved + // + // Output: + // None + // + Method (BTNE, 1, Serialized) // HID Button Enable/Disable Method + { + Return (BTS1) + } + // + // HID Button Status - called by Platform to get what buttons are enabled and disabled + // + // Input: + // None + // + // Output: + // Bit mask of buttons' current status: + // 1 == Button is Enabled + // 0 == Button is Disabled + // Bits[0]: Power Button N/A to disable + // Bits[1]: Windows Button + // Bits[2]: Volume Up Button + // Bits[3]: Volume Down Button + // Bits[4]: Rotation Lock Button + // Bits[5:31]: Reserved + // + Method (BTNS, 0, Serialized) + { + Return (BTS1) + } + // + // HID Button Capabilities Method - called by Platform to determine what buttons are supported + // + // Input: + // None + // + // Output: + // Bit mask of buttons supported: + // 1 == Button is Supported + // 0 == Button is not Supported + // Bits[0]: Power Button (Must be 1) + // Bits[1]: Windows Button + // Bits[2]: Volume Up Button + // Bits[3]: Volume Down Button + // Bits[4]: Rotation Lock Button + // Bits[5:31]: Reserved + // + Method (BTNC, 0, Serialized) // HID Button Capabilities Method + { + Return(0x1F) + } + + // + // HEBC: HID Event Base Capabilities [31:0]- To specify the base button capabilities supported + // on platform by returning a ULONG value with the following bit level definition + // + // Input: + // None + // + // 0 = Button not supported + // 1 = Button supported + // Output: + // Bits [0] - Windows Button (Windows 8.1 supported), Rotation Lock (Windows 8.1 supported): + // Num Lock, Home, End, Page Up, Page Down + // Bits [1] - Wireless Radio Control + // Bits [2] - System Power Down (Windows 8.1 supported) + // Bits [3] - System Hibernate + // Bits [4] - System Sleep/ System Wake + // Bits [5] - Scan Next Track + // Bits [6] - Scan Previous Track + // Bits [7] - Stop + // Bits [8] - Play/Pause + // Bits [9] - Mute + // Bits [10] - Volume Increment (Windows 8.1 supported) + // Bits [11] - Volume Decrement (Windows 8.1 supported) + // Bits [12] - Display Brightness Increment + // Bits [13] - Display Brightness Decrement + // Bits [14] - Lock Tablet + // Bits [15] - Release Tablet + // Bits [16] - Toggle Bezel + // Bits [17] - 5 button array (Windows 10 supported): + // (Power, Windows Home, Volume Up, Volume Down, Rotation Lock) + // Bits [18] - Button 1 + // Bits [19] - Button 2 + // Bits [20] - Button 3 + // Bits [21] - Button 4 + // Bits [22] - Button 5 + // Bits [23-31] - reserved + // + // Modify below table if the target platform has different capabilities. Each bit + // corresponding the above table definition. + // + Name (HEB2, 0) // Extended 32bit capability definition for future enhancements. + Method (HEBC, 0, Serialized) { + // It's possible to return (\HEB1) + Return (0x00) + } + Method (H2BC, 0, Serialized) { + // It's possible to return (\HEB1) + Return (0x00) + } + // + // HEEC- Hid Event Extended Capabilities [32:63] + // + Method (HEEC, 0, Serialized) { + // It's possible to return (\HEB2) + Return(0x00) + } + // + // HIDD _DSM + // _DSM : Device Specific Method for the Windows Compatible Button Array. + // + // Arg0: UUID Unique function identifier + // Arg1: Integer Revision Level + // Arg2: Integer Function Index + // Arg3: Package Parameters + // + Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) + { + // Compare passed in UUID to supported UUID. + If (Arg0 == ToUUID ("EEEC56B3-4442-408F-A792-4EDD4D758054")) + { + If (0x01 == ToInteger(Arg1)) // Revision 1. + { + Switch (ToInteger(Arg2)) // Switch to Function Index. + { + // + // Function 0, Query of supported functions. + // + Case (0x00) + { + Return (Buffer() {0xFF, 0x03}) // Total 9 function indices are supported including this. + } + // + // Function 1, BTNL. Button Load Method. No Input/Output. + // + Case (0x01) + { + BTNL() + } + // + // Function 2, HDMM. HID Driver Mode Method. + // Input:None + // Output:HDMM output. See HDMM + // + Case (0x02) + { + Return (HDMM()) + } + // + // Function 3, HDSM. HID Driver Status Method. + // Input: 0 - The driver is not available. 1 - The driver is available. + // Output: None + // + Case (0x03) + { + HDSM (DeRefOf(Index(Arg3, 0x00))) + } + // + // Function 4, HDEM. HID Driver Event Method. + // Input: None. + // Output: Package contains Supported Keys (Mode 0) + // + Case (0x04) + { + Return (HDEM()) + } + // + // Function 5 BTNS. Button Status Method. + // Input: None. + // Output: Int32 which contains a bit map of Buttons' enable/disable states + // + Case (0x05) + { + Return (BTNS()) + } + // + // Function 6 BTNE. Button Enable/Disable Method. + // Input: Int32 Bit mask of buttons enable/disable control: + // 1 = Button should be Enabled + // 0 = Button should be Disabled + // Output: None. + // + Case (0x06) + { + BTNE (DeRefOf(Index(Arg3, 0x00))) + } + // + // Function 7 HEBC. Button implemented state. + // Input: None + // Output: Int32 Bit map which shows what buttons are implemented on this system. + // + Case (0x07) + { + Return (HEBC()) + } + // + // Function 8 VGBS. Virtual GPIO Button Status. + // Input: None + // Output: Intger Bit map which shows what Virtual GPIO Button status. Currently only + // Dock/Slate modes are supported. + // + Case (0x08) + { + Return (0x00) + } + // + // Function 9 H2BC. Button implemented state. + // Input: None + // Output: Int32 Bit map which shows what buttons are implemented on this system. + // + Case (0x09) + { + Return (H2BC()) + } + } + } + } + // If the code falls through to this point, just return a buffer of 0. + Return (Buffer() {0x00}) + } +} diff --git a/src/ec/starlabs/merlin/acpi/keyboard.asl b/src/ec/starlabs/merlin/acpi/keyboard.asl new file mode 100644 index 0000000000..0078c4c4ff --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/keyboard.asl @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Method(_Q80) // Volume up +{ + Store ("-----> _Q80", Debug) + Notify (\_SB.HIDD, 0xC4) + Notify (\_SB.HIDD, 0xC5) + Store ("<----- _Q80", Debug) +} + +Method(_Q81) // Volume down +{ + Store ("-----> _Q81", Debug) + Notify (\_SB.HIDD, 0xC6) + Notify (\_SB.HIDD, 0xC7) + Store ("<----- _Q81", Debug) +} + +Method(_Q99) // Wireless mode +{ + Store ("-----> _Q99", Debug) + ^^^^HIDD.HPEM (8) + Store ("<----- _Q99", Debug) +} + +Method(_Q06) // Brightness decrease +{ + ^^^^HIDD.HPEM (19) +} + +Method(_Q05) // Brightness increase +{ + ^^^^HIDD.HPEM (20) +} + +Method(_Q08) // FN lock QEvent +{ + FNLC = FNST +} + +Method(_Q54) // Power Button Event +{ + Store ("-----> _Q54", Debug) + Store ("<----- _Q54", Debug) +} + +Method(_QD5) // 10 second power button press +{ + Store ("-----> _QD5", Debug) + \_SB.PWPR() + Store ("<----- _QD5", Debug) +} + +Method(_QD6) // 10 second power button de-press +{ + Store ("-----> _QD6", Debug) + \_SB.PWRR() + Store ("<----- _QD6", Debug) +} diff --git a/src/ec/starlabs/merlin/acpi/lid.asl b/src/ec/starlabs/merlin/acpi/lid.asl new file mode 100644 index 0000000000..8b0edb55eb --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/lid.asl @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Device (LID0) +{ + Name (_HID, EisaId ("PNP0C0D")) + Method (_STA) + { + Return (0x0F) + } + Method (_LID,0) + { + // 0x00 == Closed + // 0x01 == Open + Return (^^LSTE) + } +} diff --git a/src/ec/starlabs/merlin/acpi/suspend.asl b/src/ec/starlabs/merlin/acpi/suspend.asl new file mode 100644 index 0000000000..7c8f2b1bd5 --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/suspend.asl @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Method (RPTS, 1, NotSerialized) +{ + \_SB.PCI0.LPCB.EC.OSFG = 0x00 + + If ((Arg0 == 0x04) || (Arg0 == 0x05)) + { + /* Store current EC settings */ + \_SB.PCI0.LPCB.EC.TPLA = \_SB.PCI0.LPCB.TPLS + \_SB.PCI0.LPCB.EC.FLKA = \_SB.PCI0.LPCB.FLKS + \_SB.PCI0.LPCB.EC.KLBE = \_SB.PCI0.LPCB.KLBC + } +} + +Method (RWAK, 1, Serialized) +{ + \_SB.PCI0.LPCB.EC.OSFG = 0x01 +} diff --git a/src/ec/starlabs/merlin/acpi/typec.asl b/src/ec/starlabs/merlin/acpi/typec.asl new file mode 100644 index 0000000000..1acc8a4427 --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/typec.asl @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Method (UCSW, 0, Serialized) +{ + Sleep (50) + MGO0 = ^^^^UBTC.MGO0 + MGO1 = ^^^^UBTC.MGO1 + MGO2 = ^^^^UBTC.MGO2 + MGO3 = ^^^^UBTC.MGO3 + MGO4 = ^^^^UBTC.MGO4 + MGO5 = ^^^^UBTC.MGO5 + MGO6 = ^^^^UBTC.MGO6 + MGO7 = ^^^^UBTC.MGO7 + MGO8 = ^^^^UBTC.MGO7 + MGO9 = ^^^^UBTC.MGO9 + MGOA = ^^^^UBTC.MGOA + MGOB = ^^^^UBTC.MGOB + MGOC = ^^^^UBTC.MGOC + MGOD = ^^^^UBTC.MGOD + MGOE = ^^^^UBTC.MGOE + MGOF = ^^^^UBTC.MGOF + CTL0 = ^^^^UBTC.CTL0 + CTL1 = ^^^^UBTC.CTL1 + CTL2 = ^^^^UBTC.CTL2 + CTL3 = ^^^^UBTC.CTL3 + CTL4 = ^^^^UBTC.CTL4 + CTL5 = ^^^^UBTC.CTL5 + CTL6 = ^^^^UBTC.CTL6 + CTL7 = ^^^^UBTC.CTL7 + OPWE = 0xE0 +} + +Method (UCSR, 0, Serialized) +{ + Sleep (50) + ^^^^UBTC.MGI0 = MGI0 + ^^^^UBTC.MGI1 = MGI1 + ^^^^UBTC.MGI2 = MGI2 + ^^^^UBTC.MGI3 = MGI3 + ^^^^UBTC.MGI4 = MGI4 + ^^^^UBTC.MGI5 = MGI5 + ^^^^UBTC.MGI6 = MGI6 + ^^^^UBTC.MGI7 = MGI7 + ^^^^UBTC.MGI8 = MGI8 + ^^^^UBTC.MGI9 = MGI9 + ^^^^UBTC.MGIA = MGIA + ^^^^UBTC.MGIB = MGIB + ^^^^UBTC.MGIC = MGIC + ^^^^UBTC.MGID = MGID + ^^^^UBTC.MGIE = MGIE + ^^^^UBTC.MGIF = MGIF + ^^^^UBTC.CCI0 = CCI0 + ^^^^UBTC.CCI1 = CCI1 + ^^^^UBTC.CCI2 = CCI2 + ^^^^UBTC.CCI3 = CCI3 +} + +Method (UCEV, 0, Serialized) +{ + Sleep (50) + ^^^^UBTC.MGI0 = MGI0 + ^^^^UBTC.MGI1 = MGI1 + ^^^^UBTC.MGI2 = MGI2 + ^^^^UBTC.MGI3 = MGI3 + ^^^^UBTC.MGI4 = MGI4 + ^^^^UBTC.MGI5 = MGI5 + ^^^^UBTC.MGI6 = MGI6 + ^^^^UBTC.MGI7 = MGI7 + ^^^^UBTC.MGI8 = MGI8 + ^^^^UBTC.MGI9 = MGI9 + ^^^^UBTC.MGIA = MGIA + ^^^^UBTC.MGIB = MGIB + ^^^^UBTC.MGIC = MGIC + ^^^^UBTC.MGID = MGID + ^^^^UBTC.MGIE = MGIE + ^^^^UBTC.MGIF = MGIF + ^^^^UBTC.CCI0 = CCI0 + ^^^^UBTC.CCI1 = CCI1 + ^^^^UBTC.CCI2 = CCI2 + ^^^^UBTC.CCI3 = CCI3 + Notify (^^^^UBTC, 0x80) +} diff --git a/src/ec/starlabs/merlin/acpi/ubtc.asl b/src/ec/starlabs/merlin/acpi/ubtc.asl new file mode 100644 index 0000000000..f29fb9d6cd --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/ubtc.asl @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +External(\_SB.UBTC, DeviceObj) +External(\_SB.UBTC.MGI0, IntObj) +External(\_SB.UBTC.MGI1, IntObj) +External(\_SB.UBTC.MGI2, IntObj) +External(\_SB.UBTC.MGI3, IntObj) +External(\_SB.UBTC.MGI4, IntObj) +External(\_SB.UBTC.MGI5, IntObj) +External(\_SB.UBTC.MGI6, IntObj) +External(\_SB.UBTC.MGI7, IntObj) +External(\_SB.UBTC.MGI8, IntObj) +External(\_SB.UBTC.MGI9, IntObj) +External(\_SB.UBTC.MGIA, IntObj) +External(\_SB.UBTC.MGIB, IntObj) +External(\_SB.UBTC.MGIC, IntObj) +External(\_SB.UBTC.MGID, IntObj) +External(\_SB.UBTC.MGIE, IntObj) +External(\_SB.UBTC.MGIF, IntObj) + +External(\_SB.UBTC.CTL0, IntObj) +External(\_SB.UBTC.CTL1, IntObj) +External(\_SB.UBTC.CTL2, IntObj) +External(\_SB.UBTC.CTL3, IntObj) +External(\_SB.UBTC.CTL4, IntObj) +External(\_SB.UBTC.CTL5, IntObj) +External(\_SB.UBTC.CTL6, IntObj) +External(\_SB.UBTC.CTL7, IntObj) + +External(\_SB.UBTC.MGO0, IntObj) +External(\_SB.UBTC.MGO1, IntObj) +External(\_SB.UBTC.MGO2, IntObj) +External(\_SB.UBTC.MGO3, IntObj) +External(\_SB.UBTC.MGO4, IntObj) +External(\_SB.UBTC.MGO5, IntObj) +External(\_SB.UBTC.MGO6, IntObj) +External(\_SB.UBTC.MGO7, IntObj) +External(\_SB.UBTC.MGO8, IntObj) +External(\_SB.UBTC.MGO9, IntObj) +External(\_SB.UBTC.MGOA, IntObj) +External(\_SB.UBTC.MGOB, IntObj) +External(\_SB.UBTC.MGOC, IntObj) +External(\_SB.UBTC.MGOD, IntObj) +External(\_SB.UBTC.MGOE, IntObj) +External(\_SB.UBTC.MGOF, IntObj) + +External(\_SB.UBTC.CCI0, IntObj) +External(\_SB.UBTC.CCI1, IntObj) +External(\_SB.UBTC.CCI2, IntObj) +External(\_SB.UBTC.CCI3, IntObj) |