]> 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)
commit51d4280bbe94b4c79b9d230ad5c48b8132b7fa0a
treebbe1e6436cda17e156a7213dbc54d153bbaba2fd
parent2e3ffe1c113c50f749f5edd4666644d83ee55a21
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: d893b5550b43 ("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