mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans
@ 2014-12-04 16:58 Nishanth Menon
  2014-12-04 19:05 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Nishanth Menon @ 2014-12-04 16:58 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: linux-kernel, lm-sensors, linux-omap, Nishanth Menon

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>
---
based on next-20141204 , but can rebase to required branch as needed.

 drivers/hwmon/gpio-fan.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index 7802eb2..36abf81 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,
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans
  2014-12-04 16:58 [PATCH] hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans Nishanth Menon
@ 2014-12-04 19:05 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2014-12-04 19:05 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: Jean Delvare, linux-kernel, lm-sensors, linux-omap

On Thu, Dec 04, 2014 at 10:58:56AM -0600, Nishanth Menon wrote:
> 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>
> ---

Applied to hwmon-next.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-04 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-04 16:58 [PATCH] hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans Nishanth Menon
2014-12-04 19:05 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®