diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-04-19 15:04:22 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-04-21 09:07:40 +0000 |
commit | 5a19f7e3ceaa44a0c3cb1a78f28801b792c7c7a6 (patch) | |
tree | 1ebb9f85b1f2bdc373ac340b2edfd8c6a85dc44d /src/superio | |
parent | 612249dc8b2d61087588be0878f02f27ecc352c3 (diff) |
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 <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52511
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src/superio')
-rw-r--r-- | src/superio/nuvoton/npcd378/superio.c | 6 |
1 files 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; |