ec/lenovo: Use get_int_option()
Change-Id: Ie5cb54b171244be71848a59a788ed8d42b3e3161 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47111 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
parent
f79030c6ba
commit
9dc1c51db4
|
@ -48,10 +48,5 @@ bool h8_has_bdc(const struct device *dev)
|
||||||
*/
|
*/
|
||||||
bool h8_bluetooth_nv_enable(void)
|
bool h8_bluetooth_nv_enable(void)
|
||||||
{
|
{
|
||||||
u8 val;
|
return get_int_option("bluetooth", true);
|
||||||
|
|
||||||
if (get_option(&val, "bluetooth") != CB_SUCCESS)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,9 +242,8 @@ static void h8_enable(struct device *dev)
|
||||||
|
|
||||||
reg8 = conf->config1;
|
reg8 = conf->config1;
|
||||||
if (conf->has_keyboard_backlight) {
|
if (conf->has_keyboard_backlight) {
|
||||||
if (get_option(&val, "backlight") != CB_SUCCESS)
|
/* Default to both backlights */
|
||||||
val = 0; /* Both backlights. */
|
reg8 = (reg8 & 0xf3) | ((get_int_option("backlight", 0) & 0x3) << 2);
|
||||||
reg8 = (reg8 & 0xf3) | ((val & 0x3) << 2);
|
|
||||||
}
|
}
|
||||||
ec_write(H8_CONFIG1, reg8);
|
ec_write(H8_CONFIG1, reg8);
|
||||||
ec_write(H8_CONFIG2, conf->config2);
|
ec_write(H8_CONFIG2, conf->config2);
|
||||||
|
@ -253,17 +252,15 @@ static void h8_enable(struct device *dev)
|
||||||
beepmask0 = conf->beepmask0;
|
beepmask0 = conf->beepmask0;
|
||||||
beepmask1 = conf->beepmask1;
|
beepmask1 = conf->beepmask1;
|
||||||
|
|
||||||
if (conf->has_power_management_beeps
|
if (conf->has_power_management_beeps) {
|
||||||
&& get_option(&val, "power_management_beeps") == CB_SUCCESS
|
if (get_int_option("power_management_beeps", 1) == 0) {
|
||||||
&& val == 0) {
|
|
||||||
beepmask0 = 0x00;
|
beepmask0 = 0x00;
|
||||||
beepmask1 = 0x00;
|
beepmask1 = 0x00;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (conf->has_power_management_beeps) {
|
if (conf->has_power_management_beeps) {
|
||||||
if (get_option(&val, "low_battery_beep") != CB_SUCCESS)
|
if (get_int_option("low_battery_beep", 1))
|
||||||
val = 1;
|
|
||||||
if (val)
|
|
||||||
beepmask0 |= 2;
|
beepmask0 |= 2;
|
||||||
else
|
else
|
||||||
beepmask0 &= ~2;
|
beepmask0 &= ~2;
|
||||||
|
@ -295,19 +292,16 @@ static void h8_enable(struct device *dev)
|
||||||
|
|
||||||
ec_write(H8_FAN_CONTROL, H8_FAN_CONTROL_AUTO);
|
ec_write(H8_FAN_CONTROL, H8_FAN_CONTROL_AUTO);
|
||||||
|
|
||||||
if (get_option(&val, "usb_always_on") != CB_SUCCESS)
|
h8_usb_always_on_enable(get_int_option("usb_always_on", 0));
|
||||||
val = 0;
|
|
||||||
h8_usb_always_on_enable(val);
|
|
||||||
|
|
||||||
if (get_option(&val, "wlan") != CB_SUCCESS)
|
h8_wlan_enable(get_int_option("wlan", 1));
|
||||||
val = 1;
|
|
||||||
h8_wlan_enable(val);
|
|
||||||
|
|
||||||
h8_trackpoint_enable(1);
|
h8_trackpoint_enable(1);
|
||||||
h8_usb_power_enable(1);
|
h8_usb_power_enable(1);
|
||||||
|
|
||||||
if (get_option(&val, "volume") == CB_SUCCESS && !acpi_is_wakeup_s3())
|
int volume = get_int_option("volume", -1);
|
||||||
ec_write(H8_VOLUME_CONTROL, val);
|
if (volume >= 0 && !acpi_is_wakeup_s3())
|
||||||
|
ec_write(H8_VOLUME_CONTROL, volume);
|
||||||
|
|
||||||
val = (CONFIG(H8_SUPPORT_BT_ON_WIFI) || h8_has_bdc(dev)) &&
|
val = (CONFIG(H8_SUPPORT_BT_ON_WIFI) || h8_has_bdc(dev)) &&
|
||||||
h8_bluetooth_nv_enable();
|
h8_bluetooth_nv_enable();
|
||||||
|
@ -316,30 +310,17 @@ static void h8_enable(struct device *dev)
|
||||||
val = h8_has_wwan(dev) && h8_wwan_nv_enable();
|
val = h8_has_wwan(dev) && h8_wwan_nv_enable();
|
||||||
h8_wwan_enable(val);
|
h8_wwan_enable(val);
|
||||||
|
|
||||||
if (conf->has_uwb) {
|
if (conf->has_uwb)
|
||||||
if (get_option(&val, "uwb") != CB_SUCCESS)
|
h8_uwb_enable(get_int_option("uwb", 1));
|
||||||
val = 1;
|
|
||||||
|
|
||||||
h8_uwb_enable(val);
|
h8_fn_ctrl_swap(get_int_option("fn_ctrl_swap", 0));
|
||||||
}
|
|
||||||
|
|
||||||
if (get_option(&val, "fn_ctrl_swap") != CB_SUCCESS)
|
h8_sticky_fn(get_int_option("sticky_fn", 0));
|
||||||
val = 0;
|
|
||||||
h8_fn_ctrl_swap(val);
|
|
||||||
|
|
||||||
if (get_option(&val, "sticky_fn") != CB_SUCCESS)
|
if (CONFIG(H8_HAS_PRIMARY_FN_KEYS))
|
||||||
val = 0;
|
f1_to_f12_as_primary(get_int_option("f1_to_f12_as_primary", 1));
|
||||||
h8_sticky_fn(val);
|
|
||||||
|
|
||||||
if (CONFIG(H8_HAS_PRIMARY_FN_KEYS)) {
|
h8_charge_priority(get_int_option("first_battery", PRIMARY_BATTERY));
|
||||||
if (get_option(&val, "f1_to_f12_as_primary") != CB_SUCCESS)
|
|
||||||
val = 1;
|
|
||||||
f1_to_f12_as_primary(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_option(&val, "first_battery") != CB_SUCCESS)
|
|
||||||
val = PRIMARY_BATTERY;
|
|
||||||
h8_charge_priority(val);
|
|
||||||
|
|
||||||
h8_set_audio_mute(0);
|
h8_set_audio_mute(0);
|
||||||
h8_mb_init();
|
h8_mb_init();
|
||||||
|
|
|
@ -46,10 +46,5 @@ bool h8_has_wwan(const struct device *dev)
|
||||||
*/
|
*/
|
||||||
bool h8_wwan_nv_enable(void)
|
bool h8_wwan_nv_enable(void)
|
||||||
{
|
{
|
||||||
u8 val;
|
return get_int_option("wwan", true);
|
||||||
|
|
||||||
if (get_option(&val, "wwan") != CB_SUCCESS)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,6 @@ static void enable_dev(struct device *dev)
|
||||||
{
|
{
|
||||||
const struct ec_lenovo_pmh7_config *conf = dev->chip_info;
|
const struct ec_lenovo_pmh7_config *conf = dev->chip_info;
|
||||||
struct resource *resource;
|
struct resource *resource;
|
||||||
u8 val;
|
|
||||||
|
|
||||||
resource = new_resource(dev, EC_LENOVO_PMH7_INDEX);
|
resource = new_resource(dev, EC_LENOVO_PMH7_INDEX);
|
||||||
resource->flags = IORESOURCE_IO | IORESOURCE_FIXED;
|
resource->flags = IORESOURCE_IO | IORESOURCE_FIXED;
|
||||||
|
@ -118,13 +117,9 @@ static void enable_dev(struct device *dev)
|
||||||
pmh7_backlight_enable(conf->backlight_enable);
|
pmh7_backlight_enable(conf->backlight_enable);
|
||||||
pmh7_dock_event_enable(conf->dock_event_enable);
|
pmh7_dock_event_enable(conf->dock_event_enable);
|
||||||
|
|
||||||
if (get_option(&val, "touchpad") != CB_SUCCESS)
|
pmh7_touchpad_enable(get_int_option("touchpad", 1));
|
||||||
val = 1;
|
|
||||||
pmh7_touchpad_enable(val);
|
|
||||||
|
|
||||||
if (get_option(&val, "trackpoint") != CB_SUCCESS)
|
pmh7_trackpoint_enable(get_int_option("trackpoint", 1));
|
||||||
val = 1;
|
|
||||||
pmh7_trackpoint_enable(val);
|
|
||||||
|
|
||||||
printk(BIOS_INFO, "PMH7: ID %02x Revision %02x\n",
|
printk(BIOS_INFO, "PMH7: ID %02x Revision %02x\n",
|
||||||
pmh7_register_read(EC_LENOVO_PMH7_REG_ID),
|
pmh7_register_read(EC_LENOVO_PMH7_REG_ID),
|
||||||
|
|
Loading…
Reference in New Issue