]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
staging: comedi: addi_apci_1564: define the APCI1564_DI_IRQ_REG bits
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 7 Aug 2015 18:45:06 +0000 (11:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Aug 2015 01:34:57 +0000 (18:34 -0700)
Define the bits in this register. Remove the old defines in hwdrv_apci1564.c.

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>
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
drivers/staging/comedi/drivers/addi_apci_1564.c

index 42a87b789f53d21dcb7b23187917ec23c089e6f1..0fd77054e9b08919aff21e33cbbe81d2feb20e36 100644 (file)
@@ -1,11 +1,3 @@
-/* Digital Input IRQ Function Selection */
-#define APCI1564_DI_INT_OR                             (0 << 1)
-#define APCI1564_DI_INT_AND                            (1 << 1)
-
-/* Digital Input Interrupt Enable Disable. */
-#define APCI1564_DI_INT_ENABLE                         0x4
-#define APCI1564_DI_INT_DISABLE                                0xfffffffb
-
 static int apci1564_timer_insn_config(struct comedi_device *dev,
                                      struct comedi_subdevice *s,
                                      struct comedi_insn *insn,
index 2664bfa7b8f11b529c18aaee9a3119638a101d54..ae8446ec213e982aba49a14e6d81e88202cc7577 100644 (file)
@@ -79,6 +79,8 @@
 #define APCI1564_DI_INT_MODE2_REG              0x08
 #define APCI1564_DI_INT_STATUS_REG             0x0c
 #define APCI1564_DI_IRQ_REG                    0x10
+#define APCI1564_DI_IRQ_ENA                    BIT(2)
+#define APCI1564_DI_IRQ_MODE                   BIT(1)  /* 1=AND, 0=OR */
 #define APCI1564_DO_REG                                0x14
 #define APCI1564_DO_INT_CTRL_REG               0x18
 #define APCI1564_DO_INT_CTRL_CC_INT_ENA                BIT(1)
@@ -164,9 +166,9 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
        unsigned int chan;
 
        status = inl(dev->iobase + APCI1564_DI_IRQ_REG);
-       if (status & APCI1564_DI_INT_ENABLE) {
+       if (status & APCI1564_DI_IRQ_ENA) {
                /* disable the interrupt */
-               outl(status & APCI1564_DI_INT_DISABLE,
+               outl(status & ~APCI1564_DI_IRQ_ENA,
                     dev->iobase + APCI1564_DI_IRQ_REG);
 
                s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG) &
@@ -305,11 +307,9 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
                        outl(0x0, dev->iobase + APCI1564_DI_INT_MODE2_REG);
                        break;
                case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:
-                       if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE |
-                                             APCI1564_DI_INT_OR)) {
+                       if (devpriv->ctrl != APCI1564_DI_IRQ_ENA) {
                                /* switching to 'OR' mode */
-                               devpriv->ctrl = APCI1564_DI_INT_ENABLE |
-                                               APCI1564_DI_INT_OR;
+                               devpriv->ctrl = APCI1564_DI_IRQ_ENA;
                                /* wipe old channels */
                                devpriv->mode1 = 0;
                                devpriv->mode2 = 0;
@@ -323,11 +323,11 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
                        devpriv->mode2 |= data[5] << shift;
                        break;
                case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS:
-                       if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE |
-                                             APCI1564_DI_INT_AND)) {
+                       if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA |
+                                             APCI1564_DI_IRQ_MODE)) {
                                /* switching to 'AND' mode */
-                               devpriv->ctrl = APCI1564_DI_INT_ENABLE |
-                                               APCI1564_DI_INT_AND;
+                               devpriv->ctrl = APCI1564_DI_IRQ_ENA |
+                                               APCI1564_DI_IRQ_MODE;
                                /* wipe old channels */
                                devpriv->mode1 = 0;
                                devpriv->mode2 = 0;