diff --git a/src/mainboard/system76/cfl-h/Kconfig b/src/mainboard/system76/cfl-h/Kconfig index 4d1847b62c..058deb7c88 100644 --- a/src/mainboard/system76/cfl-h/Kconfig +++ b/src/mainboard/system76/cfl-h/Kconfig @@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS select INTEL_LPSS_UART_FOR_CONSOLE # select MAINBOARD_HAS_SPI_TPM_CR50 # select MAINBOARD_HAS_TPM2 + select NO_UART_ON_SUPERIO select SOC_INTEL_CANNONLAKE_PCH_H select SOC_INTEL_COFFEELAKE select SOC_INTEL_COMMON_ACPI_EC_PTS_WAK diff --git a/src/mainboard/system76/cfl-h/acpi/ec.asl b/src/mainboard/system76/cfl-h/acpi/ec.asl index 22e06b6025..96e0a608cd 100644 --- a/src/mainboard/system76/cfl-h/acpi/ec.asl +++ b/src/mainboard/system76/cfl-h/acpi/ec.asl @@ -40,10 +40,10 @@ Device (EC0) { Debug = Concatenate("EC: _REG", Concatenate(ToHexString(Arg0), Concatenate(" ", ToHexString(Arg1)))) If (((Arg0 == 0x03) && (Arg1 == One))) { - // Enable software touchpad lock and airplane mode keys - ECOS = 2 + // Enable hardware touchpad lock, airplane mode, and keyboard backlight keys + ECOS = 1 - // Enable software backlight keys + // Enable software display brightness keys WINF = 1 // Set current AC state @@ -56,12 +56,16 @@ Device (EC0) // EC is now available ECOK = Arg1 + + // Reset System76 Device + ^^^^S76D.RSET() } } Method (PTS, 1, Serialized) { Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) If (ECOK) { + // Clear wake cause WFNO = Zero } } @@ -71,11 +75,19 @@ Device (EC0) If (ECOK) { // Set current AC state ^^^^AC.ACFG = ADP + // Update battery information and status ^^^^BAT0.UPBI() ^^^^BAT0.UPBS() + + // Notify of changes Notify(^^^^AC, Zero) Notify(^^^^BAT0, Zero) + + Sleep (1000) + + // Reset System76 Device + ^^^^S76D.RSET() } } @@ -134,7 +146,10 @@ Device (EC0) Method (_Q14, 0, NotSerialized) // Airplane Mode { Debug = "EC: Airplane Mode" - ^^^^HIDD.HPEM (8) + // Only send HIDD message when hardware airplane mode not in use + If (ECOS == 2) { + ^^^^HIDD.HPEM (8) + } } Method (_Q15, 0, NotSerialized) // Suspend Button diff --git a/src/mainboard/system76/cfl-h/acpi/mainboard.asl b/src/mainboard/system76/cfl-h/acpi/mainboard.asl index caf6688d6d..0b12ac2d19 100644 --- a/src/mainboard/system76/cfl-h/acpi/mainboard.asl +++ b/src/mainboard/system76/cfl-h/acpi/mainboard.asl @@ -20,6 +20,7 @@ Scope (\_SB) { #include "hid.asl" #include "lid.asl" #include "s76.asl" + #include "sleep.asl" } Scope (_GPE) { diff --git a/src/mainboard/system76/cfl-h/acpi/s76.asl b/src/mainboard/system76/cfl-h/acpi/s76.asl index 1bc4e5921d..d94fa8c09e 100644 --- a/src/mainboard/system76/cfl-h/acpi/s76.asl +++ b/src/mainboard/system76/cfl-h/acpi/s76.asl @@ -23,6 +23,39 @@ Device (S76D) { Name (_HID, "17761776") Name (_UID, 0) + Method (RSET, 0, Serialized) { + Debug = "S76D: RSET" + SAPL(0) + SKBL(0) + #if COLOR_KEYBOARD + SKBC(0xFFFFFF) + #endif + } + + Method (INIT, 0, Serialized) { + Debug = "S76D: INIT" + RSET() + If (^^PCI0.LPCB.EC0.ECOK) { + // Set flags to use software control + ^^PCI0.LPCB.EC0.ECOS = 2 + Return (0) + } Else { + Return (1) + } + } + + Method (FINI, 0, Serialized) { + Debug = "S76D: FINI" + RSET() + If (^^PCI0.LPCB.EC0.ECOK) { + // Set flags to use hardware control + ^^PCI0.LPCB.EC0.ECOS = 1 + Return (0) + } Else { + Return (1) + } + } + // Get Airplane LED Method (GAPL, 0, Serialized) { If (^^PCI0.LPCB.EC0.ECOK) { diff --git a/src/mainboard/system76/cfl-h/acpi/sleep.asl b/src/mainboard/system76/cfl-h/acpi/sleep.asl new file mode 100644 index 0000000000..9a3ecaa373 --- /dev/null +++ b/src/mainboard/system76/cfl-h/acpi/sleep.asl @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/* Method called from _PTS prior to enter sleep state */ +Method (MPTS, 1) { + \_SB.PCI0.LPCB.EC0.PTS (Arg0) +} + +/* Method called from _WAK prior to wakeup */ +Method (MWAK, 1) { + \_SB.PCI0.LPCB.EC0.WAK (Arg0) +}