{ec,mb}/system76: Replace color keyboard logic

System76 EC since system76/ec@9ac513128a 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>
This commit is contained in:
Tim Crawford 2023-07-14 11:13:08 -06:00 committed by Felix Held
parent 6875231472
commit 6255c13927
13 changed files with 39 additions and 53 deletions

View File

@ -8,11 +8,6 @@ config EC_SYSTEM76_EC_BAT_THRESHOLDS
bool bool
default y default y
config EC_SYSTEM76_EC_COLOR_KEYBOARD
depends on EC_SYSTEM76_EC
bool
default n
config EC_SYSTEM76_EC_DGPU config EC_SYSTEM76_EC_DGPU
depends on EC_SYSTEM76_EC depends on EC_SYSTEM76_EC
bool bool

View File

@ -16,10 +16,8 @@ Device (S76D) {
Method (RSET, 0, Serialized) { Method (RSET, 0, Serialized) {
Printf ("S76D: RSET") Printf ("S76D: RSET")
SAPL(0) SAPL(0)
SKBL(0) SKBB(0)
#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) SKBC(0xFFFFFF)
SKBC(0xFFFFFF)
#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
} }
Method (INIT, 0, Serialized) { Method (INIT, 0, Serialized) {
@ -67,53 +65,63 @@ Device (S76D) {
} }
} }
#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) // Get Keyboard Backlight Kind
// Set KB LED Brightness // 0 - No backlight
Method (SKBL, 1, Serialized) { // 1 - White backlight
// 2 - RGB backlight
Method (GKBK, 0, Serialized) {
Local0 = 0
If (^^PCI0.LPCB.EC0.ECOK) { If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 6 ^^PCI0.LPCB.EC0.FDAT = 2
^^PCI0.LPCB.EC0.FBUF = Arg0
^^PCI0.LPCB.EC0.FBF1 = 0
^^PCI0.LPCB.EC0.FBF2 = Arg0
^^PCI0.LPCB.EC0.FCMD = 0xCA ^^PCI0.LPCB.EC0.FCMD = 0xCA
Local0 = ^^PCI0.LPCB.EC0.FBUF
} }
Return (Local0)
} }
// Set Keyboard Color // Get Keyboard Brightness
Method (SKBC, 1, Serialized) { Method (GKBB, 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)
}
}
#else // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
// Get KB LED
Method (GKBL, 0, Serialized) {
Local0 = 0 Local0 = 0
If (^^PCI0.LPCB.EC0.ECOK) { If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 1 ^^PCI0.LPCB.EC0.FDAT = 1
^^PCI0.LPCB.EC0.FCMD = 0xCA ^^PCI0.LPCB.EC0.FCMD = 0xCA
Local0 = ^^PCI0.LPCB.EC0.FBUF Local0 = ^^PCI0.LPCB.EC0.FBUF
^^PCI0.LPCB.EC0.FCMD = 0
} }
Return (Local0) Return (Local0)
} }
// Set KB Led // Set Keyboard Brightness
Method (SKBL, 1, Serialized) { Method (SKBB, 1, Serialized) {
If (^^PCI0.LPCB.EC0.ECOK) { If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 0 ^^PCI0.LPCB.EC0.FDAT = 0
^^PCI0.LPCB.EC0.FBUF = Arg0 ^^PCI0.LPCB.EC0.FBUF = Arg0
^^PCI0.LPCB.EC0.FCMD = 0xCA ^^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 // Fan names
Method (NFAN, 0, Serialized) { Method (NFAN, 0, Serialized) {

View File

@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select DRIVERS_I2C_TAS5825M select DRIVERS_I2C_TAS5825M
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select EC_SYSTEM76_EC_OLED select EC_SYSTEM76_EC_OLED
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME

View File

@ -26,19 +26,16 @@ config BOARD_SYSTEM76_ADL_COMMON
config BOARD_SYSTEM76_DARP8 config BOARD_SYSTEM76_DARP8
select BOARD_SYSTEM76_ADL_COMMON select BOARD_SYSTEM76_ADL_COMMON
select EC_SYSTEM76_EC_COLOR_KEYBOARD
config BOARD_SYSTEM76_GALP6 config BOARD_SYSTEM76_GALP6
select BOARD_SYSTEM76_ADL_COMMON select BOARD_SYSTEM76_ADL_COMMON
config BOARD_SYSTEM76_GAZE17_3050 config BOARD_SYSTEM76_GAZE17_3050
select BOARD_SYSTEM76_ADL_COMMON select BOARD_SYSTEM76_ADL_COMMON
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
config BOARD_SYSTEM76_GAZE17_3060_B config BOARD_SYSTEM76_GAZE17_3060_B
select BOARD_SYSTEM76_ADL_COMMON select BOARD_SYSTEM76_ADL_COMMON
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select MAINBOARD_USES_IFD_GBE_REGION select MAINBOARD_USES_IFD_GBE_REGION
@ -49,12 +46,10 @@ config BOARD_SYSTEM76_LEMP11
config BOARD_SYSTEM76_ORYP9 config BOARD_SYSTEM76_ORYP9
select BOARD_SYSTEM76_ADL_COMMON select BOARD_SYSTEM76_ADL_COMMON
select DRIVERS_I2C_TAS5825M select DRIVERS_I2C_TAS5825M
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
config BOARD_SYSTEM76_ORYP10 config BOARD_SYSTEM76_ORYP10
select BOARD_SYSTEM76_ADL_COMMON select BOARD_SYSTEM76_ADL_COMMON
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
if BOARD_SYSTEM76_ADL_COMMON if BOARD_SYSTEM76_ADL_COMMON

View File

@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES

View File

@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP6
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES
select HAVE_CMOS_DEFAULT select HAVE_CMOS_DEFAULT

View File

@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES

View File

@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select DRIVERS_I2C_TAS5825M select DRIVERS_I2C_TAS5825M
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES

View File

@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select DRIVERS_I2C_TAS5825M select DRIVERS_I2C_TAS5825M
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES

View File

@ -24,7 +24,6 @@ config BOARD_SYSTEM76_RPL_COMMON
config BOARD_SYSTEM76_ADDW3 config BOARD_SYSTEM76_ADDW3
select BOARD_SYSTEM76_RPL_COMMON select BOARD_SYSTEM76_RPL_COMMON
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select MAINBOARD_USES_IFD_GBE_REGION select MAINBOARD_USES_IFD_GBE_REGION
select PCIEXP_HOTPLUG select PCIEXP_HOTPLUG
@ -37,13 +36,11 @@ config BOARD_SYSTEM76_DARP9
config BOARD_SYSTEM76_GAZE18 config BOARD_SYSTEM76_GAZE18
select BOARD_SYSTEM76_RPL_COMMON select BOARD_SYSTEM76_RPL_COMMON
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select SOC_INTEL_ALDERLAKE_PCH_P select SOC_INTEL_ALDERLAKE_PCH_P
config BOARD_SYSTEM76_ORYP11 config BOARD_SYSTEM76_ORYP11
select BOARD_SYSTEM76_RPL_COMMON select BOARD_SYSTEM76_RPL_COMMON
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select SOC_INTEL_ALDERLAKE_PCH_P select SOC_INTEL_ALDERLAKE_PCH_P
select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES

View File

@ -8,7 +8,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select DRIVERS_I2C_TAS5825M if BOARD_SYSTEM76_ORYP8 select DRIVERS_I2C_TAS5825M if BOARD_SYSTEM76_ORYP8
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select EC_SYSTEM76_EC_DGPU select EC_SYSTEM76_EC_DGPU
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES

View File

@ -9,7 +9,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_INTEL_PMC select DRIVERS_INTEL_PMC
select DRIVERS_INTEL_USB4_RETIMER select DRIVERS_INTEL_USB4_RETIMER
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP7
select EC_SYSTEM76_EC_DGPU if BOARD_SYSTEM76_GALP5 select EC_SYSTEM76_EC_DGPU if BOARD_SYSTEM76_GALP5
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES
select HAVE_CMOS_DEFAULT select HAVE_CMOS_DEFAULT

View File

@ -7,7 +7,6 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_GENERIC_CBFS_UUID select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_I2C_HID select DRIVERS_I2C_HID
select EC_SYSTEM76_EC select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP5
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES
select HAVE_CMOS_DEFAULT select HAVE_CMOS_DEFAULT