Commit 1750bed3 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: adl_pci9118: introduce pci9118_ai_start_conv()

Writing any value to the "software trigger" register generates a trigger
pulse to start an A/D conversion. Introduce a helper function to clarify
this. For aesthetics, rename the define used for the register.

According to the datasheet the extra delay is not needed after starting
the conversion. Remove it.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c7f499bd
......@@ -130,8 +130,8 @@
#define PCI9118_AI_CTRL_INT (1 << 1) /* 1=enable interrupt */
#define PCI9118_AI_CTRL_DMA (1 << 0) /* 1=enable DMA */
#define PCI9118_DIO_REG 0x1c
#define PCI9118_SOFTTRG_REG 0x20
#define PCI9118_SOFTTRG 0x20 /* W: soft trigger for A/D */
#define PCI9118_GAIN 0x24 /* W: A/D gain/channel register */
#define PCI9118_BURST 0x28 /* W: A/D burst number register */
#define PCI9118_SCANMOD 0x2c /* W: A/D auto scan mode */
......@@ -485,6 +485,12 @@ static int pci9118_ai_eoc(struct comedi_device *dev,
return -EBUSY;
}
static void pci9118_ai_start_conv(struct comedi_device *dev)
{
/* writing any value triggers an A/D conversion */
outl(0, dev->iobase + PCI9118_SOFTTRG_REG);
}
static int pci9118_insn_read_ai(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
......@@ -511,8 +517,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev,
outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */
for (n = 0; n < insn->n; n++) {
outl(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */
udelay(2);
pci9118_ai_start_conv(dev);
ret = comedi_timeout(dev, s, insn, pci9118_ai_eoc, 0);
if (ret) {
......
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