Commit 6092e942 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcmad: properly handle single/diff input configuration

The comedi_config utility is used to attach to this board. One of the
configuration options passed by the user sets the analog input reference
for single-ended or differential inputs.

Use the configuration option to correctly set the comedi_subdevice flags
as well as the number of channels.

Remove the 'differential' variable from the private data. Its not used
by the driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d69b55f3
......@@ -30,9 +30,9 @@
* Configuration options:
* [0] - I/O port base
* [1] - IRQ (unused)
* [2] - Analog input reference
* 0 = single ended
* 1 = differential
* [2] - Analog input reference (must match jumpers)
* 0 = single-ended (16 channels)
* 1 = differential (8 channels)
* [3] - Analog input encoding (must match jumpers)
* 0 = straight binary
* 1 = two's complement
......@@ -64,7 +64,6 @@ static const struct pcmad_board_struct pcmad_boards[] = {
};
struct pcmad_priv_struct {
int differential;
int twos_comp;
};
......@@ -134,8 +133,15 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s = &dev->subdevices[0];
s->type = COMEDI_SUBD_AI;
if (it->options[1]) {
/* 8 differential channels */
s->subdev_flags = SDF_READABLE | AREF_DIFF;
s->n_chan = 8;
} else {
/* 16 single-ended channels */
s->subdev_flags = SDF_READABLE | AREF_GROUND;
s->n_chan = 16;
}
s->len_chanlist = 1;
s->maxdata = board->ai_maxdata;
s->range_table = &range_unknown;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment