Skip to content

Commit 5f2940c

Browse files
agnersdtor
authored andcommitted
Input: ad7879 - fix default x/y axis assignment
The X/Y position measurements read from the controller are interpreted wrong. The first measurement X+ contains the Y position, and the second measurement Y+ the X position (see also Table 11 Register Table in the data sheet). The problem is already known and a swap option has been introduced: commit 6680884 ("Input: ad7879 - add option to correct xy axis") However, the meaning of the new boolean is inverted since the underlying values are already swapped. Let ts->swap_xy set to true actually be the swapped configuration of the two axis. Signed-off-by: Stefan Agner <[email protected]> Acked-by: Michael Hennerich <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 4774f40 commit 5f2940c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/input/touchscreen/ad7879.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
#define AD7879_TEMP_BIT (1<<1)
9595

9696
enum {
97-
AD7879_SEQ_XPOS = 0,
98-
AD7879_SEQ_YPOS = 1,
97+
AD7879_SEQ_YPOS = 0,
98+
AD7879_SEQ_XPOS = 1,
9999
AD7879_SEQ_Z1 = 2,
100100
AD7879_SEQ_Z2 = 3,
101101
AD7879_NR_SENSE = 4,
@@ -517,7 +517,9 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq,
517517
ts->dev = dev;
518518
ts->input = input_dev;
519519
ts->irq = irq;
520-
ts->swap_xy = pdata->swap_xy;
520+
521+
/* Use swapped axis by default (backward compatibility) */
522+
ts->swap_xy = !pdata->swap_xy;
521523

522524
setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts);
523525

0 commit comments

Comments
 (0)