Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86318?usp=email )
Change subject: {ec,mb}/starlabs: Consolidate EC-related CFR options in ec directory ......................................................................
{ec,mb}/starlabs: Consolidate EC-related CFR options in ec directory
Move all of the EC-related CFR options into a header in the ec directory, so it can be reused across multiple boards.
TEST=build/boot starlabs/starbook_mtl,starlite_adl and verify CFR options work properly.
Change-Id: I831559184de917b32e4993e8e34ffbc7b7e883e4 Signed-off-by: Matt DeVillier matt.devillier@gmail.com --- A src/ec/starlabs/merlin/cfr.h M src/mainboard/starlabs/lite/cfr.c M src/mainboard/starlabs/starbook/cfr.c M src/mainboard/starlabs/starfighter/cfr.c M src/mainboard/starlabs/starlite_adl/cfr.c 5 files changed, 117 insertions(+), 227 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/86318/1
diff --git a/src/ec/starlabs/merlin/cfr.h b/src/ec/starlabs/merlin/cfr.h new file mode 100644 index 0000000..b56e7d2 --- /dev/null +++ b/src/ec/starlabs/merlin/cfr.h @@ -0,0 +1,114 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * CFR enums and structs which are used to control EC settings. + */ + +#include <drivers/option/cfr_frontend.h> +#include "ec.h" + +/* + * Keyboard Backlight Timeout + */ +static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ + .opt_name = "kbl_timeout", + .ui_name = "Keyboard Backlight Timeout", + .ui_helptext = "Set the amount of time before the keyboard backlight turns off" + " when un-used", + .default_value = 0, + .values = (struct sm_enum_value[]) { + { "30 seconds", 0 }, + { "1 minute", 1 }, + { "3 minutes", 2 }, + { "5 minutes", 3 }, + { "Never", 4 }, + SM_ENUM_VALUE_END }, +}); + + +/* + * Function-Control Swap + */ +static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ + .opt_name = "fn_ctrl_swap", + .ui_name = "Fn Ctrl Reverse", + .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", + .default_value = false, +}); + +/* + * Maximum Battery Charge Level + */ +static const struct sm_object max_charge = SM_DECLARE_ENUM({ + .opt_name = "max_charge", + .ui_name = "Maximum Charge Level", + .ui_helptext = "Set the maximum level the battery will charge to.", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "100%", 0 }, + { "80%", 1 }, + { "60%", 2 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Fan Mode + */ +static const struct sm_object fan_mode = SM_DECLARE_ENUM({ + .opt_name = "fan_mode", + .ui_name = "Fan Mode", + .ui_helptext = "Adjust the fan curve to prioritize performance or noise levels.", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Normal", 0 }, + { "Aggressive", 1 }, + { "Quiet", 2 }, + { "Disabled", 3 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Charging Speed + */ +static const struct sm_object charging_speed = SM_DECLARE_ENUM({ + .opt_name = "charging_speed", + .ui_name = "Charging Speed", + .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" + " will increase heat and battery wear.", + .default_value = 1, + .values = (const struct sm_enum_value[]) { + { "1.0C", 0 }, + { "0.5C", 1 }, + { "0.2C", 2 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Lid Switch + */ +static const struct sm_object lid_switch = SM_DECLARE_ENUM({ + .opt_name = "lid_switch", + .ui_name = "Lid Switch", + .ui_helptext = "Configure what opening or closing the lid will do.", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Normal", 0 }, + { "Sleep Only", 1 }, + { "Disabled", 2 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Power LED Brightness + */ +static const struct sm_object power_led = SM_DECLARE_ENUM({ + .opt_name = "power_led", + .ui_name = "Power LED Brightness", + .ui_helptext = "Control the maximum brightness of the power LED", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Normal", 0 }, + { "Reduced", 1 }, + SM_ENUM_VALUE_END, + }, +}); diff --git a/src/mainboard/starlabs/lite/cfr.c b/src/mainboard/starlabs/lite/cfr.c index e0d22e6..251f55c 100644 --- a/src/mainboard/starlabs/lite/cfr.c +++ b/src/mainboard/starlabs/lite/cfr.c @@ -3,6 +3,7 @@ #include <boot/coreboot_tables.h> #include <commonlib/coreboot_tables.h> #include <drivers/option/cfr_frontend.h> +#include <ec/starlabs/merlin/cfr.h> #include <inttypes.h> #include <intelblocks/pcie_rp.h> #include <string.h> @@ -54,28 +55,6 @@ }); #endif
-static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ - .opt_name = "fn_ctrl_swap", - .ui_name = "Fn Ctrl Reverse", - .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", - .default_value = false, -}); - -static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ - .opt_name = "kbl_timeout", - .ui_name = "Keyboard Backlight Timeout", - .ui_helptext = "Set the amount of time before the keyboard backlight turns off" - " when un-used", - .default_value = 0, - .values = (struct sm_enum_value[]) { - { "30 seconds", 0 }, - { "1 minute", 1 }, - { "3 minutes", 2 }, - { "5 minutes", 3 }, - { "Never", 4 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object power_on_after_fail = SM_DECLARE_BOOL({ .opt_name = "power_on_after_fail", .ui_name = "Power on after failure", diff --git a/src/mainboard/starlabs/starbook/cfr.c b/src/mainboard/starlabs/starbook/cfr.c index bf0e4b0..1e08ba1 100644 --- a/src/mainboard/starlabs/starbook/cfr.c +++ b/src/mainboard/starlabs/starbook/cfr.c @@ -3,6 +3,7 @@ #include <boot/coreboot_tables.h> #include <commonlib/coreboot_tables.h> #include <drivers/option/cfr_frontend.h> +#include <ec/starlabs/merlin/cfr.h> #include <inttypes.h> #include <intelblocks/pcie_rp.h> #include <string.h> @@ -27,21 +28,6 @@ .default_value = true, });
-#if CONFIG(EC_STARLABS_CHARGING_SPEED) -static const struct sm_object charging_speed = SM_DECLARE_ENUM({ - .opt_name = "charging_speed", - .ui_name = "Charging Speed", - .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" - " will increase heat and battery wear.", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "1.0C", 0 }, - { "0.5C", 1 }, - { "0.2C", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - static const struct sm_object debug_level = SM_DECLARE_ENUM({ .opt_name = "debug_level", .ui_name = "Debug Level", @@ -60,19 +46,6 @@ SM_ENUM_VALUE_END }, });
-static const struct sm_object fan_mode = SM_DECLARE_ENUM({ - .opt_name = "fan_mode", - .ui_name = "Fan Mode", - .ui_helptext = "Adjust the fan curve to prioritize performance or noise levels.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Aggressive", 1 }, - { "Quiet", 2 }, - { "Disabled", 3 }, - SM_ENUM_VALUE_END }, -}); - #if CONFIG(BOARD_STARLABS_STARBOOK_ADL) || CONFIG(BOARD_STARLABS_STARBOOK_RPL) static const struct sm_object fingerprint_reader = SM_DECLARE_BOOL({ .opt_name = "fingerprint_reader", @@ -82,13 +55,6 @@ }); #endif
-static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ - .opt_name = "fn_ctrl_swap", - .ui_name = "Fn Ctrl Reverse", - .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", - .default_value = false, -}); - #if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE) static const struct sm_object gna = SM_DECLARE_BOOL({ .opt_name = "gna", @@ -107,47 +73,6 @@ }); #endif
-static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ - .opt_name = "kbl_timeout", - .ui_name = "Keyboard Backlight Timeout", - .ui_helptext = "Set the amount of time before the keyboard backlight turns off" - " when un-used", - .default_value = 0, - .values = (struct sm_enum_value[]) { - { "30 seconds", 0 }, - { "1 minute", 1 }, - { "3 minutes", 2 }, - { "5 minutes", 3 }, - { "Never", 4 }, - SM_ENUM_VALUE_END }, -}); - -#if CONFIG(EC_STARLABS_LID_SWITCH) -static const struct sm_object lid_switch = SM_DECLARE_ENUM({ - .opt_name = "lid_switch", - .ui_name = "Lid Switch", - .ui_helptext = "Configure what opening or closing the lid will do.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Sleep Only", 1 }, - { "Disabled", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - -static const struct sm_object max_charge = SM_DECLARE_ENUM({ - .opt_name = "max_charge", - .ui_name = "Maximum Charge Level", - .ui_helptext = "Set the maximum level the battery will charge to.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "100%", 0 }, - { "80%", 1 }, - { "60%", 2 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object me_state = SM_DECLARE_ENUM({ .opt_name = "me_state", .ui_name = "Intel Management Engine", diff --git a/src/mainboard/starlabs/starfighter/cfr.c b/src/mainboard/starlabs/starfighter/cfr.c index f310f86..7e040cc 100644 --- a/src/mainboard/starlabs/starfighter/cfr.c +++ b/src/mainboard/starlabs/starfighter/cfr.c @@ -3,6 +3,7 @@ #include <boot/coreboot_tables.h> #include <commonlib/coreboot_tables.h> #include <drivers/option/cfr_frontend.h> +#include <ec/starlabs/merlin/cfr.h> #include <inttypes.h> #include <intelblocks/pcie_rp.h> #include <string.h> @@ -20,21 +21,6 @@ SM_ENUM_VALUE_END }, });
-#if CONFIG(EC_STARLABS_CHARGING_SPEED) -static const struct sm_object charging_speed = SM_DECLARE_ENUM({ - .opt_name = "charging_speed", - .ui_name = "Charging Speed", - .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" - " will increase heat and battery wear.", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "1.0C", 0 }, - { "0.5C", 1 }, - { "0.2C", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - static const struct sm_object debug_level = SM_DECLARE_ENUM({ .opt_name = "debug_level", .ui_name = "Debug Level", @@ -53,26 +39,6 @@ SM_ENUM_VALUE_END }, });
-static const struct sm_object fan_mode = SM_DECLARE_ENUM({ - .opt_name = "fan_mode", - .ui_name = "Fan Mode", - .ui_helptext = "Adjust the fan curve to prioritize performance or noise levels.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Aggressive", 1 }, - { "Quiet", 2 }, - { "Disabled", 3 }, - SM_ENUM_VALUE_END }, -}); - -static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ - .opt_name = "fn_ctrl_swap", - .ui_name = "Fn Ctrl Reverse", - .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", - .default_value = false, -}); - #if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE) static const struct sm_object gna = SM_DECLARE_BOOL({ .opt_name = "gna", @@ -89,47 +55,6 @@ .default_value = true, });
-static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ - .opt_name = "kbl_timeout", - .ui_name = "Keyboard Backlight Timeout", - .ui_helptext = "Set the amount of time before the keyboard backlight turns off" - " when un-used", - .default_value = 0, - .values = (struct sm_enum_value[]) { - { "30 seconds", 0 }, - { "1 minute", 1 }, - { "3 minutes", 2 }, - { "5 minutes", 3 }, - { "Never", 4 }, - SM_ENUM_VALUE_END }, -}); - -#if CONFIG(EC_STARLABS_LID_SWITCH) -static const struct sm_object lid_switch = SM_DECLARE_ENUM({ - .opt_name = "lid_switch", - .ui_name = "Lid Switch", - .ui_helptext = "Configure what opening or closing the lid will do.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Sleep Only", 1 }, - { "Disabled", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - -static const struct sm_object max_charge = SM_DECLARE_ENUM({ - .opt_name = "max_charge", - .ui_name = "Maximum Charge Level", - .ui_helptext = "Set the maximum level the battery will charge to.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "100%", 0 }, - { "80%", 1 }, - { "60%", 2 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object me_state = SM_DECLARE_ENUM({ .opt_name = "me_state", .ui_name = "Intel Management Engine", diff --git a/src/mainboard/starlabs/starlite_adl/cfr.c b/src/mainboard/starlabs/starlite_adl/cfr.c index a8e44fa..dc1ed5e 100644 --- a/src/mainboard/starlabs/starlite_adl/cfr.c +++ b/src/mainboard/starlabs/starlite_adl/cfr.c @@ -27,21 +27,6 @@ SM_ENUM_VALUE_END }, });
-#if CONFIG(EC_STARLABS_CHARGING_SPEED) -static const struct sm_object charging_speed = SM_DECLARE_ENUM({ - .opt_name = "charging_speed", - .ui_name = "Charging Speed", - .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" - " will increase heat and battery wear.", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "1.0C", 0 }, - { "0.5C", 1 }, - { "0.2C", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - static const struct sm_object debug_level = SM_DECLARE_ENUM({ .opt_name = "debug_level", .ui_name = "Debug Level", @@ -69,32 +54,6 @@ }); #endif
-#if CONFIG(EC_STARLABS_LID_SWITCH) -static const struct sm_object lid_switch = SM_DECLARE_ENUM({ - .opt_name = "lid_switch", - .ui_name = "Lid Switch", - .ui_helptext = "Configure what opening or closing the lid will do.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Sleep Only", 1 }, - { "Disabled", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - -static const struct sm_object max_charge = SM_DECLARE_ENUM({ - .opt_name = "max_charge", - .ui_name = "Maximum Charge Level", - .ui_helptext = "Set the maximum level the battery will charge to.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "100%", 0 }, - { "80%", 1 }, - { "60%", 2 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object me_state = SM_DECLARE_ENUM({ .opt_name = "me_state", .ui_name = "Intel Management Engine", @@ -194,18 +153,6 @@ }); #endif
-static const struct sm_object power_led = SM_DECLARE_ENUM({ - .opt_name = "power_led", - .ui_name = "Power LED Brightness", - .ui_helptext = "Control the maximum brightness of the power LED", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Reduced", 1 }, - SM_ENUM_VALUE_END, - }, -}); - static const struct sm_object reboot_counter = SM_DECLARE_NUMBER({ .opt_name = "reboot_counter", .ui_name = "Reboot Counter",