diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2017-01-04 10:55:45 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-10 17:38:32 +0100 |
commit | ca685dc914ad5e3591cef794064fdd9810fa3bc2 (patch) | |
tree | ddc02c7bebbaa1287f2c6d732901a2dad6153744 /drivers/staging/comedi/drivers | |
parent | staging: comedi: daqboard2000: use designated initializers (diff) | |
download | linux-dev-ca685dc914ad5e3591cef794064fdd9810fa3bc2.tar.xz linux-dev-ca685dc914ad5e3591cef794064fdd9810fa3bc2.zip |
staging: comedi: daqboard2000: support 4 AO channels
The driver supports DaqBoard/2000 and DaqBoard/2001. DaqBoard/2000 has 2
AO channels, but DaqBoard/2001 has 4 AO channels. The driver currently
only supports 2 AO channels, but supporting 4 channels is just a case of
setting the `n_chan` member of the COMEDI subdevice to 4 instead of 2.
Add a new boolean flag member `has_2_ao` to `struct db2k_boardtype` to
be set to `true` if the board only has 2 AO channels. Set this to
`true` in the element of `db2k_boardtypes[]` that corresponds to the
DaqBoard/2000. Use it in `db2k_auto_attach()` to initialize the number
of AO channels to 2 or 4, as appropriate.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers')
-rw-r--r-- | drivers/staging/comedi/drivers/daqboard2000.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 18933c2565d9..8f0325ef0012 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -114,7 +114,7 @@ #define DB2K_FIRMWARE "daqboard2000_firmware.bin" #define DB2K_SUBSYSTEM_IDS2 0x0002 /* Daqboard/2000 - 2 Dacs */ -#define DB2K_SUBSYSTEM_IDS4 0x0004 /* Daqboard/2000 - 4 Dacs */ +#define DB2K_SUBSYSTEM_IDS4 0x0004 /* Daqboard/2001 - 4 Dacs */ static const struct comedi_lrange db2k_ai_range = { 13, { @@ -248,12 +248,14 @@ static const struct comedi_lrange db2k_ai_range = { struct db2k_boardtype { const char *name; int id; + bool has_2_ao:1; /* false: 4 AO chans; true: 2 AO chans */ }; static const struct db2k_boardtype db2k_boardtypes[] = { { .name = "ids2", .id = DB2K_SUBSYSTEM_IDS2, + .has_2_ao = true, }, { .name = "ids4", @@ -758,7 +760,7 @@ static int db2k_auto_attach(struct comedi_device *dev, /* ao subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; + s->n_chan = board->has_2_ao ? 2 : 4; s->maxdata = 0xffff; s->insn_write = db2k_ao_insn_write; s->range_table = &range_bipolar10; |