outw(calib_bits, devpriv->pcibar1 + PCIDAS_CALIB_REG);
}
-static void cb_pcidas_caldac_8800_write(struct comedi_device *dev,
- unsigned int chan, unsigned int val)
-{
- /* write 11-bit value to caldac */
- cb_pcidas_calib_write(dev, ((chan & 0x7) << 8) | val, 11, false);
-}
-
static int cb_pcidas_caldac_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int val = data[insn->n - 1];
if (s->readback[chan] != val) {
- cb_pcidas_caldac_8800_write(dev, chan, val);
+ /* write 11-bit channel/value to caldac */
+ cb_pcidas_calib_write(dev, (chan << 8) | val, 11,
+ false);
s->readback[chan] = val;
}
}
return insn->n;
}
-static void cb_pcidas_trimpot_7376_write(struct comedi_device *dev,
- unsigned int val)
-{
- /* write 7-bit value to trimpot */
- cb_pcidas_calib_write(dev, val, 7, true);
-}
-
-static void cb_pcidas_trimpot_8402_write(struct comedi_device *dev,
- unsigned int chan, unsigned int val)
-{
- /* write 10-bit value to trimpot */
- cb_pcidas_calib_write(dev, ((chan & 0x3) << 8) | val, 10, true);
-}
-
static void cb_pcidas_trimpot_write(struct comedi_device *dev,
unsigned int chan, unsigned int val)
{
switch (board->trimpot) {
case AD7376:
- cb_pcidas_trimpot_7376_write(dev, val);
+ /* write 7-bit value to trimpot */
+ cb_pcidas_calib_write(dev, val, 7, true);
break;
case AD8402:
- cb_pcidas_trimpot_8402_write(dev, chan, val);
+ /* write 10-bit channel/value to trimpot */
+ cb_pcidas_calib_write(dev, (chan << 8) | val, 10, true);
break;
default:
dev_err(dev->class_dev, "driver bug?\n");
return ret;
for (i = 0; i < s->n_chan; i++) {
- cb_pcidas_caldac_8800_write(dev, i, s->maxdata / 2);
- s->readback[i] = s->maxdata / 2;
+ unsigned int val = s->maxdata / 2;
+
+ /* write 11-bit channel/value to caldac */
+ cb_pcidas_calib_write(dev, (i << 8) | val, 11, false);
+ s->readback[i] = val;
}
/* Calibration subdevice - trim potentiometer */