ec/starlabs/merlin: Add charge LED brightness control
Add support for controlling charge LED brightness similar to the existing power LED brightness control. This includes: - New Kconfig option EC_STARLABS_CHARGE_LED - Charge LED CFR option in cfr.h - Implementation in ite.c using shared led_brightness array - ECRAM_CHARGE_LED register definition Refactor LED brightness enum values into shared led_brightness array for reuse between power and charge LED controls. EC changes for charge LED brightness TEST=build/boot starlabs/lite_adl and verify LED control via CFR Change-Id: I0f243d666e1fdc7d6df9859bb1cdcf460b6029ec Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Ali Hamid <ali@starlabs.systems> Reviewed-on: https://review.coreboot.org/c/coreboot/+/90563 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Sean Rhodes <sean@starlabs.systems>
This commit is contained in:
parent
ac170631d5
commit
84ff3d3d12
7 changed files with 52 additions and 9 deletions
|
|
@ -94,6 +94,12 @@ config EC_STARLABS_POWER_LED
|
|||
bool "Enable lowering the brightess of the Power LED"
|
||||
default y
|
||||
help
|
||||
Select the in the mainboard supports reducing the LED brightness
|
||||
Select if the mainboard supports reducing the power LED brightness
|
||||
|
||||
config EC_STARLABS_CHARGE_LED
|
||||
bool "Enable lowering the brightess of the Charge LED"
|
||||
default y
|
||||
help
|
||||
Select if the mainboard supports reducing the charge LED brightness
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -98,6 +98,13 @@ static const struct sm_object lid_switch = SM_DECLARE_ENUM({
|
|||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
const struct sm_enum_value led_brightness[] = {
|
||||
{ "Normal", LED_NORMAL },
|
||||
{ "Reduced", LED_REDUCED },
|
||||
{ "Off", LED_OFF },
|
||||
SM_ENUM_VALUE_END
|
||||
};
|
||||
|
||||
/*
|
||||
* Power LED Brightness
|
||||
*/
|
||||
|
|
@ -106,9 +113,16 @@ static const struct sm_object power_led = SM_DECLARE_ENUM({
|
|||
.ui_name = "Power LED Brightness",
|
||||
.ui_helptext = "Control the maximum brightness of the power LED",
|
||||
.default_value = LED_NORMAL,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Normal", LED_NORMAL },
|
||||
{ "Reduced", LED_REDUCED },
|
||||
{ "Off", LED_OFF },
|
||||
SM_ENUM_VALUE_END },
|
||||
.values = led_brightness,
|
||||
});
|
||||
|
||||
/*
|
||||
* Charge LED Brightness
|
||||
*/
|
||||
static const struct sm_object charge_led = SM_DECLARE_ENUM({
|
||||
.opt_name = "charge_led",
|
||||
.ui_name = "Charge LED Brightness",
|
||||
.ui_helptext = "Control the maximum brightness of the charge LED",
|
||||
.default_value = LED_NORMAL,
|
||||
.values = led_brightness,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ static void merlin_init(struct device *dev)
|
|||
* Default: 0
|
||||
*
|
||||
*/
|
||||
const uint8_t power_led[] = {
|
||||
const uint8_t led_brightness[] = {
|
||||
LED_NORMAL,
|
||||
LED_REDUCED,
|
||||
LED_OFF
|
||||
|
|
@ -355,8 +355,27 @@ static void merlin_init(struct device *dev)
|
|||
ec_write(ECRAM_POWER_LED,
|
||||
get_ec_value_from_option("power_led",
|
||||
LED_NORMAL,
|
||||
power_led,
|
||||
ARRAY_SIZE(power_led),
|
||||
led_brightness,
|
||||
ARRAY_SIZE(led_brightness),
|
||||
UINT_MAX,
|
||||
UINT_MAX));
|
||||
|
||||
/*
|
||||
* Charge LED Brightness
|
||||
*
|
||||
* Setting: charge_led
|
||||
*
|
||||
* Values: 0, 1, 2
|
||||
* Default: 0
|
||||
*
|
||||
*/
|
||||
|
||||
if (CONFIG(EC_STARLABS_CHARGE_LED))
|
||||
ec_write(ECRAM_CHARGE_LED,
|
||||
get_ec_value_from_option("charge_led",
|
||||
LED_NORMAL,
|
||||
led_brightness,
|
||||
ARRAY_SIZE(led_brightness),
|
||||
UINT_MAX,
|
||||
UINT_MAX));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#define ECRAM_KBL_TIMEOUT 0x1a
|
||||
#define ECRAM_FN_LOCK_STATE 0x2c
|
||||
#define ECRAM_FN_CTRL_REVERSE 0x2d
|
||||
#define ECRAM_CHARGE_LED dead_code_t(uint8_t)
|
||||
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#define ECRAM_KBL_TIMEOUT 0x12
|
||||
#define ECRAM_FN_LOCK_STATE 0x15
|
||||
#define ECRAM_FN_CTRL_REVERSE 0x13
|
||||
#define ECRAM_CHARGE_LED dead_code_t(uint8_t)
|
||||
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#define ECRAM_FN_LOCK_STATE 0x2c
|
||||
#define ECRAM_FAN_MODE 0x42
|
||||
#define ECRAM_FN_CTRL_REVERSE 0x43
|
||||
#define ECRAM_CHARGE_LED dead_code_t(uint8_t)
|
||||
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
#define ECRAM_LID_SWITCH dead_code_t(uint8_t)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#define ECRAM_TRACKPAD_STATE 0x0c
|
||||
#define ECRAM_FN_LOCK_STATE 0x0f
|
||||
#define ECRAM_FN_CTRL_REVERSE 0x17
|
||||
#define ECRAM_CHARGE_LED 0x18
|
||||
#define ECRAM_MAX_CHARGE 0x1a
|
||||
#define ECRAM_FAN_MODE 0x1b
|
||||
#define ECRAM_CHARGING_SPEED 0x1d
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue