[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <11548492972486-git-send-email-multinymous@gmail.com>
Date: Sun, 06 Aug 2006 10:26:55 +0300
From: Shem Multinymous <multinymous@...il.com>
To: Robert Love <rlove@...ve.org>
Cc: Jean Delvare <khali@...ux-fr.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
linux-kernel@...r.kernel.org, hdaps-devel@...ts.sourceforge.net
Subject: [PATCH 10/12] hdaps: Power off accelerometer on suspend and unload
This patch disables accelerometer power and stops its polling by the
embedded controller upon suspend and module unload. The power saving
is negligible, but it's the right thing to do.
Signed-off-by: Shem Multinymous <multinymous@...il.com>
---
hdaps.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff -up a/drivers/hwmon/hdaps.c a/drivers/hwmon/hdaps.c
--- a/drivers/hwmon/hdaps.c
+++ a/drivers/hwmon/hdaps.c
@@ -348,6 +348,15 @@ good:
return ret;
}
+/*
+ * hdaps_device_shutdown - power off the accelerometer. Can sleep.
+ */
+static void hdaps_device_shutdown(void) {
+ if (hdaps_set_power(0))
+ printk(KERN_WARNING "hdaps: cannot power off\n");
+ if (hdaps_set_ec_config(0, 1))
+ printk(KERN_WARNING "hdaps: cannot stop EC sampling\n");
+}
/* Device model stuff */
@@ -363,6 +372,12 @@ static int hdaps_probe(struct platform_d
return 0;
}
+static int hdaps_suspend(struct platform_device *dev, pm_message_t state)
+{
+ hdaps_device_shutdown();
+ return 0;
+}
+
static int hdaps_resume(struct platform_device *dev)
{
return hdaps_device_init();
@@ -370,6 +385,7 @@ static int hdaps_resume(struct platform_
static struct platform_driver hdaps_driver = {
.probe = hdaps_probe,
+ .suspend = hdaps_suspend,
.resume = hdaps_resume,
.driver = {
.name = "hdaps",
@@ -762,6 +778,7 @@ static void __exit hdaps_exit(void)
{
del_timer_sync(&hdaps_timer);
input_unregister_device(hdaps_idev);
+ hdaps_device_shutdown();
sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
platform_device_unregister(pdev);
platform_driver_unregister(&hdaps_driver);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists