aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Roth <mroth@nessie.de>2009-05-18 19:04:44 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-05-19 22:24:54 -0400
commit86579a4cccf18a2ddbf7de8fc5a0f5d9b94ed76d (patch)
treeb41377e0d2802dcf58f0ced3e895532fc01a7cca
parent225c9886b9f873b219d1109148661b38da99a1ee (diff)
Input: ads7846 - support swapping x and y axes
Signed-off-by: Michael Roth <mroth@nessie.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/touchscreen/ads7846.c7
-rw-r--r--include/linux/spi/ads7846.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 2b01e56568f8..b5ad252f5cf1 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -97,6 +97,8 @@ struct ads7846 {
97 u16 x_plate_ohms; 97 u16 x_plate_ohms;
98 u16 pressure_max; 98 u16 pressure_max;
99 99
100 bool swap_xy;
101
100 struct ads7846_packet *packet; 102 struct ads7846_packet *packet;
101 103
102 struct spi_transfer xfer[18]; 104 struct spi_transfer xfer[18];
@@ -599,6 +601,10 @@ static void ads7846_rx(void *ads)
599 dev_dbg(&ts->spi->dev, "DOWN\n"); 601 dev_dbg(&ts->spi->dev, "DOWN\n");
600#endif 602#endif
601 } 603 }
604
605 if (ts->swap_xy)
606 swap(x, y);
607
602 input_report_abs(input, ABS_X, x); 608 input_report_abs(input, ABS_X, x);
603 input_report_abs(input, ABS_Y, y); 609 input_report_abs(input, ABS_Y, y);
604 input_report_abs(input, ABS_PRESSURE, Rt); 610 input_report_abs(input, ABS_PRESSURE, Rt);
@@ -917,6 +923,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
917 ts->spi = spi; 923 ts->spi = spi;
918 ts->input = input_dev; 924 ts->input = input_dev;
919 ts->vref_mv = pdata->vref_mv; 925 ts->vref_mv = pdata->vref_mv;
926 ts->swap_xy = pdata->swap_xy;
920 927
921 hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 928 hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
922 ts->timer.function = ads7846_timer; 929 ts->timer.function = ads7846_timer;
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 2ea20320c093..51948eb6927a 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -17,6 +17,7 @@ struct ads7846_platform_data {
17 u16 vref_mv; /* external vref value, milliVolts */ 17 u16 vref_mv; /* external vref value, milliVolts */
18 bool keep_vref_on; /* set to keep vref on for differential 18 bool keep_vref_on; /* set to keep vref on for differential
19 * measurements as well */ 19 * measurements as well */
20 bool swap_xy; /* swap x and y axes */
20 21
21 /* Settling time of the analog signals; a function of Vcc and the 22 /* Settling time of the analog signals; a function of Vcc and the
22 * capacitance on the X/Y drivers. If set to non-zero, two samples 23 * capacitance on the X/Y drivers. If set to non-zero, two samples