staging: comedi: rti800: fix rti800_ao_insn_write()

This board has two independent analog output channels. Each channel
has its own 12-bit D.A converter. Each channel can be set to output
a unipolar 10V or bipolar 10V signal. This selection is handled by
a jumper on the board and configured by the user with options[5] and
[7] passed during the attach of the board.

The two channels can also be configured with jumpers to use straight
binary or two's complement data. The user configures the data type
with options[6] and [8] when attaching.

Currently, this driver uses the dac0 selection, option[6], for both
channels. Fix the rti800_ao_insn_write() function to properly use
the configuration specified by the user.

Change the dac[01]_coding in the private data to a simple bool
array, dac_2comp.

Add some local vars to hold the registers offsets needed to write
to the DAC.

Only the last value written to the DAC needs to be cached for readback,

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 file changed