Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933001AbbFERbQ (ORCPT ); Fri, 5 Jun 2015 13:31:16 -0400 Received: from smtp81.iad3a.emailsrvr.com ([173.203.187.81]:52242 "EHLO smtp81.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932946AbbFERbJ (ORCPT ); Fri, 5 Jun 2015 13:31:09 -0400 X-Sender-Id: abbotti@mev.co.uk From: Ian Abbott To: Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten , Subject: [PATCH 19/32] staging: comedi: das08: add DAS08JR_AO_UPDATE_REG Date: Fri, 5 Jun 2015 18:30:22 +0100 Message-Id: <1433525435-12986-20-git-send-email-abbotti@mev.co.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433525435-12986-1-git-send-email-abbotti@mev.co.uk> References: <1433525435-12986-1-git-send-email-abbotti@mev.co.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2176 Lines: 51 "JR" boards with analog output channels have a jumper that controls whether analog output channels are updated simultaneously or individually. When set to update individually, individual channels are updated when the high byte register is written. When set to update simultaneously, channels are not updated until the digital inputs register is read. The driver doesn't know how the jumper is set and is not interested in the simultaneous output feature, so it updates a channel by writing the low byte, then the high byte, then reading the digital inputs register. To make the code more explicit, add a macro `DAS08JR_AO_UPDATE_REG` with the same value as the `DAS08JR_DI_REG` macro (for digital inputs) and use it when reading the register to update the analog outputs. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/das08.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 51637b1..4e8756a 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -101,6 +101,11 @@ #define DAS08JR_AO_LSB_REG(x) ((x) ? 0x06 : 0x04) /* (W) analog output m.s.b. registers for 2 channels ("JR" boards) */ #define DAS08JR_AO_MSB_REG(x) ((x) ? 0x07 : 0x05) +/* + * (R) update analog outputs ("JR" boards set for simultaneous output) + * (same register as digital inputs) + */ +#define DAS08JR_AO_UPDATE_REG 0x03 /* cio-das08_aox.pdf @@ -358,7 +363,7 @@ static void das08_ao_set_data(struct comedi_device *dev, outb(lsb, dev->iobase + DAS08JR_AO_LSB_REG(chan)); outb(msb, dev->iobase + DAS08JR_AO_MSB_REG(chan)); /* load DACs */ - inb(dev->iobase + DAS08JR_DI_REG); + inb(dev->iobase + DAS08JR_AO_UPDATE_REG); } else { outb(lsb, dev->iobase + DAS08AO_AO_LSB(chan)); outb(msb, dev->iobase + DAS08AO_AO_MSB(chan)); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/