]> 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)
commit81b712752fb621262f9e9e10f8b7d9f62d787204
treefaf4a39259b7fb652d6e83def16740ee352ec6ce
parente7c7295c57b542848e59a9c38a1794ba089fed55
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