]> git.baikalelectronics.ru Git - kernel.git/commit
hwmon: (pwm-fan) Explicitly switch off fan power when setting pwm1_enable to 0
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Thu, 13 Oct 2022 13:59:51 +0000 (15:59 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 16 Oct 2022 22:52:59 +0000 (15:52 -0700)
commit1c0cc49e71cab19f788fbd959fdc1c04dc6455d2
tree09f302cd9603d5ca6078c9cf292b7403440440de
parentd5d7e34867180fbaf7a0056372d63d334c481b04
hwmon: (pwm-fan) Explicitly switch off fan power when setting pwm1_enable to 0

When pwm1_enable is changed from 1 to 0 while pwm1 == 0, the regulator
is not switched off as expected. The reason is that when the fan is
already off, ctx->enabled is false, so pwm_fan_power_off() will be a
no-op.

Handle this case explicitly in pwm_fan_update_enable() by calling
pwm_fan_switch_power() directly.

Fixes: 428fecea3d10 ("hwmon: (pwm-fan) Switch regulator dynamically")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Link: https://lore.kernel.org/r/20221013135951.4902-1-matthias.schiffer@ew.tq-group.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pwm-fan.c