Skip to content

Commit

Permalink
hwmon: (pwm-fan) stop fan on shutdown
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mita authored and groeck committed Jan 23, 2020
1 parent 05592be commit 7992db7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/hwmon/pwm-fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM_SLEEP
static int pwm_fan_suspend(struct device *dev)
static int pwm_fan_disable(struct device *dev)
{
struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
struct pwm_args args;
Expand All @@ -418,6 +417,17 @@ static int pwm_fan_suspend(struct device *dev)
return 0;
}

static void pwm_fan_shutdown(struct platform_device *pdev)
{
pwm_fan_disable(&pdev->dev);
}

#ifdef CONFIG_PM_SLEEP
static int pwm_fan_suspend(struct device *dev)
{
return pwm_fan_disable(dev);
}

static int pwm_fan_resume(struct device *dev)
{
struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
Expand Down Expand Up @@ -455,6 +465,7 @@ MODULE_DEVICE_TABLE(of, of_pwm_fan_match);

static struct platform_driver pwm_fan_driver = {
.probe = pwm_fan_probe,
.shutdown = pwm_fan_shutdown,
.driver = {
.name = "pwm-fan",
.pm = &pwm_fan_pm,
Expand Down

0 comments on commit 7992db7

Please sign in to comment.