aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/ad7879-spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/ad7879-spi.c')
-rw-r--r--drivers/input/touchscreen/ad7879-spi.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c
index 59c6e68c4325..ddf732f3cafc 100644
--- a/drivers/input/touchscreen/ad7879-spi.c
+++ b/drivers/input/touchscreen/ad7879-spi.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/input.h> /* BUS_SPI */ 9#include <linux/input.h> /* BUS_SPI */
10#include <linux/pm.h>
10#include <linux/spi/spi.h> 11#include <linux/spi/spi.h>
11 12
12#include "ad7879.h" 13#include "ad7879.h"
@@ -20,9 +21,10 @@
20#define AD7879_WRITECMD(reg) (AD7879_CMD(reg)) 21#define AD7879_WRITECMD(reg) (AD7879_CMD(reg))
21#define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ) 22#define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ)
22 23
23#ifdef CONFIG_PM 24#ifdef CONFIG_PM_SLEEP
24static int ad7879_spi_suspend(struct spi_device *spi, pm_message_t message) 25static int ad7879_spi_suspend(struct device *dev)
25{ 26{
27 struct spi_device *spi = to_spi_device(dev);
26 struct ad7879 *ts = spi_get_drvdata(spi); 28 struct ad7879 *ts = spi_get_drvdata(spi);
27 29
28 ad7879_suspend(ts); 30 ad7879_suspend(ts);
@@ -30,19 +32,19 @@ static int ad7879_spi_suspend(struct spi_device *spi, pm_message_t message)
30 return 0; 32 return 0;
31} 33}
32 34
33static int ad7879_spi_resume(struct spi_device *spi) 35static int ad7879_spi_resume(struct device *dev)
34{ 36{
37 struct spi_device *spi = to_spi_device(dev);
35 struct ad7879 *ts = spi_get_drvdata(spi); 38 struct ad7879 *ts = spi_get_drvdata(spi);
36 39
37 ad7879_resume(ts); 40 ad7879_resume(ts);
38 41
39 return 0; 42 return 0;
40} 43}
41#else
42# define ad7879_spi_suspend NULL
43# define ad7879_spi_resume NULL
44#endif 44#endif
45 45
46static SIMPLE_DEV_PM_OPS(ad7879_spi_pm, ad7879_spi_suspend, ad7879_spi_resume);
47
46/* 48/*
47 * ad7879_read/write are only used for initial setup and for sysfs controls. 49 * ad7879_read/write are only used for initial setup and for sysfs controls.
48 * The main traffic is done in ad7879_collect(). 50 * The main traffic is done in ad7879_collect().
@@ -173,11 +175,10 @@ static struct spi_driver ad7879_spi_driver = {
173 .name = "ad7879", 175 .name = "ad7879",
174 .bus = &spi_bus_type, 176 .bus = &spi_bus_type,
175 .owner = THIS_MODULE, 177 .owner = THIS_MODULE,
178 .pm = &ad7879_spi_pm,
176 }, 179 },
177 .probe = ad7879_spi_probe, 180 .probe = ad7879_spi_probe,
178 .remove = __devexit_p(ad7879_spi_remove), 181 .remove = __devexit_p(ad7879_spi_remove),
179 .suspend = ad7879_spi_suspend,
180 .resume = ad7879_spi_resume,
181}; 182};
182 183
183static int __init ad7879_spi_init(void) 184static int __init ad7879_spi_init(void)