summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2012-07-06 10:44:19 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-07-06 19:12:26 -0700
commit6680884a44207efe8ef6bc56b1c932cce2b89994 (patch)
treeaca3138305a44c4766e19c69d4da43fc16e810d4 /drivers/input/touchscreen
parentf2bb26b9b7652287719f08f080c09c2d7ddcf6b5 (diff)
downloadlinux-3.10-6680884a44207efe8ef6bc56b1c932cce2b89994.tar.gz
linux-3.10-6680884a44207efe8ef6bc56b1c932cce2b89994.tar.bz2
linux-3.10-6680884a44207efe8ef6bc56b1c932cce2b89994.zip
Input: ad7879 - add option to correct xy axis
Sebastian Zenker reported that driver swaps x and y samples when the touchscreen leads are connected in accordance with the datasheet specification. Transposed axis can be typically corrected by touch screen calibration however this bug also negatively influences touch pressure measurements. Add an option to correct x and y axis. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Reported-and-tested-by: Sebastian Zenker <sebastian.zenker@gmx.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/ad7879.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index e2482b40da5..e6070926195 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -118,6 +118,7 @@ struct ad7879 {
unsigned int irq;
bool disabled; /* P: input->mutex */
bool suspended; /* P: input->mutex */
+ bool swap_xy;
u16 conversion_data[AD7879_NR_SENSE];
char phys[32];
u8 first_conversion_delay;
@@ -161,6 +162,9 @@ static int ad7879_report(struct ad7879 *ts)
z1 = ts->conversion_data[AD7879_SEQ_Z1] & MAX_12BIT;
z2 = ts->conversion_data[AD7879_SEQ_Z2] & MAX_12BIT;
+ if (ts->swap_xy)
+ swap(x, y);
+
/*
* The samples processed here are already preprocessed by the AD7879.
* The preprocessing function consists of a median and an averaging
@@ -520,6 +524,7 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq,
ts->dev = dev;
ts->input = input_dev;
ts->irq = irq;
+ ts->swap_xy = pdata->swap_xy;
setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts);