Im not sure what was intended with this boardinfo. It appears to be trying to handle the sink/source output type of the boards supported by the driver. But, some of the boardinfo does not match the actual hardware descriptions in the manual. The manual also does not mention anything about the port setting vs. the actual output level. Also, the (*auto_attach) is a bit goofy. If the boardinfo indicates to 'invert_outputs' only the first channel of the port is set. Simplify the driver a bit by just removing this boardinfo. The values written to the "ports" will then be what is passed to comedi by the user and values returned to the user will be the value in the "ports". Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregk@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/ni_65xx.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 4b3f504..1f3e83b 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -143,7 +143,6 @@ struct ni_65xx_board { unsigned num_dio_ports; unsigned num_di_ports; unsigned num_do_ports; - unsigned invert_outputs:1; }; static const struct ni_65xx_board ni_65xx_boards[] = { @@ -178,58 +177,48 @@ static const struct ni_65xx_board ni_65xx_boards[] = { [BOARD_PCI6513] = { .name = "pci-6513", .num_do_ports = 8, - .invert_outputs = 1, }, [BOARD_PXI6513] = { .name = "pxi-6513", .num_do_ports = 8, - .invert_outputs = 1, }, [BOARD_PCI6514] = { .name = "pci-6514", .num_di_ports = 4, .num_do_ports = 4, - .invert_outputs = 1, }, [BOARD_PXI6514] = { .name = "pxi-6514", .num_di_ports = 4, .num_do_ports = 4, - .invert_outputs = 1, }, [BOARD_PCI6515] = { .name = "pci-6515", .num_di_ports = 4, .num_do_ports = 4, - .invert_outputs = 1, }, [BOARD_PXI6515] = { .name = "pxi-6515", .num_di_ports = 4, .num_do_ports = 4, - .invert_outputs = 1, }, [BOARD_PCI6516] = { .name = "pci-6516", .num_do_ports = 4, - .invert_outputs = 1, }, [BOARD_PCI6517] = { .name = "pci-6517", .num_do_ports = 4, - .invert_outputs = 1, }, [BOARD_PCI6518] = { .name = "pci-6518", .num_di_ports = 2, .num_do_ports = 2, - .invert_outputs = 1, }, [BOARD_PCI6519] = { .name = "pci-6519", .num_di_ports = 2, .num_do_ports = 2, - .invert_outputs = 1, }, [BOARD_PCI6520] = { .name = "pci-6520", @@ -356,7 +345,6 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - const struct ni_65xx_board *board = comedi_board(dev); struct ni_65xx_private *devpriv = dev->private; int base_bitfield_channel; unsigned read_bits = 0; @@ -390,18 +378,10 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, devpriv->output_bits[port] |= port_data & port_mask; bits = devpriv->output_bits[port]; - if (board->invert_outputs) - bits = ~bits; writeb(bits, devpriv->mmio + NI_65XX_IO_DATA_REG(port)); } port_read_bits = readb(devpriv->mmio + NI_65XX_IO_DATA_REG(port)); - if (s->type == COMEDI_SUBD_DO && board->invert_outputs) { - /* Outputs inverted, so invert value read back from - * DO subdevice. (Does not apply to boards with DIO - * subdevice.) */ - port_read_bits ^= 0xFF; - } if (bitshift > 0) port_read_bits <<= bitshift; else @@ -671,13 +651,9 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, s->insn_bits = ni_65xx_intr_insn_bits; s->insn_config = ni_65xx_intr_insn_config; - for (i = 0; i < ni_65xx_total_num_ports(board); ++i) { + for (i = 0; i < ni_65xx_total_num_ports(board); ++i) writeb(0x00, devpriv->mmio + NI_65XX_FILTER_ENA(i)); - if (board->invert_outputs) - writeb(0x01, devpriv->mmio + NI_65XX_IO_DATA_REG(i)); - else - writeb(0x00, devpriv->mmio + NI_65XX_IO_DATA_REG(i)); - } + writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT, devpriv->mmio + NI_65XX_CLR_REG); writeb(0x00, devpriv->mmio + NI_65XX_CTRL_REG); -- 1.9.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel