ec/purism/librem-ec: Apply initial Purism customizations
- remove unused Kconfig options - change ACPI device name and HID - remove ACPI for unused color keyboard backlight - add support for RGB notification LED - rename Wifi LED ACPI variable - set some battery info defaults not populated by the EC Change-Id: I72eca9deb83e5a6d919d6fcbd3b354fbf6e7a925 Signed-off-by: Matt DeVillier <matt.devillier@puri.sm> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52391 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
7d57d561b1
commit
e00ea2fb38
|
@ -2,18 +2,3 @@ config EC_LIBREM_EC
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
Purism Librem EC
|
Purism Librem EC
|
||||||
|
|
||||||
config EC_LIBREM_EC_BAT_THRESHOLDS
|
|
||||||
depends on EC_LIBREM_EC
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
|
|
||||||
config EC_LIBREM_EC_COLOR_KEYBOARD
|
|
||||||
depends on EC_LIBREM_EC
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
|
|
||||||
config EC_LIBREM_EC_OLED
|
|
||||||
depends on EC_LIBREM_EC
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#define BATTERY_DESIGN_VOLTAGE_MV 14800
|
||||||
|
|
||||||
Device (BAT0)
|
Device (BAT0)
|
||||||
{
|
{
|
||||||
Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID
|
Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID
|
||||||
|
@ -34,15 +36,15 @@ Device (BAT0)
|
||||||
0xFFFFFFFF, // 1 - Design Capacity
|
0xFFFFFFFF, // 1 - Design Capacity
|
||||||
0xFFFFFFFF, // 2 - Last Full Charge Capacity
|
0xFFFFFFFF, // 2 - Last Full Charge Capacity
|
||||||
One, // 3 - Battery Technology
|
One, // 3 - Battery Technology
|
||||||
0xFFFFFFFF, // 4 - Design Voltage
|
BATTERY_DESIGN_VOLTAGE_MV, // 4 - Design Voltage
|
||||||
Zero, // 5 - Design Capacity of Warning
|
Zero, // 5 - Design Capacity of Warning
|
||||||
Zero, // 6 - Design Capacity of Low
|
Zero, // 6 - Design Capacity of Low
|
||||||
0x40, // 7 - Battery Capacity Granularity 1
|
0x40, // 7 - Battery Capacity Granularity 1
|
||||||
0x40, // 8 - Battery Capacity Granularity 2
|
0x40, // 8 - Battery Capacity Granularity 2
|
||||||
" ", // 9 - Model Number
|
"BAT", // 9 - Model Number
|
||||||
" ", // 10 - Serial Number
|
"0001", // 10 - Serial Number
|
||||||
" ", // 11 - Battery Type
|
"LION", // 11 - Battery Type
|
||||||
" " // 12 - OEM Information
|
"Notebook" // 12 - OEM Information
|
||||||
})
|
})
|
||||||
Method (IVBI, 0, NotSerialized)
|
Method (IVBI, 0, NotSerialized)
|
||||||
{
|
{
|
||||||
|
@ -101,14 +103,14 @@ Device (BAT0)
|
||||||
Zero, // 0 - Battery state
|
Zero, // 0 - Battery state
|
||||||
0xFFFFFFFF, // 1 - Battery present rate
|
0xFFFFFFFF, // 1 - Battery present rate
|
||||||
0xFFFFFFFF, // 2 - Battery remaining capacity
|
0xFFFFFFFF, // 2 - Battery remaining capacity
|
||||||
0xFFFFFFFF // 3 - Battery present voltage
|
BATTERY_DESIGN_VOLTAGE_MV // 3 - Battery present voltage
|
||||||
})
|
})
|
||||||
Method (IVBS, 0, NotSerialized)
|
Method (IVBS, 0, NotSerialized)
|
||||||
{
|
{
|
||||||
PBST [0] = Zero
|
PBST [0] = Zero
|
||||||
PBST [1] = 0xFFFFFFFF
|
PBST [1] = 0xFFFFFFFF
|
||||||
PBST [2] = 0xFFFFFFFF
|
PBST [2] = 0xFFFFFFFF
|
||||||
PBST [3] = 0xFFFFFFFF
|
PBST [3] = 0x2710
|
||||||
}
|
}
|
||||||
|
|
||||||
Method (UPBS, 0, NotSerialized)
|
Method (UPBS, 0, NotSerialized)
|
||||||
|
|
|
@ -57,18 +57,14 @@ Device (\_SB.PCI0.LPCB.EC0)
|
||||||
// EC is now available
|
// EC is now available
|
||||||
ECOK = Arg1
|
ECOK = Arg1
|
||||||
|
|
||||||
// Reset System76 Device
|
// Reset Librem EC Device
|
||||||
^^^^S76D.RSET()
|
^^^^LIEC.RSET()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Name (S3OS, Zero)
|
|
||||||
Method (PTS, 1, Serialized) {
|
Method (PTS, 1, Serialized) {
|
||||||
Debug = Concatenate("EC: PTS: ", ToHexString(Arg0))
|
Debug = Concatenate("EC: PTS: ", ToHexString(Arg0))
|
||||||
If (ECOK) {
|
If (ECOK) {
|
||||||
// Save ECOS during sleep
|
|
||||||
S3OS = ECOS
|
|
||||||
|
|
||||||
// Clear wake cause
|
// Clear wake cause
|
||||||
WFNO = Zero
|
WFNO = Zero
|
||||||
}
|
}
|
||||||
|
@ -77,9 +73,6 @@ Device (\_SB.PCI0.LPCB.EC0)
|
||||||
Method (WAK, 1, Serialized) {
|
Method (WAK, 1, Serialized) {
|
||||||
Debug = Concatenate("EC: WAK: ", ToHexString(Arg0))
|
Debug = Concatenate("EC: WAK: ", ToHexString(Arg0))
|
||||||
If (ECOK) {
|
If (ECOK) {
|
||||||
// Restore ECOS after sleep
|
|
||||||
ECOS = S3OS
|
|
||||||
|
|
||||||
// Set current AC state
|
// Set current AC state
|
||||||
^^^^AC.ACFG = ADP
|
^^^^AC.ACFG = ADP
|
||||||
|
|
||||||
|
@ -91,8 +84,8 @@ Device (\_SB.PCI0.LPCB.EC0)
|
||||||
Notify(^^^^AC, Zero)
|
Notify(^^^^AC, Zero)
|
||||||
Notify(^^^^BAT0, Zero)
|
Notify(^^^^BAT0, Zero)
|
||||||
|
|
||||||
// Reset System76 Device
|
// Reset Librem EC Device
|
||||||
^^^^S76D.RSET()
|
^^^^LIEC.RSET()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +97,6 @@ Device (\_SB.PCI0.LPCB.EC0)
|
||||||
Method (_Q0B, 0, NotSerialized) // Screen Toggle
|
Method (_Q0B, 0, NotSerialized) // Screen Toggle
|
||||||
{
|
{
|
||||||
Debug = "EC: Screen Toggle"
|
Debug = "EC: Screen Toggle"
|
||||||
#if CONFIG(EC_SYSTEM76_EC_OLED)
|
|
||||||
Notify (^^^^S76D, 0x85)
|
|
||||||
#endif // CONFIG(EC_SYSTEM76_EC_OLED)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Method (_Q0C, 0, NotSerialized) // Mute
|
Method (_Q0C, 0, NotSerialized) // Mute
|
||||||
|
@ -220,25 +210,23 @@ Device (\_SB.PCI0.LPCB.EC0)
|
||||||
Local0 = OEM4
|
Local0 = OEM4
|
||||||
If (Local0 == 0x8A) {
|
If (Local0 == 0x8A) {
|
||||||
Debug = "EC: White Keyboard Backlight"
|
Debug = "EC: White Keyboard Backlight"
|
||||||
Notify (^^^^S76D, 0x80)
|
Notify (^^^^LIEC, 0x80)
|
||||||
} ElseIf (Local0 == 0x9F) {
|
} ElseIf (Local0 == 0x9F) {
|
||||||
Debug = "EC: Color Keyboard Toggle"
|
Debug = "EC: Color Keyboard Toggle"
|
||||||
Notify (^^^^S76D, 0x81)
|
Notify (^^^^LIEC, 0x81)
|
||||||
} ElseIf (Local0 == 0x81) {
|
} ElseIf (Local0 == 0x81) {
|
||||||
Debug = "EC: Color Keyboard Down"
|
Debug = "EC: Color Keyboard Down"
|
||||||
Notify (^^^^S76D, 0x82)
|
Notify (^^^^LIEC, 0x82)
|
||||||
} ElseIf (Local0 == 0x82) {
|
} ElseIf (Local0 == 0x82) {
|
||||||
Debug = "EC: Color Keyboard Up"
|
Debug = "EC: Color Keyboard Up"
|
||||||
Notify (^^^^S76D, 0x83)
|
Notify (^^^^LIEC, 0x83)
|
||||||
} ElseIf (Local0 == 0x80) {
|
} ElseIf (Local0 == 0x80) {
|
||||||
Debug = "EC: Color Keyboard Color Change"
|
Debug = "EC: Color Keyboard Color Change"
|
||||||
Notify (^^^^S76D, 0x84)
|
Notify (^^^^LIEC, 0x84)
|
||||||
} Else {
|
} Else {
|
||||||
Debug = Concatenate("EC: Other: ", ToHexString(Local0))
|
Debug = Concatenate("EC: Other: ", ToHexString(Local0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG(EC_SYSTEM76_EC_BAT_THRESHOLDS)
|
|
||||||
#include "battery_thresholds.asl"
|
#include "battery_thresholds.asl"
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,10 @@ Field (ERAM, ByteAcc, Lock, Preserve)
|
||||||
RPM1, 16, // Fan 1 RPM
|
RPM1, 16, // Fan 1 RPM
|
||||||
RPM2, 16, // Fan 2 RPM
|
RPM2, 16, // Fan 2 RPM
|
||||||
Offset (0xD9),
|
Offset (0xD9),
|
||||||
AIRP, 8, // Airplane mode LED
|
WLED, 8, // WiFi LED
|
||||||
|
NOTR, 8, // notification LED R
|
||||||
|
NOTG, 8, // notification LED G
|
||||||
|
NOTB, 8, // notification LED B
|
||||||
WINF, 8, // Enable ACPI brightness controls
|
WINF, 8, // Enable ACPI brightness controls
|
||||||
Offset (0xF8),
|
Offset (0xF8),
|
||||||
FCMD, 8,
|
FCMD, 8,
|
||||||
|
|
|
@ -6,22 +6,18 @@
|
||||||
// 0x82 - backlight down
|
// 0x82 - backlight down
|
||||||
// 0x83 - backlight up
|
// 0x83 - backlight up
|
||||||
// 0x84 - backlight color change
|
// 0x84 - backlight color change
|
||||||
// 0x85 - OLED screen toggle
|
Device (LIEC) {
|
||||||
Device (S76D) {
|
Name (_HID, "PURI4543")
|
||||||
Name (_HID, "17761776")
|
|
||||||
Name (_UID, 0)
|
Name (_UID, 0)
|
||||||
|
|
||||||
Method (RSET, 0, Serialized) {
|
Method (RSET, 0, Serialized) {
|
||||||
Debug = "S76D: RSET"
|
Debug = "LIEC: RSET"
|
||||||
SAPL(0)
|
SAPL(0)
|
||||||
SKBL(0)
|
SKBL(0)
|
||||||
#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
|
|
||||||
SKBC(0xFFFFFF)
|
|
||||||
#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Method (INIT, 0, Serialized) {
|
Method (INIT, 0, Serialized) {
|
||||||
Debug = "S76D: INIT"
|
Debug = "LIEC: INIT"
|
||||||
RSET()
|
RSET()
|
||||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
// Set flags to use software control
|
// Set flags to use software control
|
||||||
|
@ -33,7 +29,7 @@ Device (S76D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Method (FINI, 0, Serialized) {
|
Method (FINI, 0, Serialized) {
|
||||||
Debug = "S76D: FINI"
|
Debug = "LIEC: FINI"
|
||||||
RSET()
|
RSET()
|
||||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
// Set flags to use hardware control
|
// Set flags to use hardware control
|
||||||
|
@ -47,7 +43,7 @@ Device (S76D) {
|
||||||
// Get Airplane LED
|
// Get Airplane LED
|
||||||
Method (GAPL, 0, Serialized) {
|
Method (GAPL, 0, Serialized) {
|
||||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
If (^^PCI0.LPCB.EC0.AIRP & 0x40) {
|
If (^^PCI0.LPCB.EC0.WLED & 0x40) {
|
||||||
Return (1)
|
Return (1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,39 +54,58 @@ Device (S76D) {
|
||||||
Method (SAPL, 1, Serialized) {
|
Method (SAPL, 1, Serialized) {
|
||||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
If (Arg0) {
|
If (Arg0) {
|
||||||
^^PCI0.LPCB.EC0.AIRP |= 0x40
|
^^PCI0.LPCB.EC0.WLED |= 0x40
|
||||||
} Else {
|
} Else {
|
||||||
^^PCI0.LPCB.EC0.AIRP &= 0xBF
|
^^PCI0.LPCB.EC0.WLED &= 0xBF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
|
// Get notification red LED
|
||||||
// Set KB LED Brightness
|
Method (GNTR, 0, Serialized) {
|
||||||
Method (SKBL, 1, Serialized) {
|
|
||||||
If (^^PCI0.LPCB.EC0.ECOK) {
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
^^PCI0.LPCB.EC0.FDAT = 6
|
Return (^^PCI0.LPCB.EC0.NOTR)
|
||||||
^^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)
|
Return (0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set notification red LED
|
||||||
|
Method (SNTR, 1, Serialized) {
|
||||||
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
|
^^PCI0.LPCB.EC0.NOTR = Arg0
|
||||||
}
|
}
|
||||||
#else // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
|
}
|
||||||
|
|
||||||
|
// Get notification green LED
|
||||||
|
Method (GNTG, 0, Serialized) {
|
||||||
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
|
Return (^^PCI0.LPCB.EC0.NOTG)
|
||||||
|
}
|
||||||
|
Return (0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set notification green LED
|
||||||
|
Method (SNTG, 1, Serialized) {
|
||||||
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
|
^^PCI0.LPCB.EC0.NOTG = Arg0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get notification blue LED
|
||||||
|
Method (GNTB, 0, Serialized) {
|
||||||
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
|
Return (^^PCI0.LPCB.EC0.NOTB)
|
||||||
|
}
|
||||||
|
Return (0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set notification blue LED
|
||||||
|
Method (SNTB, 1, Serialized) {
|
||||||
|
If (^^PCI0.LPCB.EC0.ECOK) {
|
||||||
|
^^PCI0.LPCB.EC0.NOTB = Arg0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get KB LED
|
// Get KB LED
|
||||||
Method (GKBL, 0, Serialized) {
|
Method (GKBL, 0, Serialized) {
|
||||||
Local0 = 0
|
Local0 = 0
|
||||||
|
@ -111,7 +126,6 @@ Device (S76D) {
|
||||||
^^PCI0.LPCB.EC0.FCMD = 0xCA
|
^^PCI0.LPCB.EC0.FCMD = 0xCA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
|
|
||||||
|
|
||||||
// Fan names
|
// Fan names
|
||||||
Method (NFAN, 0, Serialized) {
|
Method (NFAN, 0, Serialized) {
|
||||||
|
|
Loading…
Reference in New Issue