]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
input: ads7846: can't disable filtering
authorImre Deak <imre.deak@nokia.com>
Tue, 4 Jul 2006 08:38:08 +0000 (01:38 -0700)
committerTony Lindgren <tony@atomide.com>
Tue, 4 Jul 2006 08:38:08 +0000 (01:38 -0700)
When filtering is disabled the driver will ignore all samples and
never detect the pen up event.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
drivers/input/touchscreen/ads7846.c

index 436984532d486e31afdaf434581d1a98e6ac294d..4ec7875705206e33a9e0bb70e1a3f17293b8ad9c 100644 (file)
@@ -472,7 +472,8 @@ static void ads7846_debounce(void *ads)
        m = &ts->msg[ts->msg_idx];
        t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
        val = (be16_to_cpu(*(__be16 *)t->rx_buf) >> 3) & 0x0fff;
-       if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) {
+       if (ts->debounce_max && (
+           !ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol))) {
                /* Repeat it, if this was the first read or the read
                 * wasn't consistent enough. */
                if (ts->read_cnt < ts->debounce_max) {
@@ -702,14 +703,9 @@ static int __devinit ads7846_probe(struct spi_device *spi)
        ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
        ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
        ts->pressure_max = pdata->pressure_max ? : ~0;
-       if (pdata->debounce_max) {
-               ts->debounce_max = pdata->debounce_max;
-               ts->debounce_tol = pdata->debounce_tol;
-               ts->debounce_rep = pdata->debounce_rep;
-               if (ts->debounce_rep > ts->debounce_max + 1)
-                       ts->debounce_rep = ts->debounce_max - 1;
-       } else
-               ts->debounce_tol = ~0;
+       ts->debounce_max = pdata->debounce_max;
+       ts->debounce_tol = pdata->debounce_tol;
+       ts->debounce_rep = pdata->debounce_rep;
        ts->get_pendown_state = pdata->get_pendown_state;
 
        snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id);