Skip to content

Commit

Permalink
Input: ads7846 - add wakeup support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ranjith Lohithakshan authored and Dmitry Torokhov committed Mar 11, 2010
1 parent 04b4b88 commit fdba2bb
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/input/touchscreen/ads7846.c
Original file line number Diff line number Diff line change
@@ -822,6 +822,9 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message)

spin_unlock_irq(&ts->lock);

if (device_may_wakeup(&ts->spi->dev))
enable_irq_wake(ts->spi->irq);

return 0;

}
@@ -830,6 +833,9 @@ static int ads7846_resume(struct spi_device *spi)
{
struct ads7846 *ts = dev_get_drvdata(&spi->dev);

if (device_may_wakeup(&ts->spi->dev))
disable_irq_wake(ts->spi->irq);

spin_lock_irq(&ts->lock);

ts->is_suspended = 0;
@@ -1201,6 +1207,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
if (err)
goto err_remove_attr_group;

device_init_wakeup(&spi->dev, pdata->wakeup);

return 0;

err_remove_attr_group:
@@ -1230,6 +1238,8 @@ static int __devexit ads7846_remove(struct spi_device *spi)
{
struct ads7846 *ts = dev_get_drvdata(&spi->dev);

device_init_wakeup(&spi->dev, false);

ads784x_hwmon_unregister(spi, ts);
input_unregister_device(ts->input);

1 change: 1 addition & 0 deletions include/linux/spi/ads7846.h
Original file line number Diff line number Diff line change
@@ -53,5 +53,6 @@ struct ads7846_platform_data {
int (*filter) (void *filter_data, int data_idx, int *val);
void (*filter_cleanup)(void *filter_data);
void (*wait_for_sync)(void);
bool wakeup;
};

0 comments on commit fdba2bb

Please sign in to comment.