Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52391 )
Change subject: ec/purism/librem-ec: Apply initial Purism customizations ......................................................................
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 --- M src/ec/purism/librem-ec/Kconfig M src/ec/purism/librem-ec/acpi/battery.asl M src/ec/purism/librem-ec/acpi/ec.asl M src/ec/purism/librem-ec/acpi/ec_ram.asl M src/ec/purism/librem-ec/acpi/librem-ec.asl 5 files changed, 68 insertions(+), 78 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/52391/1
diff --git a/src/ec/purism/librem-ec/Kconfig b/src/ec/purism/librem-ec/Kconfig index e63b585..dc3560f 100644 --- a/src/ec/purism/librem-ec/Kconfig +++ b/src/ec/purism/librem-ec/Kconfig @@ -1,19 +1,4 @@ config EC_LIBREM_EC - bool + bool "Enable Librem EC" help - 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 + Purism Librem EC diff --git a/src/ec/purism/librem-ec/acpi/battery.asl b/src/ec/purism/librem-ec/acpi/battery.asl index 50aaf9e..f3a8a9a 100644 --- a/src/ec/purism/librem-ec/acpi/battery.asl +++ b/src/ec/purism/librem-ec/acpi/battery.asl @@ -34,15 +34,15 @@ 0xFFFFFFFF, // 1 - Design Capacity 0xFFFFFFFF, // 2 - Last Full Charge Capacity One, // 3 - Battery Technology - 0xFFFFFFFF, // 4 - Design Voltage + 0x39D0, // 4 - Design Voltage Zero, // 5 - Design Capacity of Warning Zero, // 6 - Design Capacity of Low 0x40, // 7 - Battery Capacity Granularity 1 0x40, // 8 - Battery Capacity Granularity 2 - " ", // 9 - Model Number - " ", // 10 - Serial Number - " ", // 11 - Battery Type - " " // 12 - OEM Information + "BAT", // 9 - Model Number + "0001", // 10 - Serial Number + "LION", // 11 - Battery Type + "Notebook" // 12 - OEM Information }) Method (IVBI, 0, NotSerialized) { @@ -101,14 +101,14 @@ Zero, // 0 - Battery state 0xFFFFFFFF, // 1 - Battery present rate 0xFFFFFFFF, // 2 - Battery remaining capacity - 0xFFFFFFFF // 3 - Battery present voltage + 0x3D90 // 3 - Battery present voltage }) Method (IVBS, 0, NotSerialized) { PBST [0] = Zero PBST [1] = 0xFFFFFFFF PBST [2] = 0xFFFFFFFF - PBST [3] = 0xFFFFFFFF + PBST [3] = 0x2710 }
Method (UPBS, 0, NotSerialized) diff --git a/src/ec/purism/librem-ec/acpi/ec.asl b/src/ec/purism/librem-ec/acpi/ec.asl index 8d18d1e..bc225e7 100644 --- a/src/ec/purism/librem-ec/acpi/ec.asl +++ b/src/ec/purism/librem-ec/acpi/ec.asl @@ -57,18 +57,14 @@ // EC is now available ECOK = Arg1
- // Reset System76 Device - ^^^^S76D.RSET() + // Reset Librem EC Device + ^^^^LIEC.RSET() } }
- Name (S3OS, Zero) Method (PTS, 1, Serialized) { Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) If (ECOK) { - // Save ECOS during sleep - S3OS = ECOS - // Clear wake cause WFNO = Zero } @@ -77,9 +73,6 @@ Method (WAK, 1, Serialized) { Debug = Concatenate("EC: WAK: ", ToHexString(Arg0)) If (ECOK) { - // Restore ECOS after sleep - ECOS = S3OS - // Set current AC state ^^^^AC.ACFG = ADP
@@ -91,8 +84,8 @@ Notify(^^^^AC, Zero) Notify(^^^^BAT0, Zero)
- // Reset System76 Device - ^^^^S76D.RSET() + // Reset Librem EC Device + ^^^^LIEC.RSET() } }
@@ -104,9 +97,6 @@ Method (_Q0B, 0, NotSerialized) // 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 @@ -220,25 +210,23 @@ Local0 = OEM4 If (Local0 == 0x8A) { Debug = "EC: White Keyboard Backlight" - Notify (^^^^S76D, 0x80) + Notify (^^^^LIEC, 0x80) } ElseIf (Local0 == 0x9F) { Debug = "EC: Color Keyboard Toggle" - Notify (^^^^S76D, 0x81) + Notify (^^^^LIEC, 0x81) } ElseIf (Local0 == 0x81) { Debug = "EC: Color Keyboard Down" - Notify (^^^^S76D, 0x82) + Notify (^^^^LIEC, 0x82) } ElseIf (Local0 == 0x82) { Debug = "EC: Color Keyboard Up" - Notify (^^^^S76D, 0x83) + Notify (^^^^LIEC, 0x83) } ElseIf (Local0 == 0x80) { Debug = "EC: Color Keyboard Color Change" - Notify (^^^^S76D, 0x84) + Notify (^^^^LIEC, 0x84) } Else { Debug = Concatenate("EC: Other: ", ToHexString(Local0)) } }
- #if CONFIG(EC_SYSTEM76_EC_BAT_THRESHOLDS) #include "battery_thresholds.asl" - #endif } diff --git a/src/ec/purism/librem-ec/acpi/ec_ram.asl b/src/ec/purism/librem-ec/acpi/ec_ram.asl index 6ef5454..ce5133f 100644 --- a/src/ec/purism/librem-ec/acpi/ec_ram.asl +++ b/src/ec/purism/librem-ec/acpi/ec_ram.asl @@ -42,7 +42,10 @@ RPM1, 16, // Fan 1 RPM RPM2, 16, // Fan 2 RPM 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 Offset (0xF8), FCMD, 8, diff --git a/src/ec/purism/librem-ec/acpi/librem-ec.asl b/src/ec/purism/librem-ec/acpi/librem-ec.asl index 62a93ba..4eead7a 100644 --- a/src/ec/purism/librem-ec/acpi/librem-ec.asl +++ b/src/ec/purism/librem-ec/acpi/librem-ec.asl @@ -6,22 +6,18 @@ // 0x82 - backlight down // 0x83 - backlight up // 0x84 - backlight color change -// 0x85 - OLED screen toggle -Device (S76D) { - Name (_HID, "17761776") +Device (LIEC) { + Name (_HID, "316D4C14") Name (_UID, 0)
Method (RSET, 0, Serialized) { - Debug = "S76D: RSET" + Debug = "LIEC: RSET" SAPL(0) SKBL(0) -#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) - SKBC(0xFFFFFF) -#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) }
Method (INIT, 0, Serialized) { - Debug = "S76D: INIT" + Debug = "LIEC: INIT" RSET() If (^^PCI0.LPCB.EC0.ECOK) { // Set flags to use software control @@ -33,7 +29,7 @@ }
Method (FINI, 0, Serialized) { - Debug = "S76D: FINI" + Debug = "LIEC: FINI" RSET() If (^^PCI0.LPCB.EC0.ECOK) { // Set flags to use hardware control @@ -47,7 +43,7 @@ // Get Airplane LED Method (GAPL, 0, Serialized) { If (^^PCI0.LPCB.EC0.ECOK) { - If (^^PCI0.LPCB.EC0.AIRP & 0x40) { + If (^^PCI0.LPCB.EC0.WLED & 0x40) { Return (1) } } @@ -58,39 +54,58 @@ Method (SAPL, 1, Serialized) { If (^^PCI0.LPCB.EC0.ECOK) { If (Arg0) { - ^^PCI0.LPCB.EC0.AIRP |= 0x40 + ^^PCI0.LPCB.EC0.WLED |= 0x40 } Else { - ^^PCI0.LPCB.EC0.AIRP &= 0xBF + ^^PCI0.LPCB.EC0.WLED &= 0xBF } } }
-#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) - // Set KB LED Brightness - Method (SKBL, 1, Serialized) { + // Get notification red LED + Method (GNTR, 0, 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 + Return (^^PCI0.LPCB.EC0.NOTR) + } + Return (0) + } + + // Set notification red LED + Method (SNTR, 1, Serialized) { + If (^^PCI0.LPCB.EC0.ECOK) { + ^^PCI0.LPCB.EC0.NOTR = Arg0 } }
- // Set Keyboard Color - Method (SKBC, 1, Serialized) { + // Get notification green LED + Method (GNTG, 0, 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 (^^PCI0.LPCB.EC0.NOTG) + } + Return (0) + } + + // Set notification green LED + Method (SNTG, 1, Serialized) { + If (^^PCI0.LPCB.EC0.ECOK) { + ^^PCI0.LPCB.EC0.NOTG = Arg0 } } -#else // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) + + // 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 Method (GKBL, 0, Serialized) { Local0 = 0 @@ -111,7 +126,6 @@ ^^PCI0.LPCB.EC0.FCMD = 0xCA } } -#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
// Fan names Method (NFAN, 0, Serialized) {