Re: [PATCH 29/29] staging: comedi: dt282x: automatically handle D/A data format

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

 



On 2014-06-20 21:13, H Hartley Sweeten wrote:
The DT2821 series board have jumpers that set the output range for
the two Analog Output channels. The range_table for the Analog Output
subdevice provides all possible ranges to the user. When a unipolar
range is selected the board expects the data to be in a straight
binary format. When a bipolar range is select the data should be in
two's complement format.

Currently, the user passes some configuration options when attaching
to the driver to select the data format for each channel. If the
user does not pass the config options, the data format is assumed to
be straight binary.

The Analog Output subdevice now has a range_table that provides the
user will all possible ranges. Use the range information to determine
if the data values need to be munged into two's complememnt values
and deprecate the config options.

I don't think there's any physical requirement for the 2's complement/straight binary jumpers to match the range jumpers. The 2's complement/straight binary jumper will just invert or pass through the top bit of the data value.

A downside of this patch is that users may have to open up their computer to set the jumper how comedi expects it to be, rather than just telling comedi how the jumper is set on the board via the attach option (although the options were handled incorrectly anyway and fixed by your patch 06). Particularly in this case, the default option values for options 6, 7, 9 and 10 would have been to assume the +/-10V range with straight binary coding, but this patch changes it to assume 2's complement encoding for the +/-10V range.

In general, I feel it's best not to mess with the attach option values unless they're obviously buggy.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
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