Port previous commit to kbl-u
This commit is contained in:
@@ -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
|
||||
@@ -197,6 +212,18 @@ Device (EC0)
|
||||
If (Local0 == 0x8A) {
|
||||
Debug = "EC: White Keyboard Backlight"
|
||||
Notify (^^^^S76D, 0x80)
|
||||
} ElseIf (Local0 == 0x9F) {
|
||||
Debug = "EC: Color Keyboard Toggle"
|
||||
Notify (^^^^S76D, 0x81)
|
||||
} ElseIf (Local0 == 0x81) {
|
||||
Debug = "EC: Color Keyboard Down"
|
||||
Notify (^^^^S76D, 0x82)
|
||||
} ElseIf (Local0 == 0x82) {
|
||||
Debug = "EC: Color Keyboard Up"
|
||||
Notify (^^^^S76D, 0x83)
|
||||
} ElseIf (Local0 == 0x80) {
|
||||
Debug = "EC: Color Keyboard Color Change"
|
||||
Notify (^^^^S76D, 0x84)
|
||||
} Else {
|
||||
Debug = Concatenate("EC: Other: ", ToHexString(Local0))
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define COLOR_KEYBOARD 0
|
||||
|
||||
Scope (\_SB) {
|
||||
#include "ac.asl"
|
||||
#include "battery.asl"
|
||||
@@ -20,6 +22,7 @@ Scope (\_SB) {
|
||||
#include "hid.asl"
|
||||
#include "lid.asl"
|
||||
#include "s76.asl"
|
||||
#include "sleep.asl"
|
||||
}
|
||||
|
||||
Scope (_GPE) {
|
||||
|
@@ -23,10 +23,21 @@ 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 = "INIT"
|
||||
Debug = "S76D: INIT"
|
||||
RSET()
|
||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||
//TODO: Set flags to use software control
|
||||
// Set flags to use software control
|
||||
^^PCI0.LPCB.EC0.ECOS = 2
|
||||
Return (0)
|
||||
} Else {
|
||||
Return (1)
|
||||
@@ -34,9 +45,11 @@ Device (S76D) {
|
||||
}
|
||||
|
||||
Method (FINI, 0, Serialized) {
|
||||
Debug = "FINI"
|
||||
Debug = "S76D: FINI"
|
||||
RSET()
|
||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||
//TODO: Set flags to use hardware control
|
||||
// Set flags to use hardware control
|
||||
^^PCI0.LPCB.EC0.ECOS = 1
|
||||
Return (0)
|
||||
} Else {
|
||||
Return (1)
|
||||
@@ -64,6 +77,32 @@ Device (S76D) {
|
||||
}
|
||||
}
|
||||
|
||||
#if COLOR_KEYBOARD
|
||||
// Set KB LED Brightness
|
||||
Method (SKBL, 1, Serialized) {
|
||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||
^^PCI0.LPCB.EC0.FDAT = 6
|
||||
^^PCI0.LPCB.EC0.FBUF = Arg0
|
||||
^^PCI0.LPCB.EC0.FBF1 = 0
|
||||
^^PCI0.LPCB.EC0.FBF2 = Arg0
|
||||
^^PCI0.LPCB.EC0.FCMD = 0xCA
|
||||
}
|
||||
}
|
||||
|
||||
// Set Keyboard Color
|
||||
Method (SKBC, 1, Serialized) {
|
||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||
^^PCI0.LPCB.EC0.FDAT = 0x3
|
||||
^^PCI0.LPCB.EC0.FBUF = (Arg0 & 0xFF)
|
||||
^^PCI0.LPCB.EC0.FBF1 = ((Arg0 >> 16) & 0xFF)
|
||||
^^PCI0.LPCB.EC0.FBF2 = ((Arg0 >> 8) & 0xFF)
|
||||
^^PCI0.LPCB.EC0.FCMD = 0xCA
|
||||
Return (Arg0)
|
||||
} Else {
|
||||
Return (0)
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Get KB LED
|
||||
Method (GKBL, 0, Serialized) {
|
||||
Local0 = 0
|
||||
@@ -84,4 +123,5 @@ Device (S76D) {
|
||||
^^PCI0.LPCB.EC0.FCMD = 0xCA
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
24
src/mainboard/system76/kbl-u/acpi/sleep.asl
Normal file
24
src/mainboard/system76/kbl-u/acpi/sleep.asl
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user