Sean Rhodes has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84634?usp=email )
(
9 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: ec/starlabs/merlin: Add support for disabling the lid switch ......................................................................
ec/starlabs/merlin: Add support for disabling the lid switch
Allow boards that use the merlin EC to disable the lid switch.
Change-Id: Ib5f71ce46e9e97a1a02e4ea5af6aeb094ee6fad7 Signed-off-by: Sean Rhodes sean@starlabs.systems Reviewed-on: https://review.coreboot.org/c/coreboot/+/84634 Reviewed-by: Maxim Polyakov max.senia.poliak@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/ec/starlabs/merlin/Kconfig M src/ec/starlabs/merlin/ec.h M src/ec/starlabs/merlin/ite.c M src/ec/starlabs/merlin/variants/apl/ecdefs.h M src/ec/starlabs/merlin/variants/cezanne/ecdefs.h M src/ec/starlabs/merlin/variants/glk/ecdefs.h M src/ec/starlabs/merlin/variants/glkr/ecdefs.h M src/ec/starlabs/merlin/variants/kbl/ecdefs.h M src/ec/starlabs/merlin/variants/merlin/ecdefs.h M src/mainboard/starlabs/starbook/Kconfig M src/mainboard/starlabs/starbook/cmos.default M src/mainboard/starlabs/starbook/cmos.layout M src/mainboard/starlabs/starfighter/Kconfig M src/mainboard/starlabs/starfighter/cmos.default M src/mainboard/starlabs/starfighter/cmos.layout M src/mainboard/starlabs/starlite_adl/Kconfig M src/mainboard/starlabs/starlite_adl/cmos.default M src/mainboard/starlabs/starlite_adl/cmos.layout 18 files changed, 49 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Maxim Polyakov: Looks good to me, approved
diff --git a/src/ec/starlabs/merlin/Kconfig b/src/ec/starlabs/merlin/Kconfig index fd8000e..32b3ed0 100644 --- a/src/ec/starlabs/merlin/Kconfig +++ b/src/ec/starlabs/merlin/Kconfig @@ -70,6 +70,12 @@ help Select if the mainboard supports configuring the charging speed.
+config EC_STARLABS_LID_SWITCH + bool "Enable disabling the lid switch" + depends on EC_STARLABS_ITE + help + Select if the mainboard supports disabling the lid switch + config EC_STARLABS_MERLIN bool "Use open-source Merlin EC Firmware" default n diff --git a/src/ec/starlabs/merlin/ec.h b/src/ec/starlabs/merlin/ec.h index 728f255..7372f52 100644 --- a/src/ec/starlabs/merlin/ec.h +++ b/src/ec/starlabs/merlin/ec.h @@ -103,6 +103,10 @@ #define SPEED_0_5C 0x01 #define SPEED_0_2C 0x02
+/* Lid Switch */ +#define SWITCH_ENABLED 0x00 +#define SWITCH_DISABLED 0x01 + uint16_t ec_get_version(void);
#endif diff --git a/src/ec/starlabs/merlin/ite.c b/src/ec/starlabs/merlin/ite.c index 03b3a96..383c1a4 100644 --- a/src/ec/starlabs/merlin/ite.c +++ b/src/ec/starlabs/merlin/ite.c @@ -70,6 +70,7 @@ * kbl_brightness * kbl_state * charging_speed + * lid_switch */
/* @@ -263,6 +264,27 @@ SPEED_0_5C, charging_speed, ARRAY_SIZE(charging_speed))); + + /* + * Lid Switch + * + * Setting: lid_switch + * + * Values: 0, 1 + * Default: 0 + * + */ + const uint8_t lid_switch[] = { + SWITCH_ENABLED, + SWITCH_DISABLED + }; + + if (CONFIG(EC_STARLABS_LID_SWITCH)) + ec_write(ECRAM_LID_SWITCH, + get_ec_value_from_option("lid_switch", + 0, + lid_switch, + ARRAY_SIZE(lid_switch))); }
static struct device_operations ops = { diff --git a/src/ec/starlabs/merlin/variants/apl/ecdefs.h b/src/ec/starlabs/merlin/variants/apl/ecdefs.h index a7a0c75..72baf09 100644 --- a/src/ec/starlabs/merlin/variants/apl/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/apl/ecdefs.h @@ -21,5 +21,6 @@ #define ECRAM_FAN_MODE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) #define ECRAM_CHARGING_SPEED dead_code_t(uint8_t) +#define ECRAM_LID_SWITCH dead_code_t(uint8_t)
#endif diff --git a/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h b/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h index aa75e28..967e3c3 100644 --- a/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h @@ -24,5 +24,6 @@ #define ECRAM_FN_LOCK_STATE 0x70 #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) #define ECRAM_CHARGING_SPEED dead_code_t(uint8_t) +#define ECRAM_LID_SWITCH dead_code_t(uint8_t)
#endif diff --git a/src/ec/starlabs/merlin/variants/glk/ecdefs.h b/src/ec/starlabs/merlin/variants/glk/ecdefs.h index 9037904..9178d0c 100644 --- a/src/ec/starlabs/merlin/variants/glk/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/glk/ecdefs.h @@ -21,5 +21,6 @@ #define ECRAM_FAN_MODE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) #define ECRAM_CHARGING_SPEED dead_code_t(uint8_t) +#define ECRAM_LID_SWITCH dead_code_t(uint8_t)
#endif diff --git a/src/ec/starlabs/merlin/variants/glkr/ecdefs.h b/src/ec/starlabs/merlin/variants/glkr/ecdefs.h index 9c3daa0..a36f4df 100644 --- a/src/ec/starlabs/merlin/variants/glkr/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/glkr/ecdefs.h @@ -24,5 +24,6 @@ #define ECRAM_FAN_MODE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE 0x18 #define ECRAM_CHARGING_SPEED dead_code_t(uint8_t) +#define ECRAM_LID_SWITCH dead_code_t(uint8_t)
#endif diff --git a/src/ec/starlabs/merlin/variants/kbl/ecdefs.h b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h index d15a6ad8..1c821d4 100644 --- a/src/ec/starlabs/merlin/variants/kbl/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h @@ -21,5 +21,6 @@ #define ECRAM_MAX_CHARGE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) #define ECRAM_CHARGING_SPEED dead_code_t(uint8_t) +#define ECRAM_LID_SWITCH dead_code_t(uint8_t)
#endif diff --git a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h index 37b0562..fb1d5b2 100644 --- a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h @@ -21,5 +21,6 @@ #define ECRAM_FAN_MODE 0x1b #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) #define ECRAM_CHARGING_SPEED 0x1d +#define ECRAM_LID_SWITCH 0x1e
#endif diff --git a/src/mainboard/starlabs/starbook/Kconfig b/src/mainboard/starlabs/starbook/Kconfig index f3dd24a..83dd84f 100644 --- a/src/mainboard/starlabs/starbook/Kconfig +++ b/src/mainboard/starlabs/starbook/Kconfig @@ -31,6 +31,7 @@ select BOARD_STARLABS_STARBOOK_SERIES select EC_STARLABS_CHARGING_SPEED select EC_STARLABS_KBL_LEVELS + select EC_STARLABS_LID_SWITCH select EC_STARLABS_MAX_CHARGE select EC_STARLABS_MERLIN select EC_STARLABS_NEED_ITE_BIN @@ -48,6 +49,7 @@ select DRIVERS_INTEL_USB4_RETIMER select EC_STARLABS_CHARGING_SPEED select EC_STARLABS_KBL_LEVELS + select EC_STARLABS_LID_SWITCH select EC_STARLABS_MAX_CHARGE select EC_STARLABS_MERLIN select EC_STARLABS_NEED_ITE_BIN @@ -66,6 +68,7 @@ select DRIVERS_INTEL_PMC select EC_STARLABS_CHARGING_SPEED select EC_STARLABS_KBL_LEVELS + select EC_STARLABS_LID_SWITCH select EC_STARLABS_MAX_CHARGE select EC_STARLABS_MERLIN select EC_STARLABS_NEED_ITE_BIN diff --git a/src/mainboard/starlabs/starbook/cmos.default b/src/mainboard/starlabs/starbook/cmos.default index d5f195e..8cb7190 100644 --- a/src/mainboard/starlabs/starbook/cmos.default +++ b/src/mainboard/starlabs/starbook/cmos.default @@ -17,6 +17,7 @@ pci_hot_plug=Disable fingerprint_reader=Enable card_reader=Enable +lid_switch=Enable # EC kbl_timeout=30 seconds fn_ctrl_swap=Disable diff --git a/src/mainboard/starlabs/starbook/cmos.layout b/src/mainboard/starlabs/starbook/cmos.layout index fad4032..55b1629 100644 --- a/src/mainboard/starlabs/starbook/cmos.layout +++ b/src/mainboard/starlabs/starbook/cmos.layout @@ -34,6 +34,7 @@ 536 1 e 1 pci_hot_plug 542 1 e 1 fingerprint_reader 550 1 e 1 card_reader +558 1 e 1 lid_switch
# coreboot config options: EC 600 3 e 4 kbl_timeout diff --git a/src/mainboard/starlabs/starfighter/Kconfig b/src/mainboard/starlabs/starfighter/Kconfig index 7fd6c29..42c7ab6 100644 --- a/src/mainboard/starlabs/starfighter/Kconfig +++ b/src/mainboard/starlabs/starfighter/Kconfig @@ -10,6 +10,7 @@ select EC_STARLABS_ITE select EC_STARLABS_CHARGING_SPEED select EC_STARLABS_KBL_LEVELS + select EC_STARLABS_LID_SWITCH select EC_STARLABS_MAX_CHARGE select EC_STARLABS_MERLIN select EC_STARLABS_NEED_ITE_BIN diff --git a/src/mainboard/starlabs/starfighter/cmos.default b/src/mainboard/starlabs/starfighter/cmos.default index 7d0d447..a47d3be 100644 --- a/src/mainboard/starlabs/starfighter/cmos.default +++ b/src/mainboard/starlabs/starfighter/cmos.default @@ -13,6 +13,7 @@ webcam=Enable microphone=Enable pci_hot_plug=Disable +lid_switch=Enable # EC kbl_timeout=30 seconds fn_ctrl_swap=Disable diff --git a/src/mainboard/starlabs/starfighter/cmos.layout b/src/mainboard/starlabs/starfighter/cmos.layout index affe40f..27e450d 100644 --- a/src/mainboard/starlabs/starfighter/cmos.layout +++ b/src/mainboard/starlabs/starfighter/cmos.layout @@ -30,6 +30,7 @@ 504 1 e 1 wireless 512 1 e 1 webcam 520 1 e 1 microphone +528 1 e 1 lid_switch
# coreboot config options: EC 600 3 e 4 kbl_timeout diff --git a/src/mainboard/starlabs/starlite_adl/Kconfig b/src/mainboard/starlabs/starlite_adl/Kconfig index 5c3ff34..9c0bf92 100644 --- a/src/mainboard/starlabs/starlite_adl/Kconfig +++ b/src/mainboard/starlabs/starlite_adl/Kconfig @@ -2,6 +2,7 @@ def_bool n select DRIVERS_I2C_HID select EC_STARLABS_CHARGING_SPEED + select EC_STARLABS_LID_SWITCH select EC_STARLABS_ITE select EC_STARLABS_MAX_CHARGE select EC_STARLABS_MERLIN diff --git a/src/mainboard/starlabs/starlite_adl/cmos.default b/src/mainboard/starlabs/starlite_adl/cmos.default index a850e85..1290b4f 100644 --- a/src/mainboard/starlabs/starlite_adl/cmos.default +++ b/src/mainboard/starlabs/starlite_adl/cmos.default @@ -13,5 +13,6 @@ webcam=Enable camera=Enable microphone=Enable +lid_switch=Disable # EC charging_speed=0.5C diff --git a/src/mainboard/starlabs/starlite_adl/cmos.layout b/src/mainboard/starlabs/starlite_adl/cmos.layout index 6ca539d..3ee4644 100644 --- a/src/mainboard/starlabs/starlite_adl/cmos.layout +++ b/src/mainboard/starlabs/starlite_adl/cmos.layout @@ -30,6 +30,7 @@ 512 1 e 1 webcam 520 1 e 1 camera 528 1 e 1 microphone +536 1 e 1 lid_switch
# coreboot config options: EC 600 2 e 6 max_charge