staging: comedi: rti800: fix rti800_ao_insn_write()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Apr 2013 01:19:06 +0000 (18:19 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Apr 2013 23:29:06 +0000 (16:29 -0700)
commit853fc892239b4fb1b4d8a80b6d8c3f65061ff5bb
tree568d91809625a9104dc868dfeb07733c795d8ee5
parenta4b279ba9586189c1d6bcc87bf9583b0c65e8155
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>
drivers/staging/comedi/drivers/rti800.c