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>
1 file changed