diff --git a/src/mainboard/system76/kbl-u/acpi/ec.asl b/src/mainboard/system76/kbl-u/acpi/ec.asl index 4209ee4169..8ddf5047c4 100644 --- a/src/mainboard/system76/kbl-u/acpi/ec.asl +++ b/src/mainboard/system76/kbl-u/acpi/ec.asl @@ -36,18 +36,23 @@ Device (EC) #include "acpi/ec_ram.asl" Name (ECOK, Zero) - Method (_REG, 2, NotSerialized) // _REG: Region Availability + Method (_REG, 2, Serialized) // _REG: Region Availability { Store ("EC: _REG", Debug) - If (((Arg0 == 0x03) && (Arg1 == One))) - { - ECOK = Arg1 - ECOS = One - WINF = One + If (((Arg0 == 0x03) && (Arg1 == One))) { + // Enable software touchpad lock and airplane mode keys + ECOS = 2 + // Enable software backlight keys + WINF = 1 + + // Set current AC state ^^^^AC.ACFG = ADP PNOT () + + // EC is now available + ECOK = Arg1 } } @@ -163,8 +168,15 @@ Device (EC) Notify (PWRB, 0x80) } - Method (_Q50, 0, NotSerialized) // TODO + Method (_Q50, 0, NotSerialized) // Other Events { - Store ("EC: 50", Debug) + Local0 = OEM4 + If (Local0 == 0x8A) { // White Keyboard Backlight + Store ("EC: White Keyboard Backlight", Debug) + Notify (^^^^S76D, 0x80) + } Else { + Store ("EC: Other", Debug) + Store (Local0, Debug) + } } } diff --git a/src/mainboard/system76/kbl-u/acpi/lid.asl b/src/mainboard/system76/kbl-u/acpi/lid.asl index 8698048eaf..821fac3a77 100644 --- a/src/mainboard/system76/kbl-u/acpi/lid.asl +++ b/src/mainboard/system76/kbl-u/acpi/lid.asl @@ -22,7 +22,7 @@ Device (LID0) { If (^^PCI0.LPCB.EC.ECOK) { - Return (\_SB.PCI0.LPCB.EC.LSTE) + Return (^^PCI0.LPCB.EC.LSTE) } Else { diff --git a/src/mainboard/system76/kbl-u/acpi/mainboard.asl b/src/mainboard/system76/kbl-u/acpi/mainboard.asl index a25a269a68..c59cd8b502 100644 --- a/src/mainboard/system76/kbl-u/acpi/mainboard.asl +++ b/src/mainboard/system76/kbl-u/acpi/mainboard.asl @@ -20,4 +20,5 @@ Scope (\_SB) #include "buttons.asl" #include "hid.asl" #include "lid.asl" + #include "s76.asl" } diff --git a/src/mainboard/system76/kbl-u/acpi/s76.asl b/src/mainboard/system76/kbl-u/acpi/s76.asl new file mode 100644 index 0000000000..f5e693e342 --- /dev/null +++ b/src/mainboard/system76/kbl-u/acpi/s76.asl @@ -0,0 +1,61 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 System76 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +Device (S76D) { + Name (_HID, "17761776") + Name (_UID, 0) + + // Get Airplane LED + Method (GAPL, 0, Serialized) { + If (^^PCI0.LPCB.EC.ECOK) { + If (^^PCI0.LPCB.EC.AIRP & 0x40) { + Return (1) + } + } + Return (0) + } + + // Set Airplane LED + Method (SAPL, 1, Serialized) { + If (^^PCI0.LPCB.EC.ECOK) { + If (Arg0) { + ^^PCI0.LPCB.EC.AIRP |= 0x40 + } Else { + ^^PCI0.LPCB.EC.AIRP &= 0xBF + } + } + } + + // Get KB LED + Method (GKBL, 0, Serialized) { + Local0 = 0 + If (^^PCI0.LPCB.EC.ECOK) { + ^^PCI0.LPCB.EC.FDAT = One + ^^PCI0.LPCB.EC.FCMD = 0xCA + Local0 = ^^PCI0.LPCB.EC.FBUF + ^^PCI0.LPCB.EC.FCMD = Zero + } + Return (Local0) + } + + // Set KB Led + Method (SKBL, 1, Serialized) { + If (^^PCI0.LPCB.EC.ECOK) { + ^^PCI0.LPCB.EC.FDAT = Zero + ^^PCI0.LPCB.EC.FBUF = Arg0 + ^^PCI0.LPCB.EC.FCMD = 0xCA + } + } +} diff --git a/src/mainboard/system76/whl-u/acpi/ec.asl b/src/mainboard/system76/whl-u/acpi/ec.asl index e33a840628..8ddf5047c4 100644 --- a/src/mainboard/system76/whl-u/acpi/ec.asl +++ b/src/mainboard/system76/whl-u/acpi/ec.asl @@ -36,7 +36,6 @@ Device (EC) #include "acpi/ec_ram.asl" Name (ECOK, Zero) - Name (TPSE, Zero) Method (_REG, 2, Serialized) // _REG: Region Availability { Store ("EC: _REG", Debug)