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

staging: comedi: pcl812: remove 'ai_maxdata' from boardinfo

Most of the board types supported by this driver have 12-bit analog
inputs. Two of them, the acl8216 and a826pg, have 16-bit analog inputs.

Remove the 'ai_maxdata' member from the boardinfo and replace it with
a bit-field flag 'has_16bit_ai'. Refactor pcl812_attach() to use this
new boardinfo.
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 2bfe3eb7
...@@ -333,11 +333,11 @@ struct pcl812_board { ...@@ -333,11 +333,11 @@ struct pcl812_board {
int board_type; int board_type;
int n_aichan; int n_aichan;
int n_aochan; int n_aochan;
int ai_maxdata;
unsigned int ai_ns_min; unsigned int ai_ns_min;
const struct comedi_lrange *rangelist_ai; const struct comedi_lrange *rangelist_ai;
unsigned int IRQbits; unsigned int IRQbits;
unsigned int has_dma:1; unsigned int has_dma:1;
unsigned int has_16bit_ai:1;
unsigned int has_mpc508_mux:1; unsigned int has_mpc508_mux:1;
unsigned int has_dio:1; unsigned int has_dio:1;
}; };
...@@ -348,7 +348,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -348,7 +348,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardPCL812, .board_type = boardPCL812,
.n_aichan = 16, .n_aichan = 16,
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 33000, .ai_ns_min = 33000,
.rangelist_ai = &range_bipolar10, .rangelist_ai = &range_bipolar10,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -359,7 +358,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -359,7 +358,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardPCL812PG, .board_type = boardPCL812PG,
.n_aichan = 16, .n_aichan = 16,
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 33000, .ai_ns_min = 33000,
.rangelist_ai = &range_pcl812pg_ai, .rangelist_ai = &range_pcl812pg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -370,7 +368,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -370,7 +368,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardPCL812PG, .board_type = boardPCL812PG,
.n_aichan = 16, .n_aichan = 16,
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_pcl812pg_ai, .rangelist_ai = &range_pcl812pg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -381,7 +378,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -381,7 +378,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardACL8112, .board_type = boardACL8112,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_acl8112dg_ai, .rangelist_ai = &range_acl8112dg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -393,7 +389,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -393,7 +389,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardACL8112, .board_type = boardACL8112,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_acl8112hg_ai, .rangelist_ai = &range_acl8112hg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -405,7 +400,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -405,7 +400,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardA821, .board_type = boardA821,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 1, .n_aochan = 1,
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_pcl813b_ai, .rangelist_ai = &range_pcl813b_ai,
.IRQbits = 0x000c, .IRQbits = 0x000c,
...@@ -414,7 +408,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -414,7 +408,6 @@ static const struct pcl812_board boardtypes[] = {
.name = "a821pglnda", .name = "a821pglnda",
.board_type = boardA821, .board_type = boardA821,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_pcl813b_ai, .rangelist_ai = &range_pcl813b_ai,
.IRQbits = 0x000c, .IRQbits = 0x000c,
...@@ -423,7 +416,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -423,7 +416,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardA821, .board_type = boardA821,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 1, .n_aochan = 1,
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_a821pgh_ai, .rangelist_ai = &range_a821pgh_ai,
.IRQbits = 0x000c, .IRQbits = 0x000c,
...@@ -433,7 +425,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -433,7 +425,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardACL8112, .board_type = boardACL8112,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_acl8112dg_ai, .rangelist_ai = &range_acl8112dg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -444,7 +435,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -444,7 +435,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardACL8112, .board_type = boardACL8112,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_acl8112hg_ai, .rangelist_ai = &range_acl8112hg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -455,7 +445,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -455,7 +445,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardACL8112, .board_type = boardACL8112,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 8000, .ai_ns_min = 8000,
.rangelist_ai = &range_acl8112dg_ai, .rangelist_ai = &range_acl8112dg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -466,7 +455,6 @@ static const struct pcl812_board boardtypes[] = { ...@@ -466,7 +455,6 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardACL8112, .board_type = boardACL8112,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0x0fff,
.ai_ns_min = 8000, .ai_ns_min = 8000,
.rangelist_ai = &range_acl8112hg_ai, .rangelist_ai = &range_acl8112hg_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
...@@ -476,36 +464,32 @@ static const struct pcl812_board boardtypes[] = { ...@@ -476,36 +464,32 @@ static const struct pcl812_board boardtypes[] = {
.name = "pcl813", .name = "pcl813",
.board_type = boardPCL813, .board_type = boardPCL813,
.n_aichan = 32, .n_aichan = 32,
.ai_maxdata = 0x0fff,
.rangelist_ai = &range_pcl813b_ai, .rangelist_ai = &range_pcl813b_ai,
}, { }, {
.name = "pcl813b", .name = "pcl813b",
.board_type = boardPCL813B, .board_type = boardPCL813B,
.n_aichan = 32, .n_aichan = 32,
.ai_maxdata = 0x0fff,
.rangelist_ai = &range_pcl813b_ai, .rangelist_ai = &range_pcl813b_ai,
}, { }, {
.name = "acl8113", .name = "acl8113",
.board_type = boardACL8113, .board_type = boardACL8113,
.n_aichan = 32, .n_aichan = 32,
.ai_maxdata = 0x0fff,
.rangelist_ai = &range_acl8113_1_ai, .rangelist_ai = &range_acl8113_1_ai,
}, { }, {
.name = "iso813", .name = "iso813",
.board_type = boardISO813, .board_type = boardISO813,
.n_aichan = 32, .n_aichan = 32,
.ai_maxdata = 0x0fff,
.rangelist_ai = &range_iso813_1_ai, .rangelist_ai = &range_iso813_1_ai,
}, { }, {
.name = "acl8216", .name = "acl8216",
.board_type = boardACL8216, .board_type = boardACL8216,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0xffff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_pcl813b2_ai, .rangelist_ai = &range_pcl813b2_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
.has_dma = 1, .has_dma = 1,
.has_16bit_ai = 1,
.has_mpc508_mux = 1, .has_mpc508_mux = 1,
.has_dio = 1, .has_dio = 1,
}, { }, {
...@@ -513,11 +497,11 @@ static const struct pcl812_board boardtypes[] = { ...@@ -513,11 +497,11 @@ static const struct pcl812_board boardtypes[] = {
.board_type = boardACL8216, .board_type = boardACL8216,
.n_aichan = 16, /* 8 differential */ .n_aichan = 16, /* 8 differential */
.n_aochan = 2, .n_aochan = 2,
.ai_maxdata = 0xffff,
.ai_ns_min = 10000, .ai_ns_min = 10000,
.rangelist_ai = &range_pcl813b2_ai, .rangelist_ai = &range_pcl813b2_ai,
.IRQbits = 0xdcfc, .IRQbits = 0xdcfc,
.has_dma = 1, .has_dma = 1,
.has_16bit_ai = 1,
.has_dio = 1, .has_dio = 1,
}, },
}; };
...@@ -1446,7 +1430,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1446,7 +1430,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->subdev_flags |= SDF_GROUND; s->subdev_flags |= SDF_GROUND;
s->n_chan = board->n_aichan; s->n_chan = board->n_aichan;
} }
s->maxdata = board->ai_maxdata; s->maxdata = board->has_16bit_ai ? 0xffff : 0x0fff;
pcl812_set_ai_range_table(dev, s, it); pcl812_set_ai_range_table(dev, s, it);
......
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