]> git.openfabrics.org - ~emulex/infiniband.git/commit
staging: comedi: addi_apci_3xxx: refactor the ttl digital i/o support
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 12 Jun 2013 23:15:27 +0000 (16:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 21:33:42 +0000 (14:33 -0700)
commitda6578abd7c7535e59cae5eb0c54f5cd13902a6d
tree386c529ee0063cc12184258eeaadce46b76d04f0
parent0e771e49fc2174054bbb4927f9afe8db4e16ae0b
staging: comedi: addi_apci_3xxx: refactor the ttl digital i/o support

Currently, the subdevice functions used to configure and read/write the
ttl digital i/o ports is way over to complicated. The (*insn_config)
function also abuses the comedi API by overriding the instruction
command passed in data[0].

Fix the ttl digital i/o support to work like the comedi core expects.

The (*insn_config) function supports the three instructions common for
COMEDI_SUBD_DIO subdevices:

    INSN_CONFIG_DIO_INPUT - configure the specified channel as input
    INSN_CONFIG_DIO_OUTPUT - configure the specified channel as output
    INSN_CONFIG_DIO_QUERY - returns the status of the specified channel

    Port 0 (channels 0-7) is always input
    Port 1 (channels 8-15) is always output
    Port 2 (channels 9-23) are programmable i/o (all channels are input or output)

The (*insn_bits) function allows writing to the output channels and returns
the state of all channels.

The (*insn_read) and (*insn_write) functions are not required. The comedi
core will emulate them using the (*insn_bits) function.

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_apci3xxx.c
drivers/staging/comedi/drivers/addi_apci_3xxx.c