]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
tsc2301 - Move SPI data buffer to GFP_KERNEL memory
authorKlaus Pedersen <klaus.k.pedersen@nokia.com>
Fri, 15 Feb 2008 21:31:45 +0000 (23:31 +0200)
committerTony Lindgren <tony@atomide.com>
Thu, 21 Feb 2008 00:20:41 +0000 (16:20 -0800)
Because the dma_map_single() on ARM only flushes and invalidates
the cache-lines occupied by the transfer buffer, care should be
taken not to touch memory that share the same cache-lines before
starting the DMA transfer.

Signed-off-by: Klaus Pedersen <klaus.k.pedersen@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/input/touchscreen/tsc2301_ts.c

index ad8603c28e864f925f57ff82bf1fd5187f26aae6..6462cc2bf398447e67f60d821401fc85dd025ef8 100644 (file)
@@ -111,6 +111,13 @@ struct ts_filter {
        int                     avg_z2;
 };
 
+struct ts_coords {
+       u16                     x;
+       u16                     y;
+       u16                     z1;
+       u16                     z2;
+};
+
 struct tsc2301_ts {
        struct input_dev        *idev;
        char                    phys[32];
@@ -119,7 +126,7 @@ struct tsc2301_ts {
 
        struct spi_transfer     read_xfer[2];
        struct spi_message      read_msg;
-       u16                     data[4];
+       struct ts_coords        *coords;
 
        struct ts_filter        filter;
 
@@ -371,10 +378,10 @@ static void tsc2301_ts_rx(void *arg)
        int send_event;
        int x, y, z1, z2;
 
-       x  = ts->data[0];
-       y  = ts->data[1];
-       z1 = ts->data[2];
-       z2 = ts->data[3];
+       x  = ts->coords->x;
+       y  = ts->coords->y;
+       z1 = ts->coords->z1;
+       z2 = ts->coords->z2;
 
        send_event = filter(ts, x, y, z1, z2);
        if (send_event) {
@@ -484,7 +491,7 @@ static void tsc2301_ts_setup_spi_xfer(struct tsc2301 *tsc)
        spi_message_add_tail(x, m);
 
        x++;
-       x->rx_buf = &ts->data;
+       x->rx_buf = ts->coords;
        x->len = 8;
        spi_message_add_tail(x, m);
 
@@ -558,6 +565,12 @@ int __devinit tsc2301_ts_init(struct tsc2301 *tsc,
                return -ENOMEM;
        tsc->ts = ts;
 
+       ts->coords = kzalloc(sizeof(*ts->coords), GFP_KERNEL);
+       if (ts->coords == NULL) {
+               kfree(ts);
+               return -ENOMEM;
+       }
+
        ts->irq = pdata->dav_int;
 
        init_timer(&ts->penup_timer);
@@ -639,6 +652,7 @@ err3:
        tsc2301_ts_stop_scan(tsc);
        input_free_device(idev);
 err2:
+       kfree(ts->coords);
        kfree(ts);
        return r;
 }
@@ -655,6 +669,7 @@ void __devexit tsc2301_ts_exit(struct tsc2301 *tsc)
        free_irq(ts->irq, tsc);
        input_unregister_device(ts->idev);
 
+       kfree(ts->coords);
        kfree(ts);
 }
 MODULE_AUTHOR("Jarkko Oikarinen <jarkko.oikarinen@nokia.com>");