Skip to content

Commit fff4620

Browse files
bigguinessgregkh
authored andcommitted
staging: comedi: pcl726: enable the interrupt support code
Tidy up and enable the interrupt support code for the external trigger source interrupt on the ACL-6126 board. The interrupt handler is currently just a stub function. Once the async command support is added this function will be completed. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 87d9bc4 commit fff4620

File tree

1 file changed

+17
-32
lines changed

1 file changed

+17
-32
lines changed

drivers/staging/comedi/drivers/pcl726.c

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ Interrupts are not supported.
6363
*/
6464

6565
#include <linux/module.h>
66-
#include "../comedidev.h"
66+
#include <linux/interrupt.h>
6767

68-
#undef ACL6126_IRQ /* no interrupt support (yet) */
68+
#include "../comedidev.h"
6969

7070
#define PCL726_SIZE 16
7171
#define PCL727_SIZE 32
@@ -173,6 +173,11 @@ struct pcl726_private {
173173
unsigned int ao_readback[12];
174174
};
175175

176+
static irqreturn_t pcl818_interrupt(int irq, void *d)
177+
{
178+
return IRQ_HANDLED;
179+
}
180+
176181
static int pcl726_ao_insn_write(struct comedi_device *dev,
177182
struct comedi_subdevice *s,
178183
struct comedi_insn *insn,
@@ -254,9 +259,6 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
254259
struct pcl726_private *devpriv;
255260
struct comedi_subdevice *s;
256261
int ret, i;
257-
#ifdef ACL6126_IRQ
258-
unsigned int irq;
259-
#endif
260262

261263
ret = comedi_request_region(dev, it->options[0], board->io_range);
262264
if (ret)
@@ -269,36 +271,19 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
269271
for (i = 0; i < 12; i++)
270272
devpriv->rangelist[i] = &range_unknown;
271273

272-
#ifdef ACL6126_IRQ
273-
irq = 0;
274-
if (boardtypes[board].IRQbits != 0) { /* board support IRQ */
275-
irq = it->options[1];
276-
devpriv->first_chan = 2;
277-
if (irq) { /* we want to use IRQ */
278-
if (((1 << irq) & boardtypes[board].IRQbits) == 0) {
279-
printk(KERN_WARNING
280-
", IRQ %d is out of allowed range,"
281-
" DISABLING IT", irq);
282-
irq = 0; /* Bad IRQ */
283-
} else {
284-
if (request_irq(irq, interrupt_pcl818, 0,
285-
dev->board_name, dev)) {
286-
printk(KERN_WARNING
287-
", unable to allocate IRQ %d,"
288-
" DISABLING IT", irq);
289-
irq = 0; /* Can't use IRQ */
290-
} else {
291-
printk(", irq=%d", irq);
292-
}
293-
}
274+
/*
275+
* Hook up the external trigger source interrupt only if the
276+
* user config option is valid and the board supports interrupts.
277+
*/
278+
if (it->options[1] && (board->IRQbits & (1 << it->options[1]))) {
279+
ret = request_irq(it->options[1], pcl818_interrupt, 0,
280+
dev->board_name, dev);
281+
if (ret == 0) {
282+
/* External trigger source is from Pin-17 of CN3 */
283+
dev->irq = it->options[1];
294284
}
295285
}
296286

297-
dev->irq = irq;
298-
#endif
299-
300-
printk("\n");
301-
302287
ret = comedi_alloc_subdevices(dev, 3);
303288
if (ret)
304289
return ret;

0 commit comments

Comments
 (0)