aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-10-15 23:29:12 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-10-15 23:29:12 -0400
commit4c0e799a9a6dc64426ddb6c03aea1a154357658f (patch)
tree2d9aa9493d80fceb178a63bf15bb3d9edfc5fbae /drivers/input/touchscreen
parent3fa8749e584b55f1180411ab1b51117190bac1e5 (diff)
parentb8d055a878ee0f997ded40649701089d2486f850 (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/ads7846.c162
-rw-r--r--drivers/input/touchscreen/atmel_tsadcc.c37
-rw-r--r--drivers/input/touchscreen/mainstone-wm97xx.c5
-rw-r--r--drivers/input/touchscreen/wm9705.c5
-rw-r--r--drivers/input/touchscreen/wm9712.c5
-rw-r--r--drivers/input/touchscreen/wm9713.c5
-rw-r--r--drivers/input/touchscreen/wm97xx-core.c5
7 files changed, 143 insertions, 81 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index ce6f48c695f5..b9b7fc6ff1eb 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -24,6 +24,7 @@
24#include <linux/input.h> 24#include <linux/input.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/gpio.h>
27#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h> 29#include <linux/spi/ads7846.h>
29#include <asm/irq.h> 30#include <asm/irq.h>
@@ -68,6 +69,17 @@ struct ts_event {
68 int ignore; 69 int ignore;
69}; 70};
70 71
72/*
73 * We allocate this separately to avoid cache line sharing issues when
74 * driver is used with DMA-based SPI controllers (like atmel_spi) on
75 * systems where main memory is not DMA-coherent (most non-x86 boards).
76 */
77struct ads7846_packet {
78 u8 read_x, read_y, read_z1, read_z2, pwrdown;
79 u16 dummy; /* for the pwrdown read */
80 struct ts_event tc;
81};
82
71struct ads7846 { 83struct ads7846 {
72 struct input_dev *input; 84 struct input_dev *input;
73 char phys[32]; 85 char phys[32];
@@ -85,9 +97,7 @@ struct ads7846 {
85 u16 x_plate_ohms; 97 u16 x_plate_ohms;
86 u16 pressure_max; 98 u16 pressure_max;
87 99
88 u8 read_x, read_y, read_z1, read_z2, pwrdown; 100 struct ads7846_packet *packet;
89 u16 dummy; /* for the pwrdown read */
90 struct ts_event tc;
91 101
92 struct spi_transfer xfer[18]; 102 struct spi_transfer xfer[18];
93 struct spi_message msg[5]; 103 struct spi_message msg[5];
@@ -116,6 +126,7 @@ struct ads7846 {
116 void *filter_data; 126 void *filter_data;
117 void (*filter_cleanup)(void *data); 127 void (*filter_cleanup)(void *data);
118 int (*get_pendown_state)(void); 128 int (*get_pendown_state)(void);
129 int gpio_pendown;
119}; 130};
120 131
121/* leave chip selected when we're done, for quicker re-select? */ 132/* leave chip selected when we're done, for quicker re-select? */
@@ -461,10 +472,11 @@ static ssize_t ads7846_disable_store(struct device *dev,
461 const char *buf, size_t count) 472 const char *buf, size_t count)
462{ 473{
463 struct ads7846 *ts = dev_get_drvdata(dev); 474 struct ads7846 *ts = dev_get_drvdata(dev);
464 char *endp; 475 long i;
465 int i; 476
477 if (strict_strtoul(buf, 10, &i))
478 return -EINVAL;
466 479
467 i = simple_strtoul(buf, &endp, 10);
468 spin_lock_irq(&ts->lock); 480 spin_lock_irq(&ts->lock);
469 481
470 if (i) 482 if (i)
@@ -491,6 +503,14 @@ static struct attribute_group ads784x_attr_group = {
491 503
492/*--------------------------------------------------------------------------*/ 504/*--------------------------------------------------------------------------*/
493 505
506static int get_pendown_state(struct ads7846 *ts)
507{
508 if (ts->get_pendown_state)
509 return ts->get_pendown_state();
510
511 return !gpio_get_value(ts->gpio_pendown);
512}
513
494/* 514/*
495 * PENIRQ only kicks the timer. The timer only reissues the SPI transfer, 515 * PENIRQ only kicks the timer. The timer only reissues the SPI transfer,
496 * to retrieve touchscreen status. 516 * to retrieve touchscreen status.
@@ -502,16 +522,17 @@ static struct attribute_group ads784x_attr_group = {
502static void ads7846_rx(void *ads) 522static void ads7846_rx(void *ads)
503{ 523{
504 struct ads7846 *ts = ads; 524 struct ads7846 *ts = ads;
525 struct ads7846_packet *packet = ts->packet;
505 unsigned Rt; 526 unsigned Rt;
506 u16 x, y, z1, z2; 527 u16 x, y, z1, z2;
507 528
508 /* ads7846_rx_val() did in-place conversion (including byteswap) from 529 /* ads7846_rx_val() did in-place conversion (including byteswap) from
509 * on-the-wire format as part of debouncing to get stable readings. 530 * on-the-wire format as part of debouncing to get stable readings.
510 */ 531 */
511 x = ts->tc.x; 532 x = packet->tc.x;
512 y = ts->tc.y; 533 y = packet->tc.y;
513 z1 = ts->tc.z1; 534 z1 = packet->tc.z1;
514 z2 = ts->tc.z2; 535 z2 = packet->tc.z2;
515 536
516 /* range filtering */ 537 /* range filtering */
517 if (x == MAX_12BIT) 538 if (x == MAX_12BIT)
@@ -535,10 +556,10 @@ static void ads7846_rx(void *ads)
535 * the maximum. Don't report it to user space, repeat at least 556 * the maximum. Don't report it to user space, repeat at least
536 * once more the measurement 557 * once more the measurement
537 */ 558 */
538 if (ts->tc.ignore || Rt > ts->pressure_max) { 559 if (packet->tc.ignore || Rt > ts->pressure_max) {
539#ifdef VERBOSE 560#ifdef VERBOSE
540 pr_debug("%s: ignored %d pressure %d\n", 561 pr_debug("%s: ignored %d pressure %d\n",
541 ts->spi->dev.bus_id, ts->tc.ignore, Rt); 562 ts->spi->dev.bus_id, packet->tc.ignore, Rt);
542#endif 563#endif
543 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), 564 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD),
544 HRTIMER_MODE_REL); 565 HRTIMER_MODE_REL);
@@ -550,7 +571,7 @@ static void ads7846_rx(void *ads)
550 */ 571 */
551 if (ts->penirq_recheck_delay_usecs) { 572 if (ts->penirq_recheck_delay_usecs) {
552 udelay(ts->penirq_recheck_delay_usecs); 573 udelay(ts->penirq_recheck_delay_usecs);
553 if (!ts->get_pendown_state()) 574 if (!get_pendown_state(ts))
554 Rt = 0; 575 Rt = 0;
555 } 576 }
556 577
@@ -631,6 +652,7 @@ static int ads7846_no_filter(void *ads, int data_idx, int *val)
631static void ads7846_rx_val(void *ads) 652static void ads7846_rx_val(void *ads)
632{ 653{
633 struct ads7846 *ts = ads; 654 struct ads7846 *ts = ads;
655 struct ads7846_packet *packet = ts->packet;
634 struct spi_message *m; 656 struct spi_message *m;
635 struct spi_transfer *t; 657 struct spi_transfer *t;
636 int val; 658 int val;
@@ -650,7 +672,7 @@ static void ads7846_rx_val(void *ads)
650 case ADS7846_FILTER_REPEAT: 672 case ADS7846_FILTER_REPEAT:
651 break; 673 break;
652 case ADS7846_FILTER_IGNORE: 674 case ADS7846_FILTER_IGNORE:
653 ts->tc.ignore = 1; 675 packet->tc.ignore = 1;
654 /* Last message will contain ads7846_rx() as the 676 /* Last message will contain ads7846_rx() as the
655 * completion function. 677 * completion function.
656 */ 678 */
@@ -658,7 +680,7 @@ static void ads7846_rx_val(void *ads)
658 break; 680 break;
659 case ADS7846_FILTER_OK: 681 case ADS7846_FILTER_OK:
660 *(u16 *)t->rx_buf = val; 682 *(u16 *)t->rx_buf = val;
661 ts->tc.ignore = 0; 683