Commit 51fd3673 authored by Spencer E. Olson's avatar Spencer E. Olson Committed by Greg Kroah-Hartman

staging: comedi: ni_mio_common: implement INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS

Adds implementation of the new INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS
instruction.  This patch also adds data for digital subdevices that are
streaming capable (within the ni_mio_* family).  Mostly, only the m-series
devices are capable of digital streaming.
Signed-off-by: default avatarSpencer E. Olson <olsonse@umich.edu>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 832f3336
...@@ -2464,6 +2464,7 @@ static int ni_ai_insn_config(struct comedi_device *dev, ...@@ -2464,6 +2464,7 @@ static int ni_ai_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
const struct ni_board_struct *board = dev->board_ptr;
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
if (insn->n < 1) if (insn->n < 1)
...@@ -2498,6 +2499,15 @@ static int ni_ai_insn_config(struct comedi_device *dev, ...@@ -2498,6 +2499,15 @@ static int ni_ai_insn_config(struct comedi_device *dev,
} }
} }
return 2; return 2;
case INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS:
/* we don't care about actual channels */
/* data[3] : chanlist_len */
data[1] = ni_min_ai_scan_period_ns(dev, data[3]);
if (devpriv->is_611x || devpriv->is_6143)
data[2] = 0; /* simultaneous output */
else
data[2] = board->ai_speed;
return 0;
default: default:
break; break;
} }
...@@ -2834,6 +2844,11 @@ static int ni_ao_insn_config(struct comedi_device *dev, ...@@ -2834,6 +2844,11 @@ static int ni_ao_insn_config(struct comedi_device *dev,
return 0; return 0;
case INSN_CONFIG_ARM: case INSN_CONFIG_ARM:
return ni_ao_arm(dev, s); return ni_ao_arm(dev, s);
case INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS:
/* we don't care about actual channels */
data[1] = board->ao_speed;
data[2] = 0;
return 0;
default: default:
break; break;
} }
...@@ -3475,6 +3490,15 @@ static int ni_m_series_dio_insn_config(struct comedi_device *dev, ...@@ -3475,6 +3490,15 @@ static int ni_m_series_dio_insn_config(struct comedi_device *dev,
{ {
int ret; int ret;
if (data[0] == INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS) {
const struct ni_board_struct *board = dev->board_ptr;
/* we don't care about actual channels */
data[1] = board->dio_speed;
data[2] = 0;
return 0;
}
ret = comedi_dio_insn_config(dev, s, insn, data, 0); ret = comedi_dio_insn_config(dev, s, insn, data, 0);
if (ret) if (ret)
return ret; return ret;
......
...@@ -693,6 +693,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -693,6 +693,7 @@ static const struct ni_board_struct ni_boards[] = {
.ai_speed = 4000, .ai_speed = 4000,
.reg_type = ni_reg_622x, .reg_type = ni_reg_622x,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PCI6221] = { [BOARD_PCI6221] = {
.name = "pci-6221", .name = "pci-6221",
...@@ -708,6 +709,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -708,6 +709,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x, .reg_type = ni_reg_622x,
.ao_speed = 1200, .ao_speed = 1200,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PCI6221_37PIN] = { [BOARD_PCI6221_37PIN] = {
.name = "pci-6221_37pin", .name = "pci-6221_37pin",
...@@ -738,6 +740,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -738,6 +740,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x, .reg_type = ni_reg_622x,
.ao_speed = 1200, .ao_speed = 1200,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PCI6224] = { [BOARD_PCI6224] = {
.name = "pci-6224", .name = "pci-6224",
...@@ -749,6 +752,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -749,6 +752,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x, .reg_type = ni_reg_622x,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PXI6224] = { [BOARD_PXI6224] = {
.name = "pxi-6224", .name = "pxi-6224",
...@@ -760,6 +764,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -760,6 +764,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x, .reg_type = ni_reg_622x,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PCI6225] = { [BOARD_PCI6225] = {
.name = "pci-6225", .name = "pci-6225",
...@@ -776,6 +781,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -776,6 +781,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 1200, .ao_speed = 1200,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PXI6225] = { [BOARD_PXI6225] = {
.name = "pxi-6225", .name = "pxi-6225",
...@@ -792,6 +798,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -792,6 +798,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 1200, .ao_speed = 1200,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PCI6229] = { [BOARD_PCI6229] = {
.name = "pci-6229", .name = "pci-6229",
...@@ -824,6 +831,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -824,6 +831,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 1200, .ao_speed = 1200,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 1000,
}, },
[BOARD_PCI6250] = { [BOARD_PCI6250] = {
.name = "pci-6250", .name = "pci-6250",
...@@ -844,6 +852,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -844,6 +852,7 @@ static const struct ni_board_struct ni_boards[] = {
.ai_speed = 800, .ai_speed = 800,
.reg_type = ni_reg_625x, .reg_type = ni_reg_625x,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6251] = { [BOARD_PCI6251] = {
.name = "pci-6251", .name = "pci-6251",
...@@ -859,6 +868,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -859,6 +868,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x, .reg_type = ni_reg_625x,
.ao_speed = 350, .ao_speed = 350,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PXI6251] = { [BOARD_PXI6251] = {
.name = "pxi-6251", .name = "pxi-6251",
...@@ -874,6 +884,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -874,6 +884,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x, .reg_type = ni_reg_625x,
.ao_speed = 350, .ao_speed = 350,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCIE6251] = { [BOARD_PCIE6251] = {
.name = "pcie-6251", .name = "pcie-6251",
...@@ -889,6 +900,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -889,6 +900,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x, .reg_type = ni_reg_625x,
.ao_speed = 350, .ao_speed = 350,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PXIE6251] = { [BOARD_PXIE6251] = {
.name = "pxie-6251", .name = "pxie-6251",
...@@ -904,6 +916,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -904,6 +916,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x, .reg_type = ni_reg_625x,
.ao_speed = 350, .ao_speed = 350,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6254] = { [BOARD_PCI6254] = {
.name = "pci-6254", .name = "pci-6254",
...@@ -926,6 +939,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -926,6 +939,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x, .reg_type = ni_reg_625x,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6259] = { [BOARD_PCI6259] = {
.name = "pci-6259", .name = "pci-6259",
...@@ -958,6 +972,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -958,6 +972,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 350, .ao_speed = 350,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCIE6259] = { [BOARD_PCIE6259] = {
.name = "pcie-6259", .name = "pcie-6259",
...@@ -990,6 +1005,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -990,6 +1005,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 350, .ao_speed = 350,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6280] = { [BOARD_PCI6280] = {
.name = "pci-6280", .name = "pci-6280",
...@@ -1012,6 +1028,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -1012,6 +1028,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_fifo_depth = 8191, .ao_fifo_depth = 8191,
.reg_type = ni_reg_628x, .reg_type = ni_reg_628x,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6281] = { [BOARD_PCI6281] = {
.name = "pci-6281", .name = "pci-6281",
...@@ -1027,6 +1044,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -1027,6 +1044,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_628x, .reg_type = ni_reg_628x,
.ao_speed = 350, .ao_speed = 350,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PXI6281] = { [BOARD_PXI6281] = {
.name = "pxi-6281", .name = "pxi-6281",
...@@ -1042,6 +1060,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -1042,6 +1060,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_628x, .reg_type = ni_reg_628x,
.ao_speed = 350, .ao_speed = 350,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6284] = { [BOARD_PCI6284] = {
.name = "pci-6284", .name = "pci-6284",
...@@ -1064,6 +1083,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -1064,6 +1083,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_628x, .reg_type = ni_reg_628x,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6289] = { [BOARD_PCI6289] = {
.name = "pci-6289", .name = "pci-6289",
...@@ -1096,6 +1116,7 @@ static const struct ni_board_struct ni_boards[] = { ...@@ -1096,6 +1116,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 350, .ao_speed = 350,
.has_32dio_chan = 1, .has_32dio_chan = 1,
.caldac = { caldac_none }, .caldac = { caldac_none },
.dio_speed = 100,
}, },
[BOARD_PCI6143] = { [BOARD_PCI6143] = {
.name = "pci-6143", .name = "pci-6143",
......
...@@ -953,6 +953,7 @@ struct ni_board_struct { ...@@ -953,6 +953,7 @@ struct ni_board_struct {
int reg_type; int reg_type;
unsigned int has_8255:1; unsigned int has_8255:1;
unsigned int has_32dio_chan:1; unsigned int has_32dio_chan:1;
unsigned int dio_speed; /* not for e-series */
enum caldac_enum caldac[3]; 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