Update ACPI in system76 cfl-h mainboard

This commit is contained in:
Jeremy Soller
2019-10-02 11:08:52 -06:00
parent fbdb388c39
commit 3225862d82
5 changed files with 78 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -20,6 +20,7 @@ Scope (\_SB) {
#include "hid.asl"
#include "lid.asl"
#include "s76.asl"
#include "sleep.asl"
}
Scope (_GPE) {

View File

@@ -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) {

View File

@@ -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)
}