staging: comedi: adl_pci7x3x: Add interrupt handling for PCI-7230
authorBernd Harries <bha@gmx.de>
Mon, 18 Jan 2021 14:18:29 +0000 (14:18 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Jan 2021 17:48:04 +0000 (18:48 +0100)
commit115dbad485a72205c4b122fe43d8274c5ef68153
tree83283fa425913513560d779facc7e38019d265c7
parentc88c76c7286ef857216434d245c6032b1813376b
staging: comedi: adl_pci7x3x: Add interrupt handling for PCI-7230

On the ADLink PCI-7230, digital input channels 0 and 1 can be used as
external interrupt sources.  A rising edge on each input latches a
corresponding local interrupt input of the PCI interface chip.  Writing
a "clear IRQ" register clears both latches.

Add a new Comedi subdevice for each interrupt source, supporting the
asynchronous command interface.  This writes the state of the 16 digital
inputs to the subdevice's data buffer each time the corresponding
interrupt occurs.

This could be adapted to support the PCI-7233, PCI-7432 and PCI-7433
boards too.  They all have two interrupt sources, although for PCI-7233
each interrupt source is triggered by a change of state of 16 digital
inputs (0-15 and 16-31).  The "clear IRQ" register is at a different
offset for some boards.

Signed-off-by: Bernd Harries <bha@gmx.de>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210118141829.376505-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adl_pci7x3x.c