diff options
author | Tim Crawford <tcrawford@system76.com> | 2023-07-14 11:13:08 -0600 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-07-18 15:03:16 +0000 |
commit | 6255c13927f11fa61c281e7fd5c583ab037afb35 (patch) | |
tree | 95fe8e84568c365388c755fa2d611b888635c79f /src/ec | |
parent | 68752314720fb93b3726c9db3aae9aa1756f1fcc (diff) |
{ec,mb}/system76: Replace color keyboard logic
System76 EC since system76/ec@9ac513128ad9 detects if the keyboard is
white or RGB backlit via `RGBKB-DET#` at runtime. Remove the Kconfig for
the selection and update the ACPI methods for the new functionality.
Change-Id: I60d3d165a58e30d2afc8736c0eb64dd90c8227ca
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76152
Reviewed-by: Jeremy Soller <jeremy@system76.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/system76/ec/Kconfig | 5 | ||||
-rw-r--r-- | src/ec/system76/ec/acpi/s76.asl | 68 |
2 files changed, 38 insertions, 35 deletions
diff --git a/src/ec/system76/ec/Kconfig b/src/ec/system76/ec/Kconfig index c1e4caf530..d1cd079f1d 100644 --- a/src/ec/system76/ec/Kconfig +++ b/src/ec/system76/ec/Kconfig @@ -8,11 +8,6 @@ config EC_SYSTEM76_EC_BAT_THRESHOLDS bool default y -config EC_SYSTEM76_EC_COLOR_KEYBOARD - depends on EC_SYSTEM76_EC - bool - default n - config EC_SYSTEM76_EC_DGPU depends on EC_SYSTEM76_EC bool diff --git a/src/ec/system76/ec/acpi/s76.asl b/src/ec/system76/ec/acpi/s76.asl index cf9889ee94..329c5d3246 100644 --- a/src/ec/system76/ec/acpi/s76.asl +++ b/src/ec/system76/ec/acpi/s76.asl @@ -16,10 +16,8 @@ Device (S76D) { Method (RSET, 0, Serialized) { Printf ("S76D: RSET") SAPL(0) - SKBL(0) -#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) - SKBC(0xFFFFFF) -#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) + SKBB(0) + SKBC(0xFFFFFF) } Method (INIT, 0, Serialized) { @@ -67,53 +65,63 @@ Device (S76D) { } } -#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) - // Set KB LED Brightness - Method (SKBL, 1, Serialized) { + // Get Keyboard Backlight Kind + // 0 - No backlight + // 1 - White backlight + // 2 - RGB backlight + Method (GKBK, 0, Serialized) { + Local0 = 0 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.FDAT = 2 ^^PCI0.LPCB.EC0.FCMD = 0xCA + Local0 = ^^PCI0.LPCB.EC0.FBUF } + Return (Local0) } - // Set Keyboard Color - Method (SKBC, 1, Serialized) { + // Get Keyboard Brightness + Method (GKBB, 0, Serialized) { + Local0 = 0 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.FDAT = 1 ^^PCI0.LPCB.EC0.FCMD = 0xCA - Return (Arg0) - } Else { - Return (0) + Local0 = ^^PCI0.LPCB.EC0.FBUF } + Return (Local0) } -#else // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) - // Get KB LED - Method (GKBL, 0, Serialized) { + + // Set Keyboard Brightness + Method (SKBB, 1, Serialized) { + If (^^PCI0.LPCB.EC0.ECOK) { + ^^PCI0.LPCB.EC0.FDAT = 0 + ^^PCI0.LPCB.EC0.FBUF = Arg0 + ^^PCI0.LPCB.EC0.FCMD = 0xCA + } + } + + // Get Keyboard Color + Method (GKBC, 0, Serialized) { Local0 = 0 If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 1 + ^^PCI0.LPCB.EC0.FDAT = 4 ^^PCI0.LPCB.EC0.FCMD = 0xCA Local0 = ^^PCI0.LPCB.EC0.FBUF - ^^PCI0.LPCB.EC0.FCMD = 0 + Local0 |= (^^PCI0.LPCB.EC0.FBF1) << 16 + Local0 |= (^^PCI0.LPCB.EC0.FBF2) << 8 } Return (Local0) } - // Set KB Led - Method (SKBL, 1, Serialized) { + // Set Keyboard Color + Method (SKBC, 1, Serialized) { If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 0 - ^^PCI0.LPCB.EC0.FBUF = Arg0 + ^^PCI0.LPCB.EC0.FDAT = 3 + ^^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 } } -#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) // Fan names Method (NFAN, 0, Serialized) { |