Commit 99104f62 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: me_daq: use comedi_range_is_bipolar() helper

Use the helper function to determine if the dac bipolar bit needs
to be set.
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 46ada8af
......@@ -94,7 +94,6 @@
#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 */
......@@ -321,9 +320,8 @@ static int me_ao_insn_write(struct comedi_device *dev,
/* Set dac-control register */
devpriv->dac_ctrl &= ~ME_DAC_CTRL_MASK(chan);
if (range == 0)
devpriv->dac_ctrl |= ME_DAC_CTRL_GAIN(chan) |
ME_DAC_CTRL_BIPOLAR(chan);
else if (range == 1)
devpriv->dac_ctrl |= ME_DAC_CTRL_GAIN(chan);
if (comedi_range_is_bipolar(s, range))
devpriv->dac_ctrl |= ME_DAC_CTRL_BIPOLAR(chan);
writew(devpriv->dac_ctrl, dev->mmio + ME_DAC_CTRL_REG);
......
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