Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nishanth Menon and committed by
Guenter Roeck
b95579cd 52a95c11

+9
+9
drivers/hwmon/gpio-fan.c
··· 550 550 return 0; 551 551 } 552 552 553 + static void gpio_fan_shutdown(struct platform_device *pdev) 554 + { 555 + struct gpio_fan_data *fan_data = dev_get_drvdata(&pdev->dev); 556 + 557 + if (fan_data->ctrl) 558 + set_fan_speed(fan_data, 0); 559 + } 560 + 553 561 #ifdef CONFIG_PM_SLEEP 554 562 static int gpio_fan_suspend(struct device *dev) 555 563 { ··· 589 581 590 582 static struct platform_driver gpio_fan_driver = { 591 583 .probe = gpio_fan_probe, 584 + .shutdown = gpio_fan_shutdown, 592 585 .driver = { 593 586 .name = "gpio-fan", 594 587 .pm = GPIO_FAN_PM,