Skip to content

Commit 7992db7

Browse files
mitagroeck
authored andcommitted
hwmon: (pwm-fan) stop fan on shutdown
The pwm-fan driver stops the fan in suspend but leaves the fan on in shutdown. It seems strange to leave the fan on in shutdown because there is no use case in my mind and the gpio-fan driver on the other hand stops in shutdown. This change turns off the fan in shutdown. If anyone complains then we'll add an optional property to switch the behavior. Cc: Rob Herring <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Kamil Debski <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Uwe Kleine-König <[email protected]> Signed-off-by: Akinobu Mita <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 05592be commit 7992db7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/hwmon/pwm-fan.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
390390
return 0;
391391
}
392392

393-
#ifdef CONFIG_PM_SLEEP
394-
static int pwm_fan_suspend(struct device *dev)
393+
static int pwm_fan_disable(struct device *dev)
395394
{
396395
struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
397396
struct pwm_args args;
@@ -418,6 +417,17 @@ static int pwm_fan_suspend(struct device *dev)
418417
return 0;
419418
}
420419

420+
static void pwm_fan_shutdown(struct platform_device *pdev)
421+
{
422+
pwm_fan_disable(&pdev->dev);
423+
}
424+
425+
#ifdef CONFIG_PM_SLEEP
426+
static int pwm_fan_suspend(struct device *dev)
427+
{
428+
return pwm_fan_disable(dev);
429+
}
430+
421431
static int pwm_fan_resume(struct device *dev)
422432
{
423433
struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
@@ -455,6 +465,7 @@ MODULE_DEVICE_TABLE(of, of_pwm_fan_match);
455465

456466
static struct platform_driver pwm_fan_driver = {
457467
.probe = pwm_fan_probe,
468+
.shutdown = pwm_fan_shutdown,
458469
.driver = {
459470
.name = "pwm-fan",
460471
.pm = &pwm_fan_pm,

0 commit comments

Comments
 (0)