diff options
-rw-r--r-- | 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 3827ff04485f..2bc84930a428 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) | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | #ifdef CONFIG_PM | ||
91 | static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg) | ||
92 | { | ||
93 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | ||
94 | |||
95 | if (!lis3->pdata->wakeup_flags) | ||
96 | lis3lv02d_poweroff(&lis3_dev); | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int lis3lv02d_spi_resume(struct spi_device *spi) | ||
102 | { | ||
103 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | ||
104 | |||
105 | if (!lis3->pdata->wakeup_flags) | ||
106 | lis3lv02d_poweron(lis3); | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | #else | ||
112 | #define lis3lv02d_spi_suspend NULL | ||
113 | #define lis3lv02d_spi_resume NULL | ||
114 | #endif | ||
115 | |||
90 | static struct spi_driver lis302dl_spi_driver = { | 116 | static struct spi_driver lis302dl_spi_driver = { |
91 | .driver = { | 117 | .driver = { |
92 | .name = DRV_NAME, | 118 | .name = DRV_NAME, |
@@ -94,6 +120,8 @@ static struct spi_driver lis302dl_spi_driver = { | |||
94 | }, | 120 | }, |
95 | .probe = lis302dl_spi_probe, | 121 | .probe = lis302dl_spi_probe, |
96 | .remove = __devexit_p(lis302dl_spi_remove), | 122 | .remove = __devexit_p(lis302dl_spi_remove), |
123 | .suspend = lis3lv02d_spi_suspend, | ||
124 | .resume = lis3lv02d_spi_resume, | ||
97 | }; | 125 | }; |
98 | 126 | ||
99 | static int __init lis302dl_init(void) | 127 | static int __init lis302dl_init(void) |