]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commite170c09e1545f5076bd7bf726941aa86af9fcb14
treefaf4a39259b7fb652d6e83def16740ee352ec6ce
parent0d48cb1dc7e01eebdc1b8d748ca1ba591c0934b4
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