Skip to content

Commit 1180c79

Browse files
vadimp-nvidiagroeck
authored andcommitted
hwmon: mlxreg-fan: Prevent fans from getting stuck at 0 RPM
The fans controlled by the driver can get stuck at 0 RPM if they are configured below a 20% duty cycle. The driver tries to avoid this by enforcing a minimum duty cycle of 20%, but this is done after the fans are registered with the thermal subsystem. This is too late as the thermal subsystem can set their current state before the driver is able to enforce the minimum duty cycle. Fix by setting the minimum duty cycle before registering the fans with the thermal subsystem. Fixes: d7efb2e ("hwmon: (mlxreg-fan) Extend driver to support multiply cooling devices") Reported-by: Nikolay Aleksandrov <razor@blackwall.org> Tested-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20250730201715.1111133-1-vadimp@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 1b237f1 commit 1180c79

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/hwmon/mlxreg-fan.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,14 @@ static int mlxreg_fan_cooling_config(struct device *dev, struct mlxreg_fan *fan)
561561
if (!pwm->connected)
562562
continue;
563563
pwm->fan = fan;
564+
/* Set minimal PWM speed. */
565+
pwm->last_hwmon_state = MLXREG_FAN_PWM_DUTY2STATE(MLXREG_FAN_MIN_DUTY);
564566
pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, mlxreg_fan_name[i],
565567
pwm, &mlxreg_fan_cooling_ops);
566568
if (IS_ERR(pwm->cdev)) {
567569
dev_err(dev, "Failed to register cooling device\n");
568570
return PTR_ERR(pwm->cdev);
569571
}
570-
571-
/* Set minimal PWM speed. */
572-
pwm->last_hwmon_state = MLXREG_FAN_PWM_DUTY2STATE(MLXREG_FAN_MIN_DUTY);
573572
}
574573

575574
return 0;

0 commit comments

Comments
 (0)