summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/dt282x.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-06-20 13:13:01 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-26 20:08:20 -0400
commitc50d32de3707ee8165eaeaa319c5c13d12ea0669 (patch)
treeec185f44191adb1564f441bbbf53c6b4485ce0b8 /drivers/staging/comedi/drivers/dt282x.c
parent0f8e8c5ab67a818ad56291007796d17f16d0fd6a (diff)
staging: comedi: dt282x: fix bug where DIO direction is reset to inputs
The direction of the 16 DIO channels is controlled with two bits in the DACSR register. The HBOE bit controls the direction of channels 15-8 and the LBOE bit channels 7-0. The DACSR register is also used to control the Analog Output async command support. Currently, starting or canceling an Analog Output command would also reset the DIO directions so that all channels were inputs. Fix the driver so that the DIO direction is not changed when starting or canceling an Analog Output async command. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/dt282x.c')
-rw-r--r--drivers/staging/comedi/drivers/dt282x.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c
index 6e813bb562e8..e30a0646f4f1 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -993,9 +993,12 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
outw(devpriv->divisor, dev->iobase + DT2821_TMRCTR_REG);
- devpriv->dacsr = DT2821_DACSR_SSEL |
- DT2821_DACSR_DACLK |
- DT2821_DACSR_IDARDY;
+ /* clear all bits but the DIO direction bits */
+ devpriv->dacsr &= (DT2821_DACSR_LBOE | DT2821_DACSR_HBOE);
+
+ devpriv->dacsr |= (DT2821_DACSR_SSEL |
+ DT2821_DACSR_DACLK |
+ DT2821_DACSR_IDARDY);
outw(devpriv->dacsr, dev->iobase + DT2821_DACSR_REG);
s->async->inttrig = dt282x_ao_inttrig;
@@ -1010,7 +1013,9 @@ static int dt282x_ao_cancel(struct comedi_device *dev,
dt282x_disable_dma(dev);
- devpriv->dacsr = 0;
+ /* clear all bits but the DIO direction bits */
+ devpriv->dacsr &= (DT2821_DACSR_LBOE | DT2821_DACSR_HBOE);
+
outw(devpriv->dacsr, dev->iobase + DT2821_DACSR_REG);
devpriv->supcsr = 0;