提交 2cd9645e 编写于 作者: D Daniel Mack 提交者: Linus Torvalds

lis3: add power management functions

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.

[randy.dunlap@oracle.com: fix lis3-spi for CONFIG_PM=n]
Signed-off-by: NDaniel Mack <daniel@caiaq.de>
Acked-by: NPavel Machek <pavel@ucw.cz>
Cc: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 8873c334
...@@ -87,6 +87,32 @@ static int __devexit lis302dl_spi_remove(struct spi_device *spi) ...@@ -87,6 +87,32 @@ static int __devexit lis302dl_spi_remove(struct spi_device *spi)
return 0; 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 lis3lv02d_spi_suspend NULL
#define lis3lv02d_spi_resume NULL
#endif
static struct spi_driver lis302dl_spi_driver = { static struct spi_driver lis302dl_spi_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
...@@ -94,6 +120,8 @@ static struct spi_driver lis302dl_spi_driver = { ...@@ -94,6 +120,8 @@ static struct spi_driver lis302dl_spi_driver = {
}, },
.probe = lis302dl_spi_probe, .probe = lis302dl_spi_probe,
.remove = __devexit_p(lis302dl_spi_remove), .remove = __devexit_p(lis302dl_spi_remove),
.suspend = lis3lv02d_spi_suspend,
.resume = lis3lv02d_spi_resume,
}; };
static int __init lis302dl_init(void) static int __init lis302dl_init(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册