diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-08-17 16:58:14 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-12 18:24:20 -0700 |
commit | abbb6489090255290d0bc24f1bf9eeba26b595de (patch) | |
tree | 4695f2192199f055d092e3075064ece8861876a6 | |
parent | 088c1ce04dacc3374335ce8b23666a9f8aa5d85c (diff) |
staging: comedi: s526: define the DAC (analog output) control register and bits
Define this register and its bits and remove the magic numbers.
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>
-rw-r--r-- | drivers/staging/comedi/drivers/s526.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index df463a22fa7e..e71d850da882 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -56,7 +56,10 @@ #define S526_WDOG_INVERTED BIT(4) #define S526_WDOG_ENA BIT(3) #define S526_WDOG_INTERVAL(x) (((x) & 0x7) << 0) -#define REG_DAC 0x04 +#define S526_AO_CTRL_REG 0x04 +#define S526_AO_CTRL_RESET BIT(3) +#define S526_AO_CTRL_CHAN(x) (((x) & 0x3) << 1) +#define S526_AO_CTRL_START BIT(0) #define REG_ADC 0x06 #define REG_ADD 0x08 #define REG_DIO 0x0A @@ -452,16 +455,17 @@ static int s526_ao_insn_write(struct comedi_device *dev, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int ctrl = S526_AO_CTRL_CHAN(chan); unsigned int val = s->readback[chan]; int i; - outw(chan << 1, dev->iobase + REG_DAC); + outw(ctrl, dev->iobase + S526_AO_CTRL_REG); + ctrl |= S526_AO_CTRL_START; for (i = 0; i < insn->n; i++) { val = data[i]; outw(val, dev->iobase + REG_ADD); - /* starts the D/A conversion */ - outw((chan << 1) | 1, dev->iobase + REG_DAC); + outw(ctrl, dev->iobase + S526_AO_CTRL_REG); } s->readback[chan] = val; |