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

staging: comedi: me_daq: simplify analog output boardinfo

The boards supported by this driver either have analog outputs or don't
have them. Add a new boardinfo value, 'has_ao', to indicate this.

The boards that have analog outputs always have 4, 12-bit channels. Remove
the unnecessary boardinfo and just open-code the values in the subdevice
initialization.

The boards with analog outputs also share the same output range capabilities.
Rename the comedi_lrange to make it common for all board types.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fa8eec60
...@@ -139,7 +139,7 @@ static const struct comedi_lrange me_ai_range = { ...@@ -139,7 +139,7 @@ static const struct comedi_lrange me_ai_range = {
} }
}; };
static const struct comedi_lrange me2600_ao_range = { static const struct comedi_lrange me_ao_range = {
3, { 3, {
BIP_RANGE(10), BIP_RANGE(10),
BIP_RANGE(5), BIP_RANGE(5),
...@@ -150,18 +150,14 @@ static const struct comedi_lrange me2600_ao_range = { ...@@ -150,18 +150,14 @@ static const struct comedi_lrange me2600_ao_range = {
struct me_board { struct me_board {
const char *name; const char *name;
int device_id; int device_id;
int ao_chans; int has_ao;
int ao_bits;
const struct comedi_lrange *ao_range;
}; };
static const struct me_board me_boards[] = { static const struct me_board me_boards[] = {
{ {
.name = "me-2600i", .name = "me-2600i",
.device_id = ME2600_DEVICE_ID, .device_id = ME2600_DEVICE_ID,
.ao_chans = 4, .has_ao = 1,
.ao_bits = 12,
.ao_range = &me2600_ao_range,
}, { }, {
.name = "me-2000i", .name = "me-2000i",
.device_id = ME2000_DEVICE_ID, .device_id = ME2000_DEVICE_ID,
...@@ -631,13 +627,13 @@ static int me_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev) ...@@ -631,13 +627,13 @@ static int me_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
s->insn_read = me_ai_insn_read; s->insn_read = me_ai_insn_read;
s = &dev->subdevices[1]; s = &dev->subdevices[1];
if (board->ao_chans) { if (board->has_ao) {
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITEABLE | SDF_COMMON; s->subdev_flags = SDF_WRITEABLE | SDF_COMMON;
s->n_chan = board->ao_chans; s->n_chan = 4;
s->maxdata = (1 << board->ao_bits) - 1; s->maxdata = 0x0fff;
s->len_chanlist = board->ao_chans; s->len_chanlist = 4;
s->range_table = board->ao_range; s->range_table = &me_ao_range;
s->insn_read = me_ao_insn_read; s->insn_read = me_ao_insn_read;
s->insn_write = me_ao_insn_write; s->insn_write = me_ao_insn_write;
} else { } else {
......
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