Commit 9c06c4e3 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcl818: all board types have analog inputs

All the boards supported by this driver have 16 single-ended analog input
channels. The boards can also be configued to give 8 differential inputs.

Remove the 'n_aichan_se' and 'n_aichan_diff' members from the boardinfo and
refactor pcl818_attach().
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1ddd22c0
...@@ -259,8 +259,6 @@ static const struct comedi_lrange range718_unipolar1 = { ...@@ -259,8 +259,6 @@ static const struct comedi_lrange range718_unipolar1 = {
struct pcl818_board { struct pcl818_board {
const char *name; const char *name;
int n_ranges; int n_ranges;
int n_aichan_se;
int n_aichan_diff;
unsigned int ns_min; unsigned int ns_min;
int n_aochan; int n_aochan;
const struct comedi_lrange *ai_range_type; const struct comedi_lrange *ai_range_type;
...@@ -276,8 +274,6 @@ static const struct pcl818_board boardtypes[] = { ...@@ -276,8 +274,6 @@ static const struct pcl818_board boardtypes[] = {
{ {
.name = "pcl818l", .name = "pcl818l",
.n_ranges = 4, .n_ranges = 4,
.n_aichan_se = 16,
.n_aichan_diff = 8,
.ns_min = 25000, .ns_min = 25000,
.n_aochan = 1, .n_aochan = 1,
.ai_range_type = &range_pcl818l_l_ai, .ai_range_type = &range_pcl818l_l_ai,
...@@ -289,8 +285,6 @@ static const struct pcl818_board boardtypes[] = { ...@@ -289,8 +285,6 @@ static const struct pcl818_board boardtypes[] = {
}, { }, {
.name = "pcl818h", .name = "pcl818h",
.n_ranges = 9, .n_ranges = 9,
.n_aichan_se = 16,
.n_aichan_diff = 8,
.ns_min = 10000, .ns_min = 10000,
.n_aochan = 1, .n_aochan = 1,
.ai_range_type = &range_pcl818h_ai, .ai_range_type = &range_pcl818h_ai,
...@@ -302,8 +296,6 @@ static const struct pcl818_board boardtypes[] = { ...@@ -302,8 +296,6 @@ static const struct pcl818_board boardtypes[] = {
}, { }, {
.name = "pcl818hd", .name = "pcl818hd",
.n_ranges = 9, .n_ranges = 9,
.n_aichan_se = 16,
.n_aichan_diff = 8,
.ns_min = 10000, .ns_min = 10000,
.n_aochan = 1, .n_aochan = 1,
.ai_range_type = &range_pcl818h_ai, .ai_range_type = &range_pcl818h_ai,
...@@ -316,8 +308,6 @@ static const struct pcl818_board boardtypes[] = { ...@@ -316,8 +308,6 @@ static const struct pcl818_board boardtypes[] = {
}, { }, {
.name = "pcl818hg", .name = "pcl818hg",
.n_ranges = 12, .n_ranges = 12,
.n_aichan_se = 16,
.n_aichan_diff = 8,
.ns_min = 10000, .ns_min = 10000,
.n_aochan = 1, .n_aochan = 1,
.ai_range_type = &range_pcl818hg_ai, .ai_range_type = &range_pcl818hg_ai,
...@@ -330,8 +320,6 @@ static const struct pcl818_board boardtypes[] = { ...@@ -330,8 +320,6 @@ static const struct pcl818_board boardtypes[] = {
}, { }, {
.name = "pcl818", .name = "pcl818",
.n_ranges = 9, .n_ranges = 9,
.n_aichan_se = 16,
.n_aichan_diff = 8,
.ns_min = 10000, .ns_min = 10000,
.n_aochan = 2, .n_aochan = 2,
.ai_range_type = &range_pcl818h_ai, .ai_range_type = &range_pcl818h_ai,
...@@ -343,8 +331,6 @@ static const struct pcl818_board boardtypes[] = { ...@@ -343,8 +331,6 @@ static const struct pcl818_board boardtypes[] = {
}, { }, {
.name = "pcl718", .name = "pcl718",
.n_ranges = 1, .n_ranges = 1,
.n_aichan_se = 16,
.n_aichan_diff = 8,
.ns_min = 16000, .ns_min = 16000,
.n_aochan = 2, .n_aochan = 2,
.ai_range_type = &range_unipolar5, .ai_range_type = &range_unipolar5,
...@@ -355,8 +341,6 @@ static const struct pcl818_board boardtypes[] = { ...@@ -355,8 +341,6 @@ static const struct pcl818_board boardtypes[] = {
}, { }, {
.name = "pcm3718", .name = "pcm3718",
.n_ranges = 9, .n_ranges = 9,
.n_aichan_se = 16,
.n_aichan_diff = 8,
.ns_min = 10000, .ns_min = 10000,
.ai_range_type = &range_pcl818h_ai, .ai_range_type = &range_pcl818h_ai,
.IRQbits = 0x00fc, .IRQbits = 0x00fc,
...@@ -1414,31 +1398,27 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1414,31 +1398,27 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return ret; return ret;
s = &dev->subdevices[0]; s = &dev->subdevices[0];
if (!board->n_aichan_se) { s->type = COMEDI_SUBD_AI;
s->type = COMEDI_SUBD_UNUSED; s->subdev_flags = SDF_READABLE;
if (check_single_ended(dev->iobase)) {
s->n_chan = 16;
s->subdev_flags |= SDF_COMMON | SDF_GROUND;
} else { } else {
s->type = COMEDI_SUBD_AI; s->n_chan = 8;
s->subdev_flags = SDF_READABLE; s->subdev_flags |= SDF_DIFF;
if (check_single_ended(dev->iobase)) { }
s->n_chan = board->n_aichan_se; s->maxdata = board->ai_maxdata;
s->subdev_flags |= SDF_COMMON | SDF_GROUND;
} else { pcl818_set_ai_range_table(dev, s, it);
s->n_chan = board->n_aichan_diff;
s->subdev_flags |= SDF_DIFF; s->insn_read = pcl818_ai_insn_read;
} if (dev->irq) {
s->maxdata = board->ai_maxdata; dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
pcl818_set_ai_range_table(dev, s, it); s->len_chanlist = s->n_chan;
s->do_cmdtest = ai_cmdtest;
s->insn_read = pcl818_ai_insn_read; s->do_cmd = ai_cmd;
if (dev->irq) { s->cancel = pcl818_ai_cancel;
dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
s->len_chanlist = s->n_chan;
s->do_cmdtest = ai_cmdtest;
s->do_cmd = ai_cmd;
s->cancel = pcl818_ai_cancel;
}
} }
s = &dev->subdevices[1]; s = &dev->subdevices[1];
......
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