2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 11:13:58 +08:00

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: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Spencer E. Olson 2018-09-19 10:51:04 -06:00 committed by Greg Kroah-Hartman
parent 832f33366c
commit 51fd367383
3 changed files with 46 additions and 0 deletions

View File

@ -2464,6 +2464,7 @@ static int ni_ai_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
const struct ni_board_struct *board = dev->board_ptr;
struct ni_private *devpriv = dev->private;
if (insn->n < 1)
@ -2498,6 +2499,15 @@ static int ni_ai_insn_config(struct comedi_device *dev,
}
}
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:
break;
}
@ -2834,6 +2844,11 @@ static int ni_ao_insn_config(struct comedi_device *dev,
return 0;
case INSN_CONFIG_ARM:
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:
break;
}
@ -3475,6 +3490,15 @@ static int ni_m_series_dio_insn_config(struct comedi_device *dev,
{
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);
if (ret)
return ret;

View File

@ -693,6 +693,7 @@ static const struct ni_board_struct ni_boards[] = {
.ai_speed = 4000,
.reg_type = ni_reg_622x,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PCI6221] = {
.name = "pci-6221",
@ -708,6 +709,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x,
.ao_speed = 1200,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PCI6221_37PIN] = {
.name = "pci-6221_37pin",
@ -738,6 +740,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x,
.ao_speed = 1200,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PCI6224] = {
.name = "pci-6224",
@ -749,6 +752,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PXI6224] = {
.name = "pxi-6224",
@ -760,6 +764,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_622x,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PCI6225] = {
.name = "pci-6225",
@ -776,6 +781,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 1200,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PXI6225] = {
.name = "pxi-6225",
@ -792,6 +798,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 1200,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PCI6229] = {
.name = "pci-6229",
@ -824,6 +831,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 1200,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 1000,
},
[BOARD_PCI6250] = {
.name = "pci-6250",
@ -844,6 +852,7 @@ static const struct ni_board_struct ni_boards[] = {
.ai_speed = 800,
.reg_type = ni_reg_625x,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6251] = {
.name = "pci-6251",
@ -859,6 +868,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x,
.ao_speed = 350,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PXI6251] = {
.name = "pxi-6251",
@ -874,6 +884,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x,
.ao_speed = 350,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCIE6251] = {
.name = "pcie-6251",
@ -889,6 +900,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x,
.ao_speed = 350,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PXIE6251] = {
.name = "pxie-6251",
@ -904,6 +916,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x,
.ao_speed = 350,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6254] = {
.name = "pci-6254",
@ -926,6 +939,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_625x,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6259] = {
.name = "pci-6259",
@ -958,6 +972,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 350,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCIE6259] = {
.name = "pcie-6259",
@ -990,6 +1005,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 350,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6280] = {
.name = "pci-6280",
@ -1012,6 +1028,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_fifo_depth = 8191,
.reg_type = ni_reg_628x,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6281] = {
.name = "pci-6281",
@ -1027,6 +1044,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_628x,
.ao_speed = 350,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PXI6281] = {
.name = "pxi-6281",
@ -1042,6 +1060,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_628x,
.ao_speed = 350,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6284] = {
.name = "pci-6284",
@ -1064,6 +1083,7 @@ static const struct ni_board_struct ni_boards[] = {
.reg_type = ni_reg_628x,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6289] = {
.name = "pci-6289",
@ -1096,6 +1116,7 @@ static const struct ni_board_struct ni_boards[] = {
.ao_speed = 350,
.has_32dio_chan = 1,
.caldac = { caldac_none },
.dio_speed = 100,
},
[BOARD_PCI6143] = {
.name = "pci-6143",

View File

@ -953,6 +953,7 @@ struct ni_board_struct {
int reg_type;
unsigned int has_8255:1;
unsigned int has_32dio_chan:1;
unsigned int dio_speed; /* not for e-series */
enum caldac_enum caldac[3];
};