From: H Hartley Sweeten Date: Mon, 20 Oct 2014 18:34:21 +0000 (-0700) Subject: staging: comedi: addi_apci_3120: provide analog output 'readback' X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=bf34c2262270bc4d7e1d7747a15675942a5dd9c4;p=openwrt%2Fstaging%2Fblogic.git staging: comedi: addi_apci_3120: provide analog output 'readback' Use the comedi_subdevice 'readback' member and the core provided (*insn_read) function to provide radback of the analog output channels. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 47b1741758d1..c093cd4bce3d 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1924,6 +1924,8 @@ static int apci3120_ao_insn_write(struct comedi_device *dev, outw(APCI3120_AO_MUX(chan) | APCI3120_AO_DATA(val), dev->iobase + APCI3120_AO_REG(chan)); + + s->readback[chan] = val; } return insn->n; diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index abc85bf000ff..5db52cd04319 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -195,6 +195,11 @@ static int apci3120_auto_attach(struct comedi_device *dev, s->maxdata = 0x3fff; s->range_table = &range_bipolar10; s->insn_write = apci3120_ao_insn_write; + s->insn_read = comedi_readback_insn_read; + + ret = comedi_alloc_subdev_readback(s); + if (ret) + return ret; } else { s->type = COMEDI_SUBD_UNUSED; }