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: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ian Abbott 2012-08-31 20:41:43 +01:00 committed by Greg Kroah-Hartman
parent 3b85aa6378
commit 8432eb35a9
1 changed files with 12 additions and 0 deletions

View File

@ -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;
}