]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions
authorKristina Martšenko <kristina.martsenko@gmail.com>
Sun, 25 Jan 2015 16:28:21 +0000 (18:28 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Sat, 14 Mar 2015 19:37:20 +0000 (15:37 -0400)
commit9f074c6a2d50b9717d4aea50f7cdad87133dac5b
treeee2f236089ef8403852ff4abdc26f2b894b55c65
parent1322dc3bad902aa868071900edf8f217cb834d2b
iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions

commit 6abe0300a1d5242f4ff89257197f284679af1a06 upstream.

Reading a channel through sysfs, or starting a buffered capture, can
occasionally turn off the touchscreen.

This is because the read_raw() and buffer preenable()/postdisable()
callbacks unschedule current conversions on all channels. If a delay
channel happens to schedule a touchscreen conversion at the same time,
the conversion gets cancelled and the touchscreen sequence stops.

This is probably related to this note from the reference manual:

"If a delay group schedules channels to be sampled and a manual
write to the schedule field in CTRL0 occurs while the block is
discarding samples, the LRADC will switch to the new schedule
and will not sample the channels that were previously scheduled.
The time window for this to happen is very small and lasts only
while the LRADC is discarding samples."

So make the callbacks only unschedule conversions for the channels they
use. This means channel 0 for read_raw() and channels 0-5 for the buffer
(if the touchscreen is enabled). Since the touchscreen uses different
channels (6 and 7), it no longer gets turned off.

This is tested and fixes the issue on i.MX28, but hasn't been tested on
i.MX23.

Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/staging/iio/adc/mxs-lradc.c