Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363379
b: refs/heads/master
c: 9b315bc
h: refs/heads/master
i:
  363377: f074d0a
  363375: b439860
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Mar 11, 2013
1 parent c4add86 commit 07e5223
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c0a0e0ca9523bc9ae14f7153e792885459df640e
refs/heads/master: 9b315bcb6f1d45938658dec82ee356546745b217
80 changes: 38 additions & 42 deletions trunk/drivers/staging/comedi/drivers/cb_pcidas.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,19 @@ enum trimpot_model {
AD8402,
};

enum cb_pcidas_boardid {
BOARD_PCIDAS1602_16,
BOARD_PCIDAS1200,
BOARD_PCIDAS1602_12,
BOARD_PCIDAS1200_JR,
BOARD_PCIDAS1602_16_JR,
BOARD_PCIDAS1000,
BOARD_PCIDAS1001,
BOARD_PCIDAS1002,
};

struct cb_pcidas_board {
const char *name;
unsigned short device_id;
int ai_nchan; /* Inputs in single-ended mode */
int ai_bits; /* analog input resolution */
int ai_speed; /* fastest conversion period in ns */
Expand All @@ -248,9 +258,8 @@ struct cb_pcidas_board {
};

static const struct cb_pcidas_board cb_pcidas_boards[] = {
{
[BOARD_PCIDAS1602_16] = {
.name = "pci-das1602/16",
.device_id = 0x1,
.ai_nchan = 16,
.ai_bits = 16,
.ai_speed = 5000,
Expand All @@ -262,19 +271,19 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = {
.trimpot = AD8402,
.has_dac08 = 1,
.is_1602 = 1,
}, {
},
[BOARD_PCIDAS1200] = {
.name = "pci-das1200",
.device_id = 0xF,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 3200,
.ao_nchan = 2,
.fifo_size = 1024,
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
}, {
},
[BOARD_PCIDAS1602_12] = {
.name = "pci-das1602/12",
.device_id = 0x10,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 3200,
Expand All @@ -285,18 +294,18 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = {
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
.is_1602 = 1,
}, {
},
[BOARD_PCIDAS1200_JR] = {
.name = "pci-das1200/jr",
.device_id = 0x19,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 3200,
.fifo_size = 1024,
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
}, {
},
[BOARD_PCIDAS1602_16_JR] = {
.name = "pci-das1602/16/jr",
.device_id = 0x1C,
.ai_nchan = 16,
.ai_bits = 16,
.ai_speed = 5000,
Expand All @@ -305,28 +314,28 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = {
.trimpot = AD8402,
.has_dac08 = 1,
.is_1602 = 1,
}, {
},
[BOARD_PCIDAS1000] = {
.name = "pci-das1000",
.device_id = 0x4C,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 4000,
.fifo_size = 1024,
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
}, {
},
[BOARD_PCIDAS1001] = {
.name = "pci-das1001",
.device_id = 0x1a,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 6800,
.ao_nchan = 2,
.fifo_size = 1024,
.ranges = &cb_pcidas_alt_ranges,
.trimpot = AD7376,
}, {
},
[BOARD_PCIDAS1002] = {
.name = "pci-das1002",
.device_id = 0x1b,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 6800,
Expand Down Expand Up @@ -1424,31 +1433,18 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
return IRQ_HANDLED;
}

static const void *cb_pcidas_find_boardinfo(struct comedi_device *dev,
struct pci_dev *pcidev)
{
const struct cb_pcidas_board *thisboard;
int i;

for (i = 0; i < ARRAY_SIZE(cb_pcidas_boards); i++) {
thisboard = &cb_pcidas_boards[i];
if (thisboard->device_id == pcidev->device)
return thisboard;
}
return NULL;
}

static int cb_pcidas_auto_attach(struct comedi_device *dev,
unsigned long context_unused)
unsigned long context)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct cb_pcidas_board *thisboard;
const struct cb_pcidas_board *thisboard = NULL;
struct cb_pcidas_private *devpriv;
struct comedi_subdevice *s;
int i;
int ret;

thisboard = cb_pcidas_find_boardinfo(dev, pcidev);
if (context < ARRAY_SIZE(cb_pcidas_boards))
thisboard = &cb_pcidas_boards[context];
if (!thisboard)
return -ENODEV;
dev->board_ptr = thisboard;
Expand Down Expand Up @@ -1636,14 +1632,14 @@ static int cb_pcidas_pci_probe(struct pci_dev *dev,
}

static DEFINE_PCI_DEVICE_TABLE(cb_pcidas_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0001) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x000f) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0010) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0019) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001c) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x004c) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001a) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001b) },
{ PCI_VDEVICE(CB, 0x0001), BOARD_PCIDAS1602_16 },
{ PCI_VDEVICE(CB, 0x000f), BOARD_PCIDAS1200 },
{ PCI_VDEVICE(CB, 0x0010), BOARD_PCIDAS1602_12 },
{ PCI_VDEVICE(CB, 0x0019), BOARD_PCIDAS1200_JR },
{ PCI_VDEVICE(CB, 0x001c), BOARD_PCIDAS1602_16_JR },
{ PCI_VDEVICE(CB, 0x004c), BOARD_PCIDAS1000 },
{ PCI_VDEVICE(CB, 0x001a), BOARD_PCIDAS1001 },
{ PCI_VDEVICE(CB, 0x001b), BOARD_PCIDAS1002 },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, cb_pcidas_pci_table);
Expand Down

0 comments on commit 07e5223

Please sign in to comment.