staging: comedi: ni_mio_common: make more bits in ao_cmd1 reg be stateful
authorSpencer E. Olson <olsonse@umich.edu>
Wed, 27 Jan 2016 21:28:26 +0000 (14:28 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 02:38:08 +0000 (18:38 -0800)
Bits NISTC_AO_CMD1_DAC0_UPDATE_MODE and NISTC_AO_CMD1_DAC1_UPDATE_MODE are
now saved in the local copy of the AO_CMD1 register.  This is more
appropriate than prior methods of setting these bits specifically _both_
in the ni_ao_cmd configuration function _and_ the ni_ao_inttrig trigger
function.  With this patch, the bits are only specifically called out now
in the ni_ao_cmd configuration function.  In the ni_ao_inttrig trigger
function, only the UI_ARM, UC_ARM, BC_ARM bits of the ao_cmd1 register are
specifically called out.  Each of these bits is a strobe bit, while the
DAC[0-1]_UPDATE_MODE bits are simple write bits.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_mio_common.c

index 7d2091d..9df20d9 100644 (file)
@@ -2903,8 +2903,6 @@ static int ni_ao_inttrig(struct comedi_device *dev,
        ni_stc_writew(dev, NISTC_AO_CMD1_UI_ARM |
                           NISTC_AO_CMD1_UC_ARM |
                           NISTC_AO_CMD1_BC_ARM |
-                          NISTC_AO_CMD1_DAC1_UPDATE_MODE |
-                          NISTC_AO_CMD1_DAC0_UPDATE_MODE |
                           devpriv->ao_cmd1,
                      NISTC_AO_CMD1_REG);
 
@@ -3081,9 +3079,11 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        }
        ni_stc_writew(dev, devpriv->ao_mode1, NISTC_AO_MODE1_REG);
 
-       ni_stc_writew(dev, NISTC_AO_CMD1_DAC1_UPDATE_MODE |
-                          NISTC_AO_CMD1_DAC0_UPDATE_MODE,
-                     NISTC_AO_CMD1_REG);
+       /* Configure DAQ-STC for Timed update mode */
+       devpriv->ao_cmd1 |= NISTC_AO_CMD1_DAC1_UPDATE_MODE |
+                           NISTC_AO_CMD1_DAC0_UPDATE_MODE;
+       /* We are not using UPDATE2-->don't have to set DACx_Source_Select */
+       ni_stc_writew(dev, devpriv->ao_cmd1, NISTC_AO_CMD1_REG);
 
        devpriv->ao_mode3 |= NISTC_AO_MODE3_STOP_ON_OVERRUN_ERR;
        ni_stc_writew(dev, devpriv->ao_mode3, NISTC_AO_MODE3_REG);