src: Retype option API to use unsigned integers
The CMOS option system does not support negative integers. Thus, retype
and rename the option API functions to reflect this.
Change-Id: Id3480e5cfc0ec90674def7ef0919e0b7ac5b19b3
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52672
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
diff --git a/src/ec/kontron/it8516e/ec.c b/src/ec/kontron/it8516e/ec.c
index 0b0e3ac..5288976 100644
--- a/src/ec/kontron/it8516e/ec.c
+++ b/src/ec/kontron/it8516e/ec.c
@@ -133,13 +133,13 @@
u8 fan_max = config->default_fan_max[fan_idx];
fanX_mode[3] = '1' + fan_idx;
- fan_mode = get_int_option(fanX_mode, fan_mode);
+ fan_mode = get_uint_option(fanX_mode, fan_mode);
if (!fan_mode)
fan_mode = IT8516E_MODE_AUTO;
it8516e_set_fan_mode(fan_idx, fan_mode);
fanX_target[3] = '1' + fan_idx;
- fan_target = get_int_option(fanX_target, fan_target);
+ fan_target = get_uint_option(fanX_target, fan_target);
switch (fan_mode) {
case IT8516E_MODE_AUTO:
printk(BIOS_DEBUG,
@@ -173,8 +173,8 @@
fanX_min[3] = '1' + fan_idx;
fanX_max[3] = '1' + fan_idx;
- fan_min = get_int_option(fanX_min, fan_min);
- fan_max = get_int_option(fanX_max, fan_max);
+ fan_min = get_uint_option(fanX_min, fan_min);
+ fan_max = get_uint_option(fanX_max, fan_max);
if (!fan_max || fan_max > 100) /* Constrain fan_max to 100% */
fan_max = 100;
@@ -202,7 +202,7 @@
ec_set_ports(find_resource(dev, PNP_IDX_IO1)->base,
find_resource(dev, PNP_IDX_IO0)->base);
- u8 systemp_type = get_int_option("systemp_type", config->default_systemp);
+ u8 systemp_type = get_uint_option("systemp_type", config->default_systemp);
if (systemp_type >= IT8516E_SYSTEMP_LASTPLUSONE)
systemp_type = IT8516E_SYSTEMP_NONE;
it8516e_set_systemp_type(systemp_type);
diff --git a/src/ec/lenovo/h8/bluetooth.c b/src/ec/lenovo/h8/bluetooth.c
index 463e0e3..16fc8dc 100644
--- a/src/ec/lenovo/h8/bluetooth.c
+++ b/src/ec/lenovo/h8/bluetooth.c
@@ -48,5 +48,5 @@
*/
bool h8_bluetooth_nv_enable(void)
{
- return get_int_option("bluetooth", true);
+ return get_uint_option("bluetooth", true);
}
diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c
index e17f0fb..b081ec8 100644
--- a/src/ec/lenovo/h8/h8.c
+++ b/src/ec/lenovo/h8/h8.c
@@ -243,7 +243,7 @@
reg8 = conf->config1;
if (conf->has_keyboard_backlight) {
/* Default to both backlights */
- reg8 = (reg8 & 0xf3) | ((get_int_option("backlight", 0) & 0x3) << 2);
+ reg8 = (reg8 & 0xf3) | ((get_uint_option("backlight", 0) & 0x3) << 2);
}
ec_write(H8_CONFIG1, reg8);
ec_write(H8_CONFIG2, conf->config2);
@@ -253,14 +253,14 @@
beepmask1 = conf->beepmask1;
if (conf->has_power_management_beeps) {
- if (get_int_option("power_management_beeps", 1) == 0) {
+ if (get_uint_option("power_management_beeps", 1) == 0) {
beepmask0 = 0x00;
beepmask1 = 0x00;
}
}
if (conf->has_power_management_beeps) {
- if (get_int_option("low_battery_beep", 1))
+ if (get_uint_option("low_battery_beep", 1))
beepmask0 |= 2;
else
beepmask0 &= ~2;
@@ -292,14 +292,14 @@
ec_write(H8_FAN_CONTROL, H8_FAN_CONTROL_AUTO);
- h8_usb_always_on_enable(get_int_option("usb_always_on", 0));
+ h8_usb_always_on_enable(get_uint_option("usb_always_on", 0));
- h8_wlan_enable(get_int_option("wlan", 1));
+ h8_wlan_enable(get_uint_option("wlan", 1));
h8_trackpoint_enable(1);
h8_usb_power_enable(1);
- unsigned int volume = get_int_option("volume", ~0);
+ unsigned int volume = get_uint_option("volume", ~0);
if (volume <= 0xff && !acpi_is_wakeup_s3())
ec_write(H8_VOLUME_CONTROL, volume);
@@ -311,16 +311,16 @@
h8_wwan_enable(val);
if (conf->has_uwb)
- h8_uwb_enable(get_int_option("uwb", 1));
+ h8_uwb_enable(get_uint_option("uwb", 1));
- h8_fn_ctrl_swap(get_int_option("fn_ctrl_swap", 0));
+ h8_fn_ctrl_swap(get_uint_option("fn_ctrl_swap", 0));
- h8_sticky_fn(get_int_option("sticky_fn", 0));
+ h8_sticky_fn(get_uint_option("sticky_fn", 0));
if (CONFIG(H8_HAS_PRIMARY_FN_KEYS))
- f1_to_f12_as_primary(get_int_option("f1_to_f12_as_primary", 1));
+ f1_to_f12_as_primary(get_uint_option("f1_to_f12_as_primary", 1));
- h8_charge_priority(get_int_option("first_battery", PRIMARY_BATTERY));
+ h8_charge_priority(get_uint_option("first_battery", PRIMARY_BATTERY));
h8_set_audio_mute(0);
h8_mb_init();
diff --git a/src/ec/lenovo/h8/wwan.c b/src/ec/lenovo/h8/wwan.c
index 90f6b47..685886f 100644
--- a/src/ec/lenovo/h8/wwan.c
+++ b/src/ec/lenovo/h8/wwan.c
@@ -46,5 +46,5 @@
*/
bool h8_wwan_nv_enable(void)
{
- return get_int_option("wwan", true);
+ return get_uint_option("wwan", true);
}
diff --git a/src/ec/lenovo/pmh7/pmh7.c b/src/ec/lenovo/pmh7/pmh7.c
index f32c9f1..ebcbcde 100644
--- a/src/ec/lenovo/pmh7/pmh7.c
+++ b/src/ec/lenovo/pmh7/pmh7.c
@@ -117,9 +117,9 @@
pmh7_backlight_enable(conf->backlight_enable);
pmh7_dock_event_enable(conf->dock_event_enable);
- pmh7_touchpad_enable(get_int_option("touchpad", 1));
+ pmh7_touchpad_enable(get_uint_option("touchpad", 1));
- pmh7_trackpoint_enable(get_int_option("trackpoint", 1));
+ pmh7_trackpoint_enable(get_uint_option("trackpoint", 1));
printk(BIOS_INFO, "PMH7: ID %02x Revision %02x\n",
pmh7_register_read(EC_LENOVO_PMH7_REG_ID),