From: Daniel Mack <daniel@caiaq.de>
To: linux-kernel@vger.kernel.org
Cc: Daniel Mack <daniel@caiaq.de>, Pavel Machek <pavel@ucw.cz>,
Eric Piel <eric.piel@tremplin-utc.net>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 3/4] piis3: add power management functions
Date: Mon, 22 Jun 2009 15:38:07 +0200 [thread overview]
Message-ID: <1245677888-16634-3-git-send-email-daniel@caiaq.de> (raw)
In-Reply-To: <1245677888-16634-2-git-send-email-daniel@caiaq.de>
This enabled power management functions for the SPI transport layer of
the lis3 devices. The device's suspend mode is only entered in case no
wakeup threshold has been given. In this case, the device is supposed
to wake up the system and must thus not be put to deep sleep.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Eric Piel <eric.piel@tremplin-utc.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
drivers/hwmon/lis3lv02d_spi.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 3827ff0..97d5f70 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -87,6 +87,32 @@ static int __devexit lis302dl_spi_remove(struct spi_device *spi)
return 0;
}
+#ifdef CONFIG_PM
+static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg)
+{
+ struct lis3lv02d *lis3 = spi_get_drvdata(spi);
+
+ if (!lis3->pdata->wakeup_flags)
+ lis3lv02d_poweroff(&lis3_dev);
+
+ return 0;
+}
+
+static int lis3lv02d_spi_resume(struct spi_device *spi)
+{
+ struct lis3lv02d *lis3 = spi_get_drvdata(spi);
+
+ if (!lis3->pdata->wakeup_flags)
+ lis3lv02d_poweron(lis3);
+
+ return 0;
+}
+
+#else
+#define lis3_spi_suspend NULL
+#define lis3_spi_resume NULL
+#endif
+
static struct spi_driver lis302dl_spi_driver = {
.driver = {
.name = DRV_NAME,
@@ -94,6 +120,8 @@ static struct spi_driver lis302dl_spi_driver = {
},
.probe = lis302dl_spi_probe,
.remove = __devexit_p(lis302dl_spi_remove),
+ .suspend = lis3lv02d_spi_suspend,
+ .resume = lis3lv02d_spi_resume,
};
static int __init lis302dl_init(void)
--
1.6.3.1
next prev parent reply other threads:[~2009-06-22 13:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 13:38 [PATCH 1/4] lis3: fix typo Daniel Mack
2009-06-22 13:38 ` [PATCH 2/4] lis3: add free-fall/wakeup function via platform_data Daniel Mack
2009-06-22 13:38 ` Daniel Mack [this message]
2009-06-22 13:38 ` [PATCH 4/4] lis3_spi: code cleanups Daniel Mack
2009-06-22 17:25 ` [PATCH 1/4] lis3: fix typo Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245677888-16634-3-git-send-email-daniel@caiaq.de \
--to=daniel@caiaq.de \
--cc=akpm@linux-foundation.org \
--cc=eric.piel@tremplin-utc.net \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®