iio: adc: ti_am335x_adc: Wait the idle state to avoid stalls
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 15 Oct 2021 08:14:56 +0000 (10:14 +0200)
committerLee Jones <lee.jones@linaro.org>
Thu, 21 Oct 2021 08:23:54 +0000 (09:23 +0100)
commit8bed0166c65bcb51bc4d14790d968dabe24b9723
tree66b54b06bdd995d9891e7b9d46fbdc095ab991e4
parent90fc6ff48be44ece2cb9b0012074bd0e642f48bc
iio: adc: ti_am335x_adc: Wait the idle state to avoid stalls

At least on a am4372, a simple:
$ cat /sys/bus/iio/devices/iio\:deviceX/in_voltage*_raw
can stall forever. It seems that it comes from the fact that the
internal state machine does not have enough time to return to its idle
state in this situation before receiving another request, leading to an
internal stall.

Add a tiadc_wait_idle() helper to ensure no new conversion is requested
while the FSM is still busy.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211015081506.933180-39-miquel.raynal@bootlin.com
drivers/iio/adc/ti_am335x_adc.c