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>
This commit is contained in:
Sean Rhodes 2024-06-27 12:27:04 +01:00
commit f666394ea5
18 changed files with 49 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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 = {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -13,5 +13,6 @@ wireless=Enable
webcam=Enable
camera=Enable
microphone=Enable
lid_switch=Disable
# EC
charging_speed=0.5C

View file

@ -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