diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-10-06 17:23:41 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-12 22:56:26 -0700 |
commit | fdfc0a0dc5aefa49cfcb853729fe505c9c27d2bc (patch) | |
tree | c3768409680d9d9827111f48f1e69611fdf9b068 | |
parent | staging: comedi: me_daq: use comedi_range_is_bipolar() helper (diff) | |
download | linux-dev-fdfc0a0dc5aefa49cfcb853729fe505c9c27d2bc.tar.xz linux-dev-fdfc0a0dc5aefa49cfcb853729fe505c9c27d2bc.zip |
staging: comedi: me_daq: tidy up dac data registers
For aesthetics, use a macro that takes the analog output channel
and returns the correct offset for the data register.
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/me_daq.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 626109070422..6b3abe3de780 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -94,10 +94,7 @@ #define ME_DAC_CTRL_GAIN(x) BIT(11 - ((x) & 0x3)) #define ME_DAC_CTRL_MASK(x) (ME_DAC_CTRL_BIPOLAR(x) | \ ME_DAC_CTRL_GAIN(x)) -#define ME_DAC_DATA_A 0x0014 /* - | W */ -#define ME_DAC_DATA_B 0x0016 /* - | W */ -#define ME_DAC_DATA_C 0x0018 /* - | W */ -#define ME_DAC_DATA_D 0x001A /* - | W */ +#define ME_AO_DATA_REG(x) (0x14 + ((x) * 2)) /* - | W */ #define ME_COUNTER_ENDDATA_A 0x001C /* - | W */ #define ME_COUNTER_ENDDATA_B 0x001E /* - | W */ #define ME_COUNTER_STARTDATA_A 0x0020 /* - | W */ @@ -332,7 +329,7 @@ static int me_ao_insn_write(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { val = data[i]; - writew(val, dev->mmio + ME_DAC_DATA_A + (chan << 1)); + writew(val, dev->mmio + ME_AO_DATA_REG(chan)); } s->readback[chan] = val; |