- mod_timer(&ts->timer, jiffies + TS_POLL_PERIOD);
-
- spin_unlock_irqrestore(&ts->lock, flags);
-}
-
-static void ads7846_debounce(void *ads)
-{
- struct ads7846 *ts = ads;
- struct spi_message *m;
- struct spi_transfer *t;
- int val;
- int status;
-
- 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)) {
- /* Repeat it, if this was the first read or the read
- * wasn't consistent enough. */
- if (ts->read_cnt < ts->debounce_max) {
- ts->last_read = val;
- ts->read_cnt++;
- } else {
- /* Maximum number of debouncing reached and still
- * not enough number of consistent readings. Abort
- * the whole sample, repeat it in the next sampling
- * period.
- */
- ts->tc.ignore = 1;
- ts->read_cnt = 0;
- /* Last message will contain ads7846_rx() as the
- * completion function.
- */
- m = ts->last_msg;
- }
- /* Start over collecting consistent readings. */
- ts->read_rep = 0;
- } else {
- if (++ts->read_rep > ts->debounce_rep) {
- /* Got a good reading for this coordinate,
- * go for the next one. */
- ts->tc.ignore = 0;
- ts->msg_idx++;
- ts->read_cnt = 0;
- ts->read_rep = 0;
- m++;
- } else
- /* Read more values that are consistent. */
- ts->read_cnt++;
- }
- status = spi_async(ts->spi, m);
- if (status)
- dev_err(&ts->spi->dev, "spi_async --> %d\n",
- status);
-}
-
-static void ads7846_timer(unsigned long handle)
-{
- struct ads7846 *ts = (void *)handle;
- int status = 0;
-
- spin_lock_irq(&ts->lock);