• Lars-Peter Clausen's avatar
    iio: xilinx-xadc: Make sure not exceed maximum samplerate · 3b7f9dbb
    Lars-Peter Clausen authored
    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: default avatarLars-Peter Clausen <lars@metafoo.de>
    Fixes: bdc8cda1 ("iio:adc: Add Xilinx XADC driver")
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    3b7f9dbb
xilinx-xadc-core.c 35.4 KB