aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/ads7846.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r--drivers/input/touchscreen/ads7846.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 056ac77e2cf0..2b01e56568f8 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -127,6 +127,8 @@ struct ads7846 {
127 void (*filter_cleanup)(void *data); 127 void (*filter_cleanup)(void *data);
128 int (*get_pendown_state)(void); 128 int (*get_pendown_state)(void);
129 int gpio_pendown; 129 int gpio_pendown;
130
131 void (*wait_for_sync)(void);
130}; 132};
131 133
132/* leave chip selected when we're done, for quicker re-select? */ 134/* leave chip selected when we're done, for quicker re-select? */
@@ -511,6 +513,10 @@ static int get_pendown_state(struct ads7846 *ts)
511 return !gpio_get_value(ts->gpio_pendown); 513 return !gpio_get_value(ts->gpio_pendown);
512} 514}
513 515
516static void null_wait_for_sync(void)
517{
518}
519
514/* 520/*
515 * PENIRQ only kicks the timer. The timer only reissues the SPI transfer, 521 * PENIRQ only kicks the timer. The timer only reissues the SPI transfer,
516 * to retrieve touchscreen status. 522 * to retrieve touchscreen status.
@@ -686,6 +692,7 @@ static void ads7846_rx_val(void *ads)
686 default: 692 default:
687 BUG(); 693 BUG();
688 } 694 }
695 ts->wait_for_sync();
689 status = spi_async(ts->spi, m); 696 status = spi_async(ts->spi, m);
690 if (status) 697 if (status)
691 dev_err(&ts->spi->dev, "spi_async --> %d\n", 698 dev_err(&ts->spi->dev, "spi_async --> %d\n",
@@ -723,6 +730,7 @@ static enum hrtimer_restart ads7846_timer(struct hrtimer *handle)
723 } else { 730 } else {
724 /* pen is still down, continue with the measurement */ 731 /* pen is still down, continue with the measurement */
725 ts->msg_idx = 0; 732 ts->msg_idx = 0;
733 ts->wait_for_sync();
726 status = spi_async(ts->spi, &ts->msg[0]); 734 status = spi_async(ts->spi, &ts->msg[0]);
727 if (status) 735 if (status)
728 dev_err(&ts->spi->dev, "spi_async --> %d\n", status); 736 dev_err(&ts->spi->dev, "spi_async --> %d\n", status);
@@ -746,7 +754,7 @@ static irqreturn_t ads7846_irq(int irq, void *handle)
746 * that here. (The "generic irq" framework may help...) 754 * that here. (The "generic irq" framework may help...)
747 */ 755 */
748 ts->irq_disabled = 1; 756 ts->irq_disabled = 1;
749 disable_irq(ts->spi->irq); 757 disable_irq_nosync(ts->spi->irq);
750 ts->pending = 1; 758 ts->pending = 1;
751 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY), 759 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY),
752 HRTIMER_MODE_REL); 760 HRTIMER_MODE_REL);
@@ -947,6 +955,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
947 ts->penirq_recheck_delay_usecs = 955 ts->penirq_recheck_delay_usecs =
948 pdata->penirq_recheck_delay_usecs; 956 pdata->penirq_recheck_delay_usecs;
949 957
958 ts->wait_for_sync = pdata->wait_for_sync ? : null_wait_for_sync;
959
950 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev)); 960 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
951 961
952 input_dev->name = "ADS784x Touchscreen"; 962 input_dev->name = "ADS784x Touchscreen";