From 6255c13927f11fa61c281e7fd5c583ab037afb35 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Fri, 14 Jul 2023 11:13:08 -0600 Subject: [PATCH] {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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76152 Reviewed-by: Jeremy Soller Tested-by: build bot (Jenkins) --- src/ec/system76/ec/Kconfig | 5 -- src/ec/system76/ec/acpi/s76.asl | 70 +++++++++++++++------------ src/mainboard/system76/addw1/Kconfig | 1 - src/mainboard/system76/adl/Kconfig | 5 -- src/mainboard/system76/bonw14/Kconfig | 1 - src/mainboard/system76/cml-u/Kconfig | 1 - src/mainboard/system76/gaze15/Kconfig | 1 - src/mainboard/system76/oryp5/Kconfig | 1 - src/mainboard/system76/oryp6/Kconfig | 1 - src/mainboard/system76/rpl/Kconfig | 3 -- src/mainboard/system76/tgl-h/Kconfig | 1 - src/mainboard/system76/tgl-u/Kconfig | 1 - src/mainboard/system76/whl-u/Kconfig | 1 - 13 files changed, 39 insertions(+), 53 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) { - 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 // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) - // Get KB LED - Method (GKBL, 0, Serialized) { + // Get Keyboard Brightness + Method (GKBB, 0, Serialized) { Local0 = 0 If (^^PCI0.LPCB.EC0.ECOK) { ^^PCI0.LPCB.EC0.FDAT = 1 ^^PCI0.LPCB.EC0.FCMD = 0xCA Local0 = ^^PCI0.LPCB.EC0.FBUF - ^^PCI0.LPCB.EC0.FCMD = 0 } Return (Local0) } - // Set KB Led - Method (SKBL, 1, 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 } } -#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) + + // Get Keyboard Color + Method (GKBC, 0, Serialized) { + Local0 = 0 + If (^^PCI0.LPCB.EC0.ECOK) { + ^^PCI0.LPCB.EC0.FDAT = 4 + ^^PCI0.LPCB.EC0.FCMD = 0xCA + Local0 = ^^PCI0.LPCB.EC0.FBUF + Local0 |= (^^PCI0.LPCB.EC0.FBF1) << 16 + Local0 |= (^^PCI0.LPCB.EC0.FBF2) << 8 + } + Return (Local0) + } + + // Set Keyboard Color + Method (SKBC, 1, Serialized) { + If (^^PCI0.LPCB.EC0.ECOK) { + ^^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 + } + } // Fan names Method (NFAN, 0, Serialized) { diff --git a/src/mainboard/system76/addw1/Kconfig b/src/mainboard/system76/addw1/Kconfig index 0c1c0b3e7c..f4c86233b2 100644 --- a/src/mainboard/system76/addw1/Kconfig +++ b/src/mainboard/system76/addw1/Kconfig @@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_I2C_HID select DRIVERS_I2C_TAS5825M select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_OLED select HAVE_ACPI_RESUME diff --git a/src/mainboard/system76/adl/Kconfig b/src/mainboard/system76/adl/Kconfig index 5a28701187..dd692bee99 100644 --- a/src/mainboard/system76/adl/Kconfig +++ b/src/mainboard/system76/adl/Kconfig @@ -26,19 +26,16 @@ config BOARD_SYSTEM76_ADL_COMMON config BOARD_SYSTEM76_DARP8 select BOARD_SYSTEM76_ADL_COMMON - select EC_SYSTEM76_EC_COLOR_KEYBOARD config BOARD_SYSTEM76_GALP6 select BOARD_SYSTEM76_ADL_COMMON config BOARD_SYSTEM76_GAZE17_3050 select BOARD_SYSTEM76_ADL_COMMON - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU config BOARD_SYSTEM76_GAZE17_3060_B select BOARD_SYSTEM76_ADL_COMMON - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select MAINBOARD_USES_IFD_GBE_REGION @@ -49,12 +46,10 @@ config BOARD_SYSTEM76_LEMP11 config BOARD_SYSTEM76_ORYP9 select BOARD_SYSTEM76_ADL_COMMON select DRIVERS_I2C_TAS5825M - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU config BOARD_SYSTEM76_ORYP10 select BOARD_SYSTEM76_ADL_COMMON - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU if BOARD_SYSTEM76_ADL_COMMON diff --git a/src/mainboard/system76/bonw14/Kconfig b/src/mainboard/system76/bonw14/Kconfig index 32eae45b3d..4478a23656 100644 --- a/src/mainboard/system76/bonw14/Kconfig +++ b/src/mainboard/system76/bonw14/Kconfig @@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_I2C_HID select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES diff --git a/src/mainboard/system76/cml-u/Kconfig b/src/mainboard/system76/cml-u/Kconfig index df108e97b5..6f1d67ff3a 100644 --- a/src/mainboard/system76/cml-u/Kconfig +++ b/src/mainboard/system76/cml-u/Kconfig @@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_I2C_HID select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP6 select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_CMOS_DEFAULT diff --git a/src/mainboard/system76/gaze15/Kconfig b/src/mainboard/system76/gaze15/Kconfig index 2be6d4a6ca..da34ed63a9 100644 --- a/src/mainboard/system76/gaze15/Kconfig +++ b/src/mainboard/system76/gaze15/Kconfig @@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_I2C_HID select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES diff --git a/src/mainboard/system76/oryp5/Kconfig b/src/mainboard/system76/oryp5/Kconfig index 9a10add01c..e01bac6634 100644 --- a/src/mainboard/system76/oryp5/Kconfig +++ b/src/mainboard/system76/oryp5/Kconfig @@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_I2C_HID select DRIVERS_I2C_TAS5825M select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES diff --git a/src/mainboard/system76/oryp6/Kconfig b/src/mainboard/system76/oryp6/Kconfig index 05e89bddb8..f4543eff34 100644 --- a/src/mainboard/system76/oryp6/Kconfig +++ b/src/mainboard/system76/oryp6/Kconfig @@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_I2C_HID select DRIVERS_I2C_TAS5825M select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES diff --git a/src/mainboard/system76/rpl/Kconfig b/src/mainboard/system76/rpl/Kconfig index a2c962b19e..ac063d77dd 100644 --- a/src/mainboard/system76/rpl/Kconfig +++ b/src/mainboard/system76/rpl/Kconfig @@ -24,7 +24,6 @@ config BOARD_SYSTEM76_RPL_COMMON config BOARD_SYSTEM76_ADDW3 select BOARD_SYSTEM76_RPL_COMMON - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select MAINBOARD_USES_IFD_GBE_REGION select PCIEXP_HOTPLUG @@ -37,13 +36,11 @@ config BOARD_SYSTEM76_DARP9 config BOARD_SYSTEM76_GAZE18 select BOARD_SYSTEM76_RPL_COMMON - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select SOC_INTEL_ALDERLAKE_PCH_P config BOARD_SYSTEM76_ORYP11 select BOARD_SYSTEM76_RPL_COMMON - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select SOC_INTEL_ALDERLAKE_PCH_P select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES diff --git a/src/mainboard/system76/tgl-h/Kconfig b/src/mainboard/system76/tgl-h/Kconfig index bd886b8b46..9fd2ee2e0d 100644 --- a/src/mainboard/system76/tgl-h/Kconfig +++ b/src/mainboard/system76/tgl-h/Kconfig @@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_I2C_HID select DRIVERS_I2C_TAS5825M if BOARD_SYSTEM76_ORYP8 select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD select EC_SYSTEM76_EC_DGPU select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES diff --git a/src/mainboard/system76/tgl-u/Kconfig b/src/mainboard/system76/tgl-u/Kconfig index d493fa8b48..927f130a75 100644 --- a/src/mainboard/system76/tgl-u/Kconfig +++ b/src/mainboard/system76/tgl-u/Kconfig @@ -9,7 +9,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_INTEL_PMC select DRIVERS_INTEL_USB4_RETIMER select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP7 select EC_SYSTEM76_EC_DGPU if BOARD_SYSTEM76_GALP5 select HAVE_ACPI_TABLES select HAVE_CMOS_DEFAULT diff --git a/src/mainboard/system76/whl-u/Kconfig b/src/mainboard/system76/whl-u/Kconfig index 6a23901f80..e3d8a2248f 100644 --- a/src/mainboard/system76/whl-u/Kconfig +++ b/src/mainboard/system76/whl-u/Kconfig @@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_I2C_HID select EC_SYSTEM76_EC - select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP5 select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_CMOS_DEFAULT