[PATCH 0/6] staging: comedi: dt2814: Fix broken AI command support

Ian Abbott abbotti at mev.co.uk
Mon Mar 1 16:57:51 UTC 2021


The DT2814 board is an old analog-to-digital ISA card supported by the
Comedi "dt2814" driver.  The board has a timed acquisition mode, and an
end-of-conversion interrupt.  The interrupt can be disabled by removing
the jumper that sets the IRQ level.  In Comedi, the board is a manually
configured "legacy" device with an optional IRQ setting.

The Comedi driver has some broken support for asynchronous streaming
commands when the optional IRQ setting has been configured.  The main
problems are:

* It doesn't write any samples to the Comedi buffer to be read by the
  user application.
* The IRQ handler gets called at the end of any conversion, including
  during non-streaming, software-triggered acquisitions, but will
  interfere with these acquisitions because it reads the A/D Data
  register.

This series of patches attempts to support the asynchronous commands
properly so that it only reads the A/D Data register if the asynchronous
command has been set up, and actually writes it to the Comedi buffer.

Stopping the asynchronous command triggers an unwanted conversion.  The
interrupt handler used to wait for that to finish, but this series of
patches changes that so that other places in the code outside the
interrupt handler wait for a stale conversion to finish and/or read the
stale data before starting a new conversion.

1) staging: comedi: dt2814: Clear stale AI data before operation
2) staging: comedi: dt2814: Don't wait for conversion in interrupt handler
3) staging: comedi: dt2814: Call dt2814_ai_clear() during initialization
4) staging: comedi: dt2814: Fix asynchronous command interrupt handling
5) staging: comedi: dt2814: Remove struct dt2814_private
6) staging: comedi: dt2814: Clear stale AI data on detach

 drivers/staging/comedi/drivers/dt2814.c | 153 +++++++++++++++++++++++++-------
 1 file changed, 120 insertions(+), 33 deletions(-)



More information about the devel mailing list