staging: comedi: adl_pci9118: fix ai range/aref programming
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 5 Sep 2014 16:25:42 +0000 (09:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Sep 2014 20:56:08 +0000 (13:56 -0700)
commit26318c1c167517a83f3561767738d08e98757630
treefaf4a39259b7fb652d6e83def16740ee352ec6ce
parentbdbeaed3f869d474774edc72a8f1ba6e091e2d82
staging: comedi: adl_pci9118: fix ai range/aref programming

Currently the analog input range and aref are set in setup_channel_list().
This works for the (*insn_read) but the (*do_cmd) has a problem.

In (*do_cmd) the ai control register is reset to 0 before the function works
out the bits needed to control the acquisition. This happens after the
setup_channel_list() call so the range is reset to bipolar and the aref to
single-ended.

Introduce a helper function, pci9118_ai_set_range_aref(), to handle the
programming of the range and aref bits. This function first clears the
cached value of the ai control register in the private data then sets the
appropriate bits. The (*insn_read) and (*do_cmd) can then set the other
bits needed to control the acquisition.

Then setup_channel_list() just needs to program the chanlist scan data.

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/adl_pci9118.c
This page took 0.02472 seconds and 5 git commands to generate.