Commit 0615c162 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_mio_common: refactor 'num_p0_dio_channels' boardinfo

All of the board supported by this driver have at least 8 Digital I/O
channels. A couple of the PCI boards in ni_pcimio have 32 channels.

For aesthetics, change this member of the boardinfo into a bit-field
flag, 'has_32dio_chan', and use that when initializing the DIO subdevice
to set the number of channels to 32 or 8.
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 80a94e40
......@@ -117,7 +117,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_fifo_depth = 2048,
.ao_range_table = &range_ni_E_ao_ext,
.ao_speed = 1000,
.num_p0_dio_channels = 8,
.caldac = { mb88341 },
}, {
.name = "at-mio-16e-2",
......@@ -133,7 +132,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_fifo_depth = 2048,
.ao_range_table = &range_ni_E_ao_ext,
.ao_speed = 1000,
.num_p0_dio_channels = 8,
.caldac = { mb88341 },
}, {
.name = "at-mio-16e-10",
......@@ -148,7 +146,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_maxdata = 0x0fff,
.ao_range_table = &range_ni_E_ao_ext,
.ao_speed = 10000,
.num_p0_dio_channels = 8,
.caldac = { ad8804_debug },
}, {
.name = "at-mio-16de-10",
......@@ -163,7 +160,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_maxdata = 0x0fff,
.ao_range_table = &range_ni_E_ao_ext,
.ao_speed = 10000,
.num_p0_dio_channels = 8,
.caldac = { ad8804_debug },
.has_8255 = 1,
}, {
......@@ -180,7 +176,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_fifo_depth = 2048,
.ao_range_table = &range_ni_E_ao_ext,
.ao_speed = 1000,
.num_p0_dio_channels = 8,
.caldac = { ad8804_debug },
}, {
.name = "at-mio-16xe-50",
......@@ -196,7 +191,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_maxdata = 0x0fff,
.ao_range_table = &range_bipolar10,
.ao_speed = 50000,
.num_p0_dio_channels = 8,
.caldac = { dac8800, dac8043 },
}, {
.name = "at-mio-16xe-10",
......@@ -213,7 +207,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_fifo_depth = 2048,
.ao_range_table = &range_ni_E_ao_ext,
.ao_speed = 1000,
.num_p0_dio_channels = 8,
.caldac = { dac8800, dac8043, ad8522 },
}, {
.name = "at-ai-16xe-10",
......@@ -225,7 +218,6 @@ static const struct ni_board_struct ni_boards[] = {
.alwaysdither = 1, /* unknown */
.gainlkup = ai_gain_14,
.ai_speed = 10000,
.num_p0_dio_channels = 8,
.caldac = { dac8800, dac8043, ad8522 },
},
};
......
......@@ -5582,7 +5582,7 @@ static int ni_E_init(struct comedi_device *dev,
s->maxdata = 1;
s->io_bits = 0; /* all bits input */
s->range_table = &range_digital;
s->n_chan = board->num_p0_dio_channels;
s->n_chan = board->has_32dio_chan ? 32 : 8;
if (devpriv->is_m_series) {
s->subdev_flags |=
SDF_LSAMPL | SDF_CMD_WRITE /* | SDF_CMD_READ */;
......
......@@ -60,7 +60,6 @@ static const struct ni_board_struct ni_boards[] = {
.ai_fifo_depth = 1024,
.gainlkup = ai_gain_8,
.ai_speed = 5000,
.num_p0_dio_channels = 8,
.caldac = { dac8800, dac8043 },
}, {
.name = "DAQCard-ai-16e-4",
......@@ -70,7 +69,6 @@ static const struct ni_board_struct ni_boards[] = {
.ai_fifo_depth = 1024,
.gainlkup = ai_gain_16,
.ai_speed = 4000,
.num_p0_dio_channels = 8,
.caldac = { mb88341 }, /* verified */
}, {
.name = "DAQCard-6062E",
......@@ -85,7 +83,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_fifo_depth = 2048,
.ao_range_table = &range_bipolar10,
.ao_speed = 1176,
.num_p0_dio_channels = 8,
.caldac = { ad8804_debug }, /* verified */
}, {
/* specs incorrect! */
......@@ -100,7 +97,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_maxdata = 0x0fff,
.ao_range_table = &range_bipolar10,
.ao_speed = 1000000,
.num_p0_dio_channels = 8,
.caldac = { ad8804_debug },
}, {
/* specs incorrect! */
......@@ -116,7 +112,6 @@ static const struct ni_board_struct ni_boards[] = {
.ao_maxdata = 0xffff,
.ao_range_table = &range_bipolar10,
.ao_speed = 1000000,
.num_p0_dio_channels = 8,
.caldac = { ad8804_debug },
},
#if 0
......@@ -126,7 +121,6 @@ static const struct ni_board_struct ni_boards[] = {
.n_aochan = 8,
.ao_maxdata = 0x0fff,
.ao_671x = 8192,
.num_p0_dio_channels = 8,
.caldac = { mb88341, mb88341 },
},
#endif
......
This diff is collapsed.
......@@ -1406,10 +1406,9 @@ struct ni_board_struct {
const struct comedi_lrange *ao_range_table;
unsigned ao_speed;
unsigned num_p0_dio_channels;
int reg_type;
unsigned int has_8255:1;
unsigned int has_32dio_chan:1;
enum caldac_enum caldac[3];
};
......
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