From 8580047dfab84c3ecc1b3fed07c0f8b20f49c014 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 26 Apr 2021 16:33:03 +0200 Subject: [PATCH] mb/dell/optiplex_9010: Always log chosen fan mode Always print the chosen fan mode, not only when get_int_option() returns the fallback value. Callers of get_int_option() should not try to handle option-related errors, and simply proceed using the fallback value. This change is needed to update the option API to use unsigned integers. The CMOS option system does not support negative numbers. Change-Id: Ic8adbe557b48a46f785d82fddb16383678705e87 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/52670 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph Reviewed-by: Nico Huber --- src/mainboard/dell/optiplex_9010/sch5545_ec.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/mainboard/dell/optiplex_9010/sch5545_ec.c b/src/mainboard/dell/optiplex_9010/sch5545_ec.c index db13495aad..9e25f18faa 100644 --- a/src/mainboard/dell/optiplex_9010/sch5545_ec.c +++ b/src/mainboard/dell/optiplex_9010/sch5545_ec.c @@ -656,20 +656,17 @@ void sch5545_ec_hwm_init(void *unused) ec_read_write_reg(EC_HWM_LDN, 0x02fc, &val_2fc, WRITE_OP); - int fan_speed_full = get_int_option("fan_full_speed", -1); - if (fan_speed_full < 0) { - fan_speed_full = 0; - printk(BIOS_INFO, "fan_full_speed CMOS option not found. " - "Fans will be set up for automatic control\n"); - } - + unsigned int fan_speed_full = get_int_option("fan_full_speed", 0); if (fan_speed_full) { + printk(BIOS_INFO, "Will set up fans to run at full speed\n"); ec_read_write_reg(EC_HWM_LDN, 0x0080, &val, READ_OP); val |= 0x60; ec_read_write_reg(EC_HWM_LDN, 0x0080, &val, WRITE_OP); ec_read_write_reg(EC_HWM_LDN, 0x0081, &val, READ_OP); val |= 0x60; ec_read_write_reg(EC_HWM_LDN, 0x0081, &val, WRITE_OP); + } else { + printk(BIOS_INFO, "Will set up fans for automatic control\n"); } ec_read_write_reg(EC_HWM_LDN, 0x00b8, &val, READ_OP);