]> git.baikalelectronics.ru Git - kernel.git/commit
iio: xilinx-xadc: Make sure not exceed maximum samplerate
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 3 Apr 2020 13:27:16 +0000 (15:27 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Apr 2020 16:50:02 +0000 (17:50 +0100)
commitcf8bf24ffffe56b9de1716c2e713cff3d2b66c2d
treebbe1e6436cda17e156a7213dbc54d153bbaba2fd
parent459f6b9084dd0f2cc7fe899edfe41c48b0bd371c
iio: xilinx-xadc: Make sure not exceed maximum samplerate

The XADC supports a samplerate of up to 1MSPS. Unfortunately the hardware
does not have a FIFO, which means it generates an interrupt for each
conversion sequence. At one 1MSPS this creates an interrupt storm that
causes the system to soft-lock.

For this reason the driver limits the maximum samplerate to 150kSPS.
Currently this check is only done when setting a new samplerate. But it is
also possible that the initial samplerate configured in the FPGA bitstream
exceeds the limit.

In this case when starting to capture data without first changing the
samplerate the system can overload.

To prevent this check the currently configured samplerate in the probe
function and reduce it to the maximum if necessary.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Fixes: 66c14759a70c ("iio:adc: Add Xilinx XADC driver")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/xilinx-xadc-core.c