Skip to content

Commit f954b09

Browse files
larsclausenjic23
authored andcommitted
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 <[email protected]> Fixes: bdc8cda ("iio:adc: Add Xilinx XADC driver") Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent e44ec77 commit f954b09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/adc/xilinx-xadc-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ static int xadc_trigger_set_state(struct iio_trigger *trigger, bool state)
674674

675675
spin_lock_irqsave(&xadc->lock, flags);
676676
xadc_read_reg(xadc, XADC_AXI_REG_IPIER, &val);
677-
xadc_write_reg(xadc, XADC_AXI_REG_IPISR, val & XADC_AXI_INT_EOS);
677+
xadc_write_reg(xadc, XADC_AXI_REG_IPISR, XADC_AXI_INT_EOS);
678678
if (state)
679679
val |= XADC_AXI_INT_EOS;
680680
else

0 commit comments

Comments
 (0)