From 0ff3c3d2ecb05c30706d09f79dd39f62f7bbfa4d Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Wed, 18 Feb 2026 21:02:41 +0100 Subject: [PATCH] ec/lenovo/h8: Replace CFR enums with booleans Boolean options are intended to represent generic "Enable"/"Disable" options, but without enum options' extra bloat in the CFR structures. The "volume" option has been left as-is because the code reading its value does not seem to handle it like a boolean. Change-Id: If183957cff6097187904e0d76c7d3ad997fe365c Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/91341 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/ec/lenovo/h8/cfr.h | 78 ++++++++++-------------------------------- 1 file changed, 19 insertions(+), 59 deletions(-) diff --git a/src/ec/lenovo/h8/cfr.h b/src/ec/lenovo/h8/cfr.h index b410f2d449..fbda80471a 100644 --- a/src/ec/lenovo/h8/cfr.h +++ b/src/ec/lenovo/h8/cfr.h @@ -11,27 +11,19 @@ #include "h8.h" /* Bluetooth */ -static const struct sm_object bluetooth = SM_DECLARE_ENUM({ +static const struct sm_object bluetooth = SM_DECLARE_BOOL({ .opt_name = "bluetooth", .ui_name = "Bluetooth", .ui_helptext = "Enable or disable the bluetooth module", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = true, }); /* Keyboard Backlight */ -static const struct sm_object backlight = SM_DECLARE_ENUM({ +static const struct sm_object backlight = SM_DECLARE_BOOL({ .opt_name = "backlight", .ui_name = "Keyboard Backlight", .ui_helptext = "Enable or disable the keyboard backlight", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = false, }); /* USB Always-On */ @@ -48,15 +40,11 @@ static const struct sm_object usb_always_on = SM_DECLARE_ENUM({ }); /* Ultrawideband */ -static const struct sm_object uwb = SM_DECLARE_ENUM({ +static const struct sm_object uwb = SM_DECLARE_BOOL({ .opt_name = "uwb", .ui_name = "Ultrawideband", .ui_helptext = "TBD", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = true, }); /* Volume control */ @@ -72,87 +60,59 @@ static const struct sm_object volume = SM_DECLARE_ENUM({ }); /* WLAN */ -static const struct sm_object wlan = SM_DECLARE_ENUM({ +static const struct sm_object wlan = SM_DECLARE_BOOL({ .opt_name = "wlan", .ui_name = "WLAN", .ui_helptext = "Enable or disable the WLAN module", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = true, }); /* WWAN */ -static const struct sm_object wwan = SM_DECLARE_ENUM({ +static const struct sm_object wwan = SM_DECLARE_BOOL({ .opt_name = "wwan", .ui_name = "WWAN", .ui_helptext = "Enable or disable the WWAN module", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = true, }); /* Power Management Beeps */ -static const struct sm_object pm_beeps = SM_DECLARE_ENUM({ +static const struct sm_object pm_beeps = SM_DECLARE_BOOL({ .opt_name = "power_management_beeps", .ui_name = "Power Management Beeps", .ui_helptext = "Enable or disable power management beeps", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = true, }); /* Low Battery Beep */ -static const struct sm_object battery_beep = SM_DECLARE_ENUM({ +static const struct sm_object battery_beep = SM_DECLARE_BOOL({ .opt_name = "low_battery_beep", .ui_name = "Low Battery Beep", .ui_helptext = "Enable or disable low battery beep", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = true, }); /* Fn-CTRL Swap */ -static const struct sm_object fn_ctrl_swap = SM_DECLARE_ENUM({ +static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ .opt_name = "fn_ctrl_swap", .ui_name = "Swap Fn and CTRL", .ui_helptext = "Swap the left Fn and CTRL keys", .default_value = CONFIG(H8_FN_CTRL_SWAP), - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, }); /* Fn Lock */ -static const struct sm_object sticky_fn = SM_DECLARE_ENUM({ +static const struct sm_object sticky_fn = SM_DECLARE_BOOL({ .opt_name = "sticky_fn", .ui_name = "Sticky Fn key", .ui_helptext = "Function key acts as a toggle", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = false, }); /* Function keys primary */ -static const struct sm_object f1_to_f12_as_primary = SM_DECLARE_ENUM({ +static const struct sm_object f1_to_f12_as_primary = SM_DECLARE_BOOL({ .opt_name = "f1_to_f12_as_primary", .ui_name = "Primary Function keys", .ui_helptext = "F1-F12 default act as function keys", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "Disabled", 0 }, - { "Enabled", 1 }, - SM_ENUM_VALUE_END }, + .default_value = true, }); #endif /* _LENOVO_H8_CFR_H_ */