staging: comedi: addi_apci_2200: cleanup digital input subdevice
The board supported by this driver always has a digital input subdevice. Remove the boardinfo for it and just open-code the relevant data in the subdevice init. Remove the SDF_GROUND and SDF_COMMON from the subdevice 'subdev_flags'. These flags only have meaning for analog input/output subdevices. Remove the subdevice 'len_chanlist' initialization. This variable only has meaning for subdevices that support asynchronous commands. Remove the subdevice 'io_bits' initialization. Digital input subdevices don't use this variable. Remove the subdevice function pointers that evaluate to NULL based on the boardinfo data. Move the apci2200_di_insn_bits() function from the hwdrv_apci2200.c file into the main driver file. For aesthetic reasons, rename the #define used for the register used to read the digital inputs. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
903b6c94bb
commit
41542073f5
2 changed files with 22 additions and 28 deletions
|
@ -51,7 +51,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
|
||||||
/* DIGITAL INPUT-OUTPUT DEFINE */
|
/* DIGITAL INPUT-OUTPUT DEFINE */
|
||||||
|
|
||||||
#define APCI2200_DIGITAL_OP 4
|
#define APCI2200_DIGITAL_OP 4
|
||||||
#define APCI2200_DIGITAL_IP 0
|
|
||||||
|
|
||||||
/* TIMER COUNTER WATCHDOG DEFINES */
|
/* TIMER COUNTER WATCHDOG DEFINES */
|
||||||
|
|
||||||
|
@ -60,16 +59,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
|
||||||
#define APCI2200_WATCHDOG_RELOAD_VALUE 4
|
#define APCI2200_WATCHDOG_RELOAD_VALUE 4
|
||||||
#define APCI2200_WATCHDOG_STATUS 16
|
#define APCI2200_WATCHDOG_STATUS 16
|
||||||
|
|
||||||
static int apci2200_di_insn_bits(struct comedi_device *dev,
|
|
||||||
struct comedi_subdevice *s,
|
|
||||||
struct comedi_insn *insn,
|
|
||||||
unsigned int *data)
|
|
||||||
{
|
|
||||||
data[1] = inw(dev->iobase + APCI2200_DIGITAL_IP);
|
|
||||||
|
|
||||||
return insn->n;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int apci2200_do_insn_bits(struct comedi_device *dev,
|
static int apci2200_do_insn_bits(struct comedi_device *dev,
|
||||||
struct comedi_subdevice *s,
|
struct comedi_subdevice *s,
|
||||||
struct comedi_insn *insn,
|
struct comedi_insn *insn,
|
||||||
|
|
|
@ -5,15 +5,18 @@
|
||||||
|
|
||||||
#include "addi-data/hwdrv_apci2200.c"
|
#include "addi-data/hwdrv_apci2200.c"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* I/O Register Map
|
||||||
|
*/
|
||||||
|
#define APCI2200_DI_REG 0x00
|
||||||
|
|
||||||
static const struct addi_board apci2200_boardtypes[] = {
|
static const struct addi_board apci2200_boardtypes[] = {
|
||||||
{
|
{
|
||||||
.pc_DriverName = "apci2200",
|
.pc_DriverName = "apci2200",
|
||||||
.i_VendorId = PCI_VENDOR_ID_ADDIDATA,
|
.i_VendorId = PCI_VENDOR_ID_ADDIDATA,
|
||||||
.i_DeviceId = 0x1005,
|
.i_DeviceId = 0x1005,
|
||||||
.i_NbrDiChannel = 8,
|
|
||||||
.i_NbrDoChannel = 16,
|
.i_NbrDoChannel = 16,
|
||||||
.i_Timer = 1,
|
.i_Timer = 1,
|
||||||
.di_bits = apci2200_di_insn_bits,
|
|
||||||
.do_bits = apci2200_do_insn_bits,
|
.do_bits = apci2200_do_insn_bits,
|
||||||
.timer_config = i_APCI2200_ConfigWatchdog,
|
.timer_config = i_APCI2200_ConfigWatchdog,
|
||||||
.timer_write = i_APCI2200_StartStopWriteWatchdog,
|
.timer_write = i_APCI2200_StartStopWriteWatchdog,
|
||||||
|
@ -21,6 +24,16 @@ static const struct addi_board apci2200_boardtypes[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int apci2200_di_insn_bits(struct comedi_device *dev,
|
||||||
|
struct comedi_subdevice *s,
|
||||||
|
struct comedi_insn *insn,
|
||||||
|
unsigned int *data)
|
||||||
|
{
|
||||||
|
data[1] = inw(dev->iobase + APCI2200_DI_REG);
|
||||||
|
|
||||||
|
return insn->n;
|
||||||
|
}
|
||||||
|
|
||||||
static int apci2200_reset(struct comedi_device *dev)
|
static int apci2200_reset(struct comedi_device *dev)
|
||||||
{
|
{
|
||||||
outw(0x0, dev->iobase + APCI2200_DIGITAL_OP);
|
outw(0x0, dev->iobase + APCI2200_DIGITAL_OP);
|
||||||
|
@ -92,21 +105,13 @@ static int apci2200_auto_attach(struct comedi_device *dev,
|
||||||
|
|
||||||
/* Allocate and Initialise DI Subdevice Structures */
|
/* Allocate and Initialise DI Subdevice Structures */
|
||||||
s = &dev->subdevices[2];
|
s = &dev->subdevices[2];
|
||||||
if (this_board->i_NbrDiChannel) {
|
s->type = COMEDI_SUBD_DI;
|
||||||
s->type = COMEDI_SUBD_DI;
|
s->subdev_flags = SDF_READABLE;
|
||||||
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON;
|
s->n_chan = 8;
|
||||||
s->n_chan = this_board->i_NbrDiChannel;
|
s->maxdata = 1;
|
||||||
s->maxdata = 1;
|
s->range_table = &range_digital;
|
||||||
s->len_chanlist = this_board->i_NbrDiChannel;
|
s->insn_bits = apci2200_di_insn_bits;
|
||||||
s->range_table = &range_digital;
|
|
||||||
s->io_bits = 0; /* all bits input */
|
|
||||||
s->insn_config = this_board->di_config;
|
|
||||||
s->insn_read = this_board->di_read;
|
|
||||||
s->insn_write = this_board->di_write;
|
|
||||||
s->insn_bits = this_board->di_bits;
|
|
||||||
} else {
|
|
||||||
s->type = COMEDI_SUBD_UNUSED;
|
|
||||||
}
|
|
||||||
/* Allocate and Initialise DO Subdevice Structures */
|
/* Allocate and Initialise DO Subdevice Structures */
|
||||||
s = &dev->subdevices[3];
|
s = &dev->subdevices[3];
|
||||||
if (this_board->i_NbrDoChannel) {
|
if (this_board->i_NbrDoChannel) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue