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

staging: comedi: dt3000: the dt3002 board does not have analog outputs

According to the boardinfo, the dt3002 board does not have analog outputs.
The rest of the board have two 12-bit analog output channels.

Replace the 'dachan' and 'dabits' members of the boardinfo with a bit-
field flag 'has_ao'. Use the new member to conditionally initialize
the analog output subdevice.
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 91644956
...@@ -170,9 +170,8 @@ struct dt3k_boardtype { ...@@ -170,9 +170,8 @@ struct dt3k_boardtype {
int adchan; int adchan;
int ai_speed; int ai_speed;
const struct comedi_lrange *adrange; const struct comedi_lrange *adrange;
int dachan;
int dabits;
unsigned int ai_is_16bit:1; unsigned int ai_is_16bit:1;
unsigned int has_ao:1;
}; };
static const struct dt3k_boardtype dt3k_boardtypes[] = { static const struct dt3k_boardtype dt3k_boardtypes[] = {
...@@ -181,16 +180,14 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { ...@@ -181,16 +180,14 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = {
.adchan = 16, .adchan = 16,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .has_ao = 1,
.dabits = 12,
}, },
[BOARD_DT3001_PGL] = { [BOARD_DT3001_PGL] = {
.name = "dt3001-pgl", .name = "dt3001-pgl",
.adchan = 16, .adchan = 16,
.adrange = &range_dt3000_ai_pgl, .adrange = &range_dt3000_ai_pgl,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .has_ao = 1,
.dabits = 12,
}, },
[BOARD_DT3002] = { [BOARD_DT3002] = {
.name = "dt3002", .name = "dt3002",
...@@ -203,34 +200,30 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { ...@@ -203,34 +200,30 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = {
.adchan = 64, .adchan = 64,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .has_ao = 1,
.dabits = 12,
}, },
[BOARD_DT3003_PGL] = { [BOARD_DT3003_PGL] = {
.name = "dt3003-pgl", .name = "dt3003-pgl",
.adchan = 64, .adchan = 64,
.adrange = &range_dt3000_ai_pgl, .adrange = &range_dt3000_ai_pgl,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .has_ao = 1,
.dabits = 12,
}, },
[BOARD_DT3004] = { [BOARD_DT3004] = {
.name = "dt3004", .name = "dt3004",
.adchan = 16, .adchan = 16,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 10000, .ai_speed = 10000,
.dachan = 2,
.dabits = 12,
.ai_is_16bit = 1, .ai_is_16bit = 1,
.has_ao = 1,
}, },
[BOARD_DT3005] = { [BOARD_DT3005] = {
.name = "dt3005", /* a.k.a. 3004-200 */ .name = "dt3005", /* a.k.a. 3004-200 */
.adchan = 16, .adchan = 16,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 5000, .ai_speed = 5000,
.dachan = 2,
.dabits = 12,
.ai_is_16bit = 1, .ai_is_16bit = 1,
.has_ao = 1,
}, },
}; };
...@@ -681,13 +674,13 @@ static int dt3000_auto_attach(struct comedi_device *dev, ...@@ -681,13 +674,13 @@ static int dt3000_auto_attach(struct comedi_device *dev,
s->cancel = dt3k_ai_cancel; s->cancel = dt3k_ai_cancel;
} }
/* Analog Output subdevice */
s = &dev->subdevices[1]; s = &dev->subdevices[1];
/* ao subsystem */ if (board->has_ao) {
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE; s->subdev_flags = SDF_WRITABLE;
s->n_chan = 2; s->n_chan = 2;
s->maxdata = (1 << board->dabits) - 1; s->maxdata = 0x0fff;
s->len_chanlist = 1;
s->range_table = &range_bipolar10; s->range_table = &range_bipolar10;
s->insn_write = dt3k_ao_insn_write; s->insn_write = dt3k_ao_insn_write;
...@@ -695,6 +688,10 @@ static int dt3000_auto_attach(struct comedi_device *dev, ...@@ -695,6 +688,10 @@ static int dt3000_auto_attach(struct comedi_device *dev,
if (ret) if (ret)
return ret; return ret;
} else {
s->type = COMEDI_SUBD_UNUSED;
}
s = &dev->subdevices[2]; s = &dev->subdevices[2];
/* dio subsystem */ /* dio subsystem */
s->type = COMEDI_SUBD_DIO; s->type = COMEDI_SUBD_DIO;
......
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