Re: [PATCH] staging: comedi: das1800: fix analog input sample munging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/04/16 18:45, H Hartley Sweeten wrote:
The analog input samples are 2's complement when the inputs are configured
for bipolar ranges and offset binary when they are unipolar ranges. For
bipolar ranges the samples need to be munged to the offset binary format
that comedi uses.

The (*insn_read) does the munging correctly but the async command support
incorrectly munges the data for both bipolar and unipolar ranges when
reading the remaining samples from the fifo in das1800_handle_fifo_not_empty().

Add a (*munge) function to the analog input subdevice so that the samples
are correctly munged when they are added to the async buffer by
comedi_buf_write_samples(). Add a flag to the private data and set it in
the (*do_cmd) so that the munging is only done for bipolar ranges.

Clarify the code by using the core helper functions to check the range and
do the munging.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
  drivers/staging/comedi/drivers/das1800.c | 84 ++++++++++++++------------------
  1 file changed, 36 insertions(+), 48 deletions(-)


Thanks!

Reviewed-by: Ian Abbott <abbotti@xxxxxxxxx>

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux