]> git.baikalelectronics.ru Git - kernel.git/commit
iio: xilinx-xadc: Fix clearing interrupt when enabling trigger
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 3 Apr 2020 13:27:14 +0000 (15:27 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Apr 2020 16:50:01 +0000 (17:50 +0100)
commit2c4d86ad44bd7e4ffb0b14b16cc2f513951c779c
tree52ba4a35c8aea51cb2ab5755c60de104cfcf338d
parentb5f7e7034c2a9fb043314c5a6e330347b5bb3bfc
iio: xilinx-xadc: Fix clearing interrupt when enabling trigger

When enabling the trigger and unmasking the end-of-sequence (EOS) interrupt
the EOS interrupt should be cleared from the status register. Otherwise it
is possible that it was still set from a previous capture. If that is the
case the interrupt would fire immediately even though no conversion has
been done yet and stale data is being read from the device.

The old code only clears the interrupt if the interrupt was previously
unmasked. Which does not make much sense since the interrupt is always
masked at this point and in addition masking the interrupt does not clear
the interrupt from the status register. So the clearing needs to be done
unconditionally.

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