Commit 8432eb35 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: das08: Initialize AO channels

Initialize the AO subdevice channels to mid-range data value so they are
in a known state.  This allows us to support reading back the current
value in a later patch.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3b85aa63
......@@ -391,6 +391,17 @@ static void das08_ao_set_data(struct comedi_device *dev,
}
}
static void das08_ao_initialize(struct comedi_device *dev,
struct comedi_subdevice *s)
{
int n;
unsigned int data;
data = s->maxdata / 2; /* should be about 0 volts */
for (n = 0; n < s->n_chan; n++)
das08_ao_set_data(dev, n, data);
}
static int das08_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
......@@ -665,6 +676,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
s->maxdata = (1 << thisboard->ao_nbits) - 1;
s->range_table = &range_bipolar5;
s->insn_write = das08_ao_winsn;
das08_ao_initialize(dev, s);
} else {
s->type = COMEDI_SUBD_UNUSED;
}
......
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