summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2014-12-04 10:58:56 -0600
committerGuenter Roeck <linux@roeck-us.net>2014-12-04 11:04:14 -0800
commitb95579cd8795442e75c8846fa6eeb4fb442e9d83 (patch)
treedc421532956f1f10aa421de25956e0f606d9f154 /drivers/hwmon
parent52a95c1185220feb514c8e167bd6033c0da6f576 (diff)
hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans
Poweroff the fans when shutting down the system. Else, echo '1' > /sys/class/hwmon/hwmon0/fan1_target; poweroff leaves the fan running if the System power off does not drive the gpio expander which might control the fan power supply. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/gpio-fan.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index 7802eb2a442..36abf814b8c 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -550,6 +550,14 @@ static int gpio_fan_probe(struct platform_device *pdev)
return 0;
}
+static void gpio_fan_shutdown(struct platform_device *pdev)
+{
+ struct gpio_fan_data *fan_data = dev_get_drvdata(&pdev->dev);
+
+ if (fan_data->ctrl)
+ set_fan_speed(fan_data, 0);
+}
+
#ifdef CONFIG_PM_SLEEP
static int gpio_fan_suspend(struct device *dev)
{
@@ -581,6 +589,7 @@ static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
static struct platform_driver gpio_fan_driver = {
.probe = gpio_fan_probe,
+ .shutdown = gpio_fan_shutdown,
.driver = {
.name = "gpio-fan",
.pm = GPIO_FAN_PM,