linux/drivers/iio/adc
Vignesh R 81e3951541 iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access
commit 90c43ec699 upstream.

It is possible that two or more ADC channels can be simultaneously
requested for raw samples, in which case there can be race in access to
FIFO data resulting in loss of samples.
If am335x_tsc_se_set_once() is called again from tiadc_read_raw(), when
ADC is still acquired to sample one of the channels, the second process
might be put into uninterruptible sleep state. Fix these issues, by
protecting FIFO access and channel configurations with a mutex. Since
tiadc_read_raw() might take anywhere between few microseconds to few
milliseconds to finish execution (depending on averaging and delay
values supplied via DT), its better to use mutex instead of spinlock.

Fixes: 7ca6740cd1 ("mfd: input: iio: ti_amm335x: Rework TSC/ADC synchronization")
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2016-11-20 01:17:15 +00:00
..
ad799x.c iio:adc:ad799x: Fix reading and writing of event values, apply shift 2014-06-21 10:43:13 +01:00
ad7266.c iio:ad7266: Fix probe deferral for vref 2016-08-22 22:38:21 +01:00
ad7298.c iio:ad7298: Use iio_push_to_buffers_with_timestamp() 2013-09-21 19:23:52 +01:00
ad7476.c iio:ad7476: Report scale as fractional value 2013-10-01 16:19:12 +01:00
ad7791.c iio:ad7791: Report scale as fractional value 2013-10-01 16:19:12 +01:00
ad7793.c iio:ad7793: Fix ad7785 product ID 2015-12-14 10:17:07 +00:00
ad7887.c iio:adc:ad7887 Fix channel reported endianness from cpu to big endian 2013-12-17 20:37:14 +00:00
ad7923.c iio:ad7923: Use iio_push_to_buffers_with_timestamp() 2013-09-21 19:23:53 +01:00
ad_sigma_delta.c iio: adc: ad_sigma_delta: Fix indio_dev->trig assignment 2014-10-05 13:41:04 -07:00
at91_adc.c iio: adc: at91: unbreak channel adc channel 3 2016-11-20 01:17:11 +00:00
exynos_adc.c Merge 3.15-rc6 into staging-next. 2014-05-22 23:27:17 +09:00
Kconfig iio: add HAS_IOMEM dependency to VF610_ADC 2016-02-25 00:18:34 +00:00
lp8788_adc.c iio: adc: lp8788_adc: Use devm_* APIs 2013-08-03 18:40:40 +01:00
Makefile First round of IIO new driver, functionality and cleanups for the 3.16 cycle. 2014-04-26 08:12:25 -07:00
max1363.c iio:adc:max1363 incorrect resolutions for max11604, max11605, max11610 and max11611. 2014-05-25 12:06:25 +01:00
mcp320x.c iio: adc: mcp320x: Use devm_* APIs 2013-08-03 18:40:41 +01:00
mcp3422.c iio:adc:mcp3422 Fix incorrect scales table 2015-03-18 14:41:47 +00:00
men_z188_adc.c iio: adc: men_z188_adc: Add terminating entry for men_z188_ids 2014-12-04 14:36:31 +00:00
nau7802.c tree-wide: use reinit_completion instead of INIT_COMPLETION 2013-11-15 09:32:21 +09:00
ti-adc081c.c iio: adc: ti-adc081c: Include linux/of.h header 2013-10-18 20:05:56 +01:00
ti_am335x_adc.c iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access 2016-11-20 01:17:15 +00:00
twl4030-madc.c iio: twl4030-madc: Pass the IRQF_ONESHOT flag 2015-08-10 09:54:05 +01:00
twl6030-gpadc.c iio: adc: twl6030-gpadc: Fix modalias 2015-06-11 11:24:57 +01:00
vf610_adc.c iio: adc: vf610: fix the adc register read fail issue 2015-08-11 09:57:35 +01:00
viperboard_adc.c iio: adc: viperboard: Drop platform_set_drvdata call 2014-02-03 19:27:59 +00:00
xilinx-xadc-core.c iio: adc: xilinx: Fix VREFN scale 2015-12-14 10:17:08 +00:00
xilinx-xadc-events.c iio:adc: Add Xilinx XADC driver 2014-03-01 21:04:29 +00:00
xilinx-xadc.h iio: adc: xilinx: Fix register addresses 2015-05-28 09:59:57 +01:00