]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: dt2811: simplify analog input range options
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 4 May 2016 19:47:20 +0000 (12:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Jun 2016 03:44:04 +0000 (20:44 -0700)
commit7cac559bfed02fc3d97781b595cb6c68c489b67a
treeed993288b01b35c8c37064de1ace98bcce0364f8
parent8b1941551985e72384517ab1fafaae95b134f0c3
staging: comedi: dt2811: simplify analog input range options

The A/D ranges are not programmable but the gain is. Currently this driver
uses a configuration option to select the comedi_lrange that will be used
for the analog input subdevice. This requires that the user makes sure the
correct option value is used.

The user space library uses the range information to convert between raw
values and physical units. If the user passed an incorrect option when
attaching the driver the conversion will be incorrect.

A previous patch allowed the gain to be set based on the chanspec range.
Prior to that the gain was always set to 1 so any conversion with a gain
that is not 1 would be incorrect anyway.

Simplify the analog input ranges by providing a range_table for the pgh and
pgl boards that contain all the possible range/gain options. The user can
then select the correct range (and gain) when converting values or reading
the analog inputs.

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/dt2811.c