]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/input/touchscreen/ads7846.c
Input: touchscreens - switch to using input_dev->dev.parent
[linux-2.6-omap-h63xx.git] / drivers / input / touchscreen / ads7846.c
index cd251efda41062cb6705f0cc6e5ba06af9ceafaf..693e3b2a65a35e0a8c4c6f20ee93fa0018b6fa47 100644 (file)
@@ -39,7 +39,8 @@
 /*
  * This code has been heavily tested on a Nokia 770, and lightly
  * tested on other ads7846 devices (OSK/Mistral, Lubbock).
- * Support for ads7843 and ads7845 has only been stubbed in.
+ * Support for ads7843 tested on Atmel at91sam926x-EK.
+ * Support for ads7845 has only been stubbed in.
  *
  * IRQ handling needs a workaround because of a shortcoming in handling
  * edge triggered IRQs on some platforms like the OMAP1/2. These
@@ -246,18 +247,16 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
 
        /* REVISIT:  take a few more samples, and compare ... */
 
-       /* maybe off internal vREF */
-       if (use_internal) {
-               req->ref_off = REF_OFF;
-               req->xfer[4].tx_buf = &req->ref_off;
-               req->xfer[4].len = 1;
-               spi_message_add_tail(&req->xfer[4], &req->msg);
-
-               req->xfer[5].rx_buf = &req->scratch;
-               req->xfer[5].len = 2;
-               CS_CHANGE(req->xfer[5]);
-               spi_message_add_tail(&req->xfer[5], &req->msg);
-       }
+       /* converter in low power mode & enable PENIRQ */
+       req->ref_off = PWRDOWN;
+       req->xfer[4].tx_buf = &req->ref_off;
+       req->xfer[4].len = 1;
+       spi_message_add_tail(&req->xfer[4], &req->msg);
+
+       req->xfer[5].rx_buf = &req->scratch;
+       req->xfer[5].len = 2;
+       CS_CHANGE(req->xfer[5]);
+       spi_message_add_tail(&req->xfer[5], &req->msg);
 
        ts->irq_disabled = 1;
        disable_irq(spi->irq);
@@ -536,6 +535,9 @@ static void ads7846_rx(void *ads)
        } else
                Rt = 0;
 
+       if (ts->model == 7843)
+               Rt = ts->pressure_max / 2;
+
        /* Sample found inconsistent by debouncing or pressure is beyond
         * the maximum. Don't report it to user space, repeat at least
         * once more the measurement
@@ -546,7 +548,7 @@ static void ads7846_rx(void *ads)
                        ts->spi->dev.bus_id, ts->tc.ignore, Rt);
 #endif
                hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD),
-                             HRTIMER_REL);
+                             HRTIMER_MODE_REL);
                return;
        }
 
@@ -578,7 +580,8 @@ static void ads7846_rx(void *ads)
 #endif
        }
 
-       hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), HRTIMER_REL);
+       hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD),
+                       HRTIMER_MODE_REL);
 }
 
 static int ads7846_debounce(void *ads, int data_idx, int *val)
@@ -667,7 +670,7 @@ static void ads7846_rx_val(void *ads)
                                status);
 }
 
-static int ads7846_timer(struct hrtimer *handle)
+static enum hrtimer_restart ads7846_timer(struct hrtimer *handle)
 {
        struct ads7846  *ts = container_of(handle, struct ads7846, timer);
        int             status = 0;
@@ -724,7 +727,7 @@ static irqreturn_t ads7846_irq(int irq, void *handle)
                        disable_irq(ts->spi->irq);
                        ts->pending = 1;
                        hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY),
-                                       HRTIMER_REL);
+                                       HRTIMER_MODE_REL);
                }
        }
        spin_unlock_irqrestore(&ts->lock, flags);
@@ -862,7 +865,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
        ts->spi = spi;
        ts->input = input_dev;
 
-       hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_REL);
+       hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        ts->timer.function = ads7846_timer;
 
        spin_lock_init(&ts->lock);
@@ -896,7 +899,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
 
        input_dev->name = "ADS784x Touchscreen";
        input_dev->phys = ts->phys;
-       input_dev->cdev.dev = &spi->dev;
+       input_dev->dev.parent = &spi->dev;
 
        input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
        input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);