staging: comedi: ni_labpc_common: use subdevice readback for analog outputs
Use the comedi_subdevice 'readback' member and the core provided (*insn_read) to handle the readback of the analog output subdevice. Remove the then unused 'ao_value' member from the private 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>
This commit is contained in:
parent
8e06519b27
commit
c82f0e6b36
@ -37,8 +37,6 @@ struct labpc_boardinfo {
|
||||
struct labpc_private {
|
||||
/* number of data points left to be taken */
|
||||
unsigned long long count;
|
||||
/* software copy of analog output values */
|
||||
unsigned int ao_value[NUM_AO_CHAN];
|
||||
/* software copys of bits written to command registers */
|
||||
unsigned int cmd1;
|
||||
unsigned int cmd2;
|
||||
|
@ -927,7 +927,7 @@ static void labpc_ao_write(struct comedi_device *dev,
|
||||
devpriv->write_byte(dev, val & 0xff, DAC_LSB_REG(chan));
|
||||
devpriv->write_byte(dev, (val >> 8) & 0xff, DAC_MSB_REG(chan));
|
||||
|
||||
devpriv->ao_value[chan] = val;
|
||||
s->readback[chan] = val;
|
||||
}
|
||||
|
||||
static int labpc_ao_insn_write(struct comedi_device *dev,
|
||||
@ -966,18 +966,6 @@ static int labpc_ao_insn_write(struct comedi_device *dev,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int labpc_ao_insn_read(struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
struct comedi_insn *insn,
|
||||
unsigned int *data)
|
||||
{
|
||||
struct labpc_private *devpriv = dev->private;
|
||||
|
||||
data[0] = devpriv->ao_value[CR_CHAN(insn->chanspec)];
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* lowlevel write to eeprom/dac */
|
||||
static void labpc_serial_out(struct comedi_device *dev, unsigned int value,
|
||||
unsigned int value_width)
|
||||
@ -1301,9 +1289,12 @@ int labpc_common_attach(struct comedi_device *dev,
|
||||
s->n_chan = NUM_AO_CHAN;
|
||||
s->maxdata = 0x0fff;
|
||||
s->range_table = &range_labpc_ao;
|
||||
s->insn_read = labpc_ao_insn_read;
|
||||
s->insn_write = labpc_ao_insn_write;
|
||||
|
||||
ret = comedi_alloc_subdev_readback(s);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* initialize analog outputs to a known value */
|
||||
for (i = 0; i < s->n_chan; i++)
|
||||
labpc_ao_write(dev, s, i, s->maxdata / 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user