The unmunged data should be saved for readback not the munged data.
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>
unsigned int chan = CR_CHAN(insn->chanspec);
int reg_lo = chan ? RTI800_DAC1LO : RTI800_DAC0LO;
int reg_hi = chan ? RTI800_DAC1HI : RTI800_DAC0HI;
- int val = devpriv->ao_readback[chan];
int i;
for (i = 0; i < insn->n; i++) {
- val = data[i];
+ unsigned int val = data[i];
+
+ devpriv->ao_readback[chan] = val;
+
if (devpriv->dac_2comp[chan])
val ^= 0x800;
outb((val >> 8) & 0xff, dev->iobase + reg_hi);
}
- devpriv->ao_readback[chan] = val;
-
return insn->n;
}