diff options
author | Ranjith Lohithakshan <ranjithl@ti.com> | 2010-03-11 02:41:22 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-11 03:02:43 -0500 |
commit | fdba2bb1f2eed85085a0fe154e1acb82de3239f7 (patch) | |
tree | d2a8d754b81242e65b08162217303eafd1ccd770 | |
parent | 04b4b88cca0ebe3813b4b6f014fb6a0db380b137 (diff) |
Input: ads7846 - add wakeup support
Add wakeup support to the ads7846 driver. Platforms can enable wakeup
capability by setting the wakeup flag in ads7846_platform_data. With this
patch the ads7846 driver can be used to wake the system from suspend.
Signed-off-by: Ranjith Lohithakshan <ranjithl@ti.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 10 | ||||
-rw-r--r-- | include/linux/spi/ads7846.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index d187be05955f..532279cda0e4 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -822,6 +822,9 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message) | |||
822 | 822 | ||
823 | spin_unlock_irq(&ts->lock); | 823 | spin_unlock_irq(&ts->lock); |
824 | 824 | ||
825 | if (device_may_wakeup(&ts->spi->dev)) | ||
826 | enable_irq_wake(ts->spi->irq); | ||
827 | |||
825 | return 0; | 828 | return 0; |
826 | 829 | ||
827 | } | 830 | } |
@@ -830,6 +833,9 @@ static int ads7846_resume(struct spi_device *spi) | |||
830 | { | 833 | { |
831 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); | 834 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); |
832 | 835 | ||
836 | if (device_may_wakeup(&ts->spi->dev)) | ||
837 | disable_irq_wake(ts->spi->irq); | ||
838 | |||
833 | spin_lock_irq(&ts->lock); | 839 | spin_lock_irq(&ts->lock); |
834 | 840 | ||
835 | ts->is_suspended = 0; | 841 | ts->is_suspended = 0; |
@@ -1201,6 +1207,8 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
1201 | if (err) | 1207 | if (err) |
1202 | goto err_remove_attr_group; | 1208 | goto err_remove_attr_group; |
1203 | 1209 | ||
1210 | device_init_wakeup(&spi->dev, pdata->wakeup); | ||
1211 | |||
1204 | return 0; | 1212 | return 0; |
1205 | 1213 | ||
1206 | err_remove_attr_group: | 1214 | err_remove_attr_group: |
@@ -1230,6 +1238,8 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
1230 | { | 1238 | { |
1231 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); | 1239 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); |
1232 | 1240 | ||
1241 | device_init_wakeup(&spi->dev, false); | ||
1242 | |||
1233 | ads784x_hwmon_unregister(spi, ts); | 1243 | ads784x_hwmon_unregister(spi, ts); |
1234 | input_unregister_device(ts->input); | 1244 | input_unregister_device(ts->input); |
1235 | 1245 | ||
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index 5710c15d394a..b4ae570d3c98 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h | |||
@@ -53,5 +53,6 @@ struct ads7846_platform_data { | |||
53 | int (*filter) (void *filter_data, int data_idx, int *val); | 53 | int (*filter) (void *filter_data, int data_idx, int *val); |
54 | void (*filter_cleanup)(void *filter_data); | 54 | void (*filter_cleanup)(void *filter_data); |
55 | void (*wait_for_sync)(void); | 55 | void (*wait_for_sync)(void); |
56 | bool wakeup; | ||
56 | }; | 57 | }; |
57 | 58 | ||