input: ti_am335x_adc: use only FIFO0 and clean up a little
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 29 May 2013 12:46:21 +0000 (14:46 +0200)
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 12 Jun 2013 16:50:22 +0000 (18:50 +0200)
commit8c896308feae7fb2e8da4ae4c09fe2d2ca18ad7b
treeed20601fe5b29721cb70717b62b099521ccc48b2
parent9f99928fe0a03dd2ba5894b7bb942cc50b5d7c5e
input: ti_am335x_adc: use only FIFO0 and clean up a little

The driver programs a threshold of "coordinate_readouts" say 5. The
REG_FIFO0THR registers says it should it be programmed to "threshold
minus one". The driver does not expect just 5 coordinates but 5 * 2 + 2.
Multiplied by two because 5 for X and 5 for Y and plus 2 because we have
two Z.
The whole thing kind of works because It reads the 5 coordinates for X
and Y from FIFO0 and FIFO1 and the last element in each FIFO is ignored
within the loop and read later.
Nothing guaranties that FIFO1 is ready by the time it is read. In fact I
could see that that FIFO1 reaturns for Y channels 8,9, 10, 12, 6 and for
Y channel 7 for Z. The problem is that channel 7 and channel 12 got
somehow mixed up.
The other Problem is that FIFO1 is also used by the IIO part leading to
wrong results if both (tsc & adc) are used.

The patch tries to clean up the whole thing a little:
- Remove the +1 and -1 in REG_STEPCONFIG, REG_STEPDELAY and its counter
  part in the for loop. This is just confusing.

- Use only FIFO0 in TSC. The fifo has space for 64 entries so should be
  fine.

- Read the whole FIFO in one function and check the channel.

- in case we dawdle around, make sure we only read a multiple of our
  coordinate set. On the second interrupt we will cleanup the remaining
  enties.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
drivers/iio/adc/ti_am335x_adc.c
drivers/input/touchscreen/ti_am335x_tsc.c
include/linux/mfd/ti_am335x_tscadc.h
This page took 0.035568 seconds and 5 git commands to generate.