From 5a19f7e3ceaa44a0c3cb1a78f28801b792c7c7a6 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 19 Apr 2021 15:04:22 +0200 Subject: superio/nuvoton/npcd378: Fix `psu_fan_lvl` option If the option is successfully read from CMOS, the code overwrites its value with 3. Fix this issue and use the new get_int_option() function. Change-Id: I287a348da6ece78376d9c38e96128041752b032e Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/52511 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/superio/nuvoton/npcd378/superio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c index 801592d234..6a56ac8b89 100644 --- a/src/superio/nuvoton/npcd378/superio.c +++ b/src/superio/nuvoton/npcd378/superio.c @@ -50,7 +50,6 @@ void npcd378_hwm_write_finished(const uint16_t iobase) static void npcd378_init(struct device *dev) { struct resource *res; - uint8_t pwm, fan_lvl; if (!dev->enabled) return; @@ -69,10 +68,11 @@ static void npcd378_init(struct device *dev) npcd378_hwm_write_start(res->base); - if (!get_option(&fan_lvl, "psu_fan_lvl") || fan_lvl > 7) + int fan_lvl = get_int_option("psu_fan_lvl", -1); + if (fan_lvl < 0 || fan_lvl > 7) fan_lvl = 3; - pwm = NPCD378_HWM_PSU_FAN_MIN + + uint8_t pwm = NPCD378_HWM_PSU_FAN_MIN + (NPCD378_HWM_PSU_FAN_MAX - NPCD378_HWM_PSU_FAN_MIN) * fan_lvl / 7; -- cgit v1.2.3