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

staging: comedi: dt3000: refactor 'adbits' boardinfo

All the board supported by this driver have analog inputs. The input
resolution is either 12-bit or 16-bit.

Replace the 'adbits' member of the boardinfo with a bit-field flag
'ai_is_16bits' and just set if for the 16-bit boards.
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 2943de6a
...@@ -168,18 +168,17 @@ enum dt3k_boardid { ...@@ -168,18 +168,17 @@ enum dt3k_boardid {
struct dt3k_boardtype { struct dt3k_boardtype {
const char *name; const char *name;
int adchan; int adchan;
int adbits;
int ai_speed; int ai_speed;
const struct comedi_lrange *adrange; const struct comedi_lrange *adrange;
int dachan; int dachan;
int dabits; int dabits;
unsigned int ai_is_16bit:1;
}; };
static const struct dt3k_boardtype dt3k_boardtypes[] = { static const struct dt3k_boardtype dt3k_boardtypes[] = {
[BOARD_DT3001] = { [BOARD_DT3001] = {
.name = "dt3001", .name = "dt3001",
.adchan = 16, .adchan = 16,
.adbits = 12,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .dachan = 2,
...@@ -188,7 +187,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { ...@@ -188,7 +187,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = {
[BOARD_DT3001_PGL] = { [BOARD_DT3001_PGL] = {
.name = "dt3001-pgl", .name = "dt3001-pgl",
.adchan = 16, .adchan = 16,
.adbits = 12,
.adrange = &range_dt3000_ai_pgl, .adrange = &range_dt3000_ai_pgl,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .dachan = 2,
...@@ -197,14 +195,12 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { ...@@ -197,14 +195,12 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = {
[BOARD_DT3002] = { [BOARD_DT3002] = {
.name = "dt3002", .name = "dt3002",
.adchan = 32, .adchan = 32,
.adbits = 12,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 3000, .ai_speed = 3000,
}, },
[BOARD_DT3003] = { [BOARD_DT3003] = {
.name = "dt3003", .name = "dt3003",
.adchan = 64, .adchan = 64,
.adbits = 12,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .dachan = 2,
...@@ -213,7 +209,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { ...@@ -213,7 +209,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = {
[BOARD_DT3003_PGL] = { [BOARD_DT3003_PGL] = {
.name = "dt3003-pgl", .name = "dt3003-pgl",
.adchan = 64, .adchan = 64,
.adbits = 12,
.adrange = &range_dt3000_ai_pgl, .adrange = &range_dt3000_ai_pgl,
.ai_speed = 3000, .ai_speed = 3000,
.dachan = 2, .dachan = 2,
...@@ -222,20 +217,20 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = { ...@@ -222,20 +217,20 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = {
[BOARD_DT3004] = { [BOARD_DT3004] = {
.name = "dt3004", .name = "dt3004",
.adchan = 16, .adchan = 16,
.adbits = 16,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 10000, .ai_speed = 10000,
.dachan = 2, .dachan = 2,
.dabits = 12, .dabits = 12,
.ai_is_16bit = 1,
}, },
[BOARD_DT3005] = { [BOARD_DT3005] = {
.name = "dt3005", /* a.k.a. 3004-200 */ .name = "dt3005", /* a.k.a. 3004-200 */
.adchan = 16, .adchan = 16,
.adbits = 16,
.adrange = &range_dt3000_ai, .adrange = &range_dt3000_ai,
.ai_speed = 5000, .ai_speed = 5000,
.dachan = 2, .dachan = 2,
.dabits = 12, .dabits = 12,
.ai_is_16bit = 1,
}, },
}; };
...@@ -675,7 +670,7 @@ static int dt3000_auto_attach(struct comedi_device *dev, ...@@ -675,7 +670,7 @@ static int dt3000_auto_attach(struct comedi_device *dev,
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
s->n_chan = board->adchan; s->n_chan = board->adchan;
s->insn_read = dt3k_ai_insn; s->insn_read = dt3k_ai_insn;
s->maxdata = (1 << board->adbits) - 1; s->maxdata = board->ai_is_16bit ? 0xffff : 0x0fff;
s->range_table = &range_dt3000_ai; /* XXX */ s->range_table = &range_dt3000_ai; /* XXX */
if (dev->irq) { if (dev->irq) {
dev->read_subdev = s; dev->read_subdev = s;
......
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