Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 337745
b: refs/heads/master
c: 792660d
h: refs/heads/master
i:
  337743: 186dd45
v: v3
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Nov 13, 2012
1 parent 3c36eed commit 279f2aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54327dd75ea2258d6fe5201382fad2254c008f9e
refs/heads/master: 792660d534f284ebe730c21bc05a94fbf9c62fbd
18 changes: 15 additions & 3 deletions trunk/drivers/staging/comedi/drivers/addi_apci_1032.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "../comedidev.h"
#include "comedi_fc.h"
#include "amcc_s5933.h"

/*
* I/O Register Map
Expand All @@ -45,6 +46,7 @@
#define APCI1032_CTRL_INT_ENA (1 << 2)

struct apci1032_private {
unsigned long amcc_iobase; /* base of AMCC I/O registers */
unsigned int mode1; /* rising-edge/high level channels */
unsigned int mode2; /* falling-edge/low level channels */
unsigned int ctrl; /* interrupt mode OR (edge) . AND (level) */
Expand Down Expand Up @@ -218,11 +220,21 @@ static int apci1032_cos_cancel(struct comedi_device *dev,
static irqreturn_t apci1032_interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
struct apci1032_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
unsigned int ctrl;

/* disable the interrupt */
/* check interrupt is from this device */
if ((inl(devpriv->amcc_iobase + AMCC_OP_REG_INTCSR) &
INTCSR_INTR_ASSERTED) == 0)
return IRQ_NONE;

/* check interrupt is enabled */
ctrl = inl(dev->iobase + APCI1032_CTRL_REG);
if ((ctrl & APCI1032_CTRL_INT_ENA) == 0)
return IRQ_HANDLED;

/* disable the interrupt */
outl(ctrl & ~APCI1032_CTRL_INT_ENA, dev->iobase + APCI1032_CTRL_REG);

s->state = inl(dev->iobase + APCI1032_STATUS_REG) & 0xffff;
Expand Down Expand Up @@ -265,8 +277,9 @@ static int __devinit apci1032_auto_attach(struct comedi_device *dev,
if (ret)
return ret;

devpriv->amcc_iobase = pci_resource_start(pcidev, 0);
dev->iobase = pci_resource_start(pcidev, 1);

apci1032_reset(dev);
if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, apci1032_interrupt, IRQF_SHARED,
dev->board_name, dev);
Expand Down Expand Up @@ -305,7 +318,6 @@ static int __devinit apci1032_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED;
}

apci1032_reset(dev);
return 0;
}

Expand Down

0 comments on commit 279f2aa

Please sign in to comment.