diff --git a/src/ec/starlabs/merlin/Kconfig b/src/ec/starlabs/merlin/Kconfig index fd8000e39e..32b3ed02b8 100644 --- a/src/ec/starlabs/merlin/Kconfig +++ b/src/ec/starlabs/merlin/Kconfig @@ -70,6 +70,12 @@ config EC_STARLABS_CHARGING_SPEED 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 728f255a09..7372f5262e 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 03b3a96999..383c1a4a0e 100644 --- a/src/ec/starlabs/merlin/ite.c +++ b/src/ec/starlabs/merlin/ite.c @@ -70,6 +70,7 @@ static void merlin_init(struct device *dev) * kbl_brightness * kbl_state * charging_speed + * lid_switch */ /* @@ -263,6 +264,27 @@ static void merlin_init(struct device *dev) 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 a7a0c753b6..72baf09983 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 aa75e28e04..967e3c3c5e 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 9037904034..9178d0cbdc 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 9c3daa094c..a36f4df8c2 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 d15a6ad820..1c821d49f7 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 37b0562014..fb1d5b2030 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 f3dd24a8a7..83dd84fbd2 100644 --- a/src/mainboard/starlabs/starbook/Kconfig +++ b/src/mainboard/starlabs/starbook/Kconfig @@ -31,6 +31,7 @@ config BOARD_STARLABS_LABTOP_CML 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 @@ config BOARD_STARLABS_STARBOOK_TGL 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 @@ config BOARD_STARLABS_STARBOOK_ADL_COMMON 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 d5f195ec92..8cb7190a91 100644 --- a/src/mainboard/starlabs/starbook/cmos.default +++ b/src/mainboard/starlabs/starbook/cmos.default @@ -17,6 +17,7 @@ legacy_8254_timer=Disable 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 fad4032bf3..55b16292ed 100644 --- a/src/mainboard/starlabs/starbook/cmos.layout +++ b/src/mainboard/starlabs/starbook/cmos.layout @@ -34,6 +34,7 @@ entries 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 7fd6c29f75..42c7ab6480 100644 --- a/src/mainboard/starlabs/starfighter/Kconfig +++ b/src/mainboard/starlabs/starfighter/Kconfig @@ -10,6 +10,7 @@ config BOARD_STARLABS_STARFIGHTER_SERIES 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 7d0d447b0f..a47d3bee46 100644 --- a/src/mainboard/starlabs/starfighter/cmos.default +++ b/src/mainboard/starlabs/starfighter/cmos.default @@ -13,6 +13,7 @@ wireless=Enable 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 affe40fc4d..27e450df79 100644 --- a/src/mainboard/starlabs/starfighter/cmos.layout +++ b/src/mainboard/starlabs/starfighter/cmos.layout @@ -30,6 +30,7 @@ entries 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 5c3ff34e7b..9c0bf92dd7 100644 --- a/src/mainboard/starlabs/starlite_adl/Kconfig +++ b/src/mainboard/starlabs/starlite_adl/Kconfig @@ -2,6 +2,7 @@ config BOARD_STARLABS_STARLITE_SERIES 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 a850e859c7..1290b4fad2 100644 --- a/src/mainboard/starlabs/starlite_adl/cmos.default +++ b/src/mainboard/starlabs/starlite_adl/cmos.default @@ -13,5 +13,6 @@ wireless=Enable 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 6ca539d612..3ee4644fb0 100644 --- a/src/mainboard/starlabs/starlite_adl/cmos.layout +++ b/src/mainboard/starlabs/starlite_adl/cmos.layout @@ -30,6 +30,7 @@ entries 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