These changes are a raw update to a vanilla kernel 4.1.10, with the
[kvmfornfv.git] / kernel / drivers / staging / comedi / drivers / adl_pci7x3x.c
index 934af3f..b0fc027 100644 (file)
@@ -120,8 +120,20 @@ static int adl_pci7x3x_do_insn_bits(struct comedi_device *dev,
 {
        unsigned long reg = (unsigned long)s->private;
 
-       if (comedi_dio_update_state(s, data))
-               outl(s->state, dev->iobase + reg);
+       if (comedi_dio_update_state(s, data)) {
+               unsigned int val = s->state;
+
+               if (s->n_chan == 16) {
+                       /*
+                        * It seems the PCI-7230 needs the 16-bit DO state
+                        * to be shifted left by 16 bits before being written
+                        * to the 32-bit register.  Set the value in both
+                        * halves of the register to be sure.
+                        */
+                       val |= val << 16;
+               }
+               outl(val, dev->iobase + reg);
+       }
 
        data[1] = s->state;