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

staging: comedi: das16: all supported board have digital inputs

All the boards supported by this driver have digital inputs and all
of then use the same function to handle the (*insn_bits) for the
subdevice.

Remove the 'di' member from the boardinfo and always initialize the
digital input subdevice during the board attach.

Tidy up the subdevice init a bit as well as the (*insn_bits) function.
The (*insn_bits) function does not need to clear data[0].
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 0dc7c5db
...@@ -343,7 +343,6 @@ struct das16_board { ...@@ -343,7 +343,6 @@ struct das16_board {
unsigned int ai_pg; unsigned int ai_pg;
void *ao; void *ao;
unsigned int ao_nbits; unsigned int ao_nbits;
void *di;
void *do_; void *do_;
unsigned int i8255_offset; unsigned int i8255_offset;
...@@ -712,14 +711,12 @@ static int das16_ai_insn_read(struct comedi_device *dev, ...@@ -712,14 +711,12 @@ static int das16_ai_insn_read(struct comedi_device *dev,
return n; return n;
} }
static int das16_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, static int das16_di_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn, unsigned int *data) struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{ {
unsigned int bits; data[1] = inb(dev->iobase + DAS16_DIO) & 0xf;
bits = inb(dev->iobase + DAS16_DIO) & 0xf;
data[1] = bits;
data[0] = 0;
return insn->n; return insn->n;
} }
...@@ -1149,18 +1146,14 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1149,18 +1146,14 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
/* Digital Input subdevice */
s = &dev->subdevices[2]; s = &dev->subdevices[2];
/* di */ s->type = COMEDI_SUBD_DI;
if (board->di) { s->subdev_flags = SDF_READABLE;
s->type = COMEDI_SUBD_DI; s->n_chan = 4;
s->subdev_flags = SDF_READABLE; s->maxdata = 1;
s->n_chan = 4; s->range_table = &range_digital;
s->maxdata = 1; s->insn_bits = das16_di_insn_bits;
s->range_table = &range_digital;
s->insn_bits = board->di;
} else {
s->type = COMEDI_SUBD_UNUSED;
}
s = &dev->subdevices[3]; s = &dev->subdevices[3];
/* do */ /* do */
...@@ -1234,7 +1227,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1234,7 +1227,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_none, .ai_pg = das16_pg_none,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x10, .i8255_offset = 0x10,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1247,7 +1239,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1247,7 +1239,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_none, .ai_pg = das16_pg_none,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x10, .i8255_offset = 0x10,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1260,7 +1251,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1260,7 +1251,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_none, .ai_pg = das16_pg_none,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x10, .i8255_offset = 0x10,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1273,7 +1263,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1273,7 +1263,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_none, .ai_pg = das16_pg_none,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x10, .i8255_offset = 0x10,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1286,7 +1275,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1286,7 +1275,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_none, .ai_pg = das16_pg_none,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x10, .i8255_offset = 0x10,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1298,7 +1286,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1298,7 +1286,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 7692, .ai_speed = 7692,
.ai_pg = das16_pg_16jr, .ai_pg = das16_pg_16jr,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1310,7 +1297,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1310,7 +1297,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 3300, .ai_speed = 3300,
.ai_pg = das16_pg_16jr, .ai_pg = das16_pg_16jr,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1322,7 +1308,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1322,7 +1308,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 10000, .ai_speed = 10000,
.ai_pg = das16_pg_16jr_16, .ai_pg = das16_pg_16jr_16,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1334,7 +1319,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1334,7 +1319,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 10000, .ai_speed = 10000,
.ai_pg = das16_pg_16jr_16, .ai_pg = das16_pg_16jr_16,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1346,7 +1330,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1346,7 +1330,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 20000, .ai_speed = 20000,
.ai_pg = das16_pg_none, .ai_pg = das16_pg_none,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x400, .i8255_offset = 0x400,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1358,7 +1341,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1358,7 +1341,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 10000, .ai_speed = 10000,
.ai_pg = das16_pg_none, .ai_pg = das16_pg_none,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x400, .i8255_offset = 0x400,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1370,7 +1352,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1370,7 +1352,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 10000, .ai_speed = 10000,
.ai_pg = das16_pg_1601, .ai_pg = das16_pg_1601,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x0, .i8255_offset = 0x0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1382,7 +1363,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1382,7 +1363,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 10000, .ai_speed = 10000,
.ai_pg = das16_pg_1602, .ai_pg = das16_pg_1602,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x0, .i8255_offset = 0x0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1395,7 +1375,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1395,7 +1375,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_1601, .ai_pg = das16_pg_1601,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x400, .i8255_offset = 0x400,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1408,7 +1387,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1408,7 +1387,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_1602, .ai_pg = das16_pg_1602,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x400, .i8255_offset = 0x400,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1420,7 +1398,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1420,7 +1398,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 6250, .ai_speed = 6250,
.ai_pg = das16_pg_1601, .ai_pg = das16_pg_1601,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1432,7 +1409,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1432,7 +1409,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 6250, .ai_speed = 6250,
.ai_pg = das16_pg_1602, .ai_pg = das16_pg_1602,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1444,7 +1420,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1444,7 +1420,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 10000, .ai_speed = 10000,
.ai_pg = das16_pg_1602, .ai_pg = das16_pg_1602,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1457,7 +1432,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1457,7 +1432,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_1601, .ai_pg = das16_pg_1601,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x400, .i8255_offset = 0x400,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1470,7 +1444,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1470,7 +1444,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_1602, .ai_pg = das16_pg_1602,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x400, .i8255_offset = 0x400,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1483,7 +1456,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1483,7 +1456,6 @@ static const struct das16_board das16_boards[] = {
.ai_pg = das16_pg_1602, .ai_pg = das16_pg_1602,
.ao = das16_ao_winsn, .ao = das16_ao_winsn,
.ao_nbits = 12, .ao_nbits = 12,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0x400, .i8255_offset = 0x400,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
...@@ -1495,7 +1467,6 @@ static const struct das16_board das16_boards[] = { ...@@ -1495,7 +1467,6 @@ static const struct das16_board das16_boards[] = {
.ai_speed = 3030, .ai_speed = 3030,
.ai_pg = das16_pg_16jr, .ai_pg = das16_pg_16jr,
.ao = NULL, .ao = NULL,
.di = das16_di_rbits,
.do_ = das16_do_wbits, .do_ = das16_do_wbits,
.i8255_offset = 0, .i8255_offset = 0,
.i8254_offset = 0x0c, .i8254_offset = 0x0c,
......
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