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>
This commit is contained in:
Angel Pons 2021-04-19 15:04:22 +02:00 committed by Patrick Georgi
parent 612249dc8b
commit 5a19f7e3ce
1 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,6 @@ void npcd378_hwm_write_finished(const uint16_t iobase)
static void npcd378_init(struct device *dev) static void npcd378_init(struct device *dev)
{ {
struct resource *res; struct resource *res;
uint8_t pwm, fan_lvl;
if (!dev->enabled) if (!dev->enabled)
return; return;
@ -69,10 +68,11 @@ static void npcd378_init(struct device *dev)
npcd378_hwm_write_start(res->base); 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; 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) * (NPCD378_HWM_PSU_FAN_MAX - NPCD378_HWM_PSU_FAN_MIN) *
fan_lvl / 7; fan_lvl / 7;