Skip to content

Commit

Permalink
Input: ad7879 - fix default x/y axis assignment
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
agners authored and dtor committed Mar 8, 2016
1 parent 4774f40 commit 5f2940c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/input/touchscreen/ad7879.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
#define AD7879_TEMP_BIT (1<<1)

enum {
AD7879_SEQ_XPOS = 0,
AD7879_SEQ_YPOS = 1,
AD7879_SEQ_YPOS = 0,
AD7879_SEQ_XPOS = 1,
AD7879_SEQ_Z1 = 2,
AD7879_SEQ_Z2 = 3,
AD7879_NR_SENSE = 4,
Expand Down Expand Up @@ -517,7 +517,9 @@ 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;

/* Use swapped axis by default (backward compatibility) */
ts->swap_xy = !pdata->swap_xy;

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

Expand Down

0 comments on commit 5f2940c

Please sign in to comment.