Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933286AbbFERfR (ORCPT ); Fri, 5 Jun 2015 13:35:17 -0400 Received: from smtp81.iad3a.emailsrvr.com ([173.203.187.81]:41150 "EHLO smtp81.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932903AbbFERbJ (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 20/32] staging: comedi: das08: replace DAS08AO_GAIN_CONTROL/STATUS Date: Fri, 5 Jun 2015 18:30:23 +0100 Message-Id: <1433525435-12986-21-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: 2272 Lines: 60 The `DAS08AO_GAIN_CONTROL` and `DAS08AO_GAIN_STATUS` macros hold the offset to the "programmable gain" register on "PGL", "PGM", "PGH", "AOL", "AOM" and "AOH" boards. Writing a code to this register sets the gain for the current analog input channel (selected in the main control register). The written value can be read back in bits 3..0 of the register. Other bits of the register are read-only and not used by the driver. Rename `DAS08AO_GAIN_CONTROL` to `DAS08_GAIN_REG` and add a comment. Remove `DAS08AO_GAIN_STATUS` as the driver does not use it and the read-only parts of the register are documented in the comment. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/das08.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 4e8756a..8aa8011 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -78,6 +78,13 @@ #define DAS08_CONTROL_DO_MASK 0xf0 /* digital outputs mask (not "JR") */ /* digital outputs (not "JR" boards) */ #define DAS08_CONTROL_DO(x) (((x) << 4) & DAS08_CONTROL_DO_MASK) +/* + * (R/W) programmable AI gain ("PGx" and "AOx" boards): + * + bits 3..0 (R/W) show/set the gain for the current AI mux channel + * + bits 6..4 (R) show the current AI mux channel + * + bit 7 (R) not unused + */ +#define DAS08_GAIN_REG 0x03 /* cio-das08jr.pdf @@ -127,9 +134,6 @@ cdef 8255 */ -#define DAS08AO_GAIN_CONTROL 3 -#define DAS08AO_GAIN_STATUS 3 - #define DAS08AO_AO_LSB(x) ((x) ? 0xa : 8) #define DAS08AO_AO_MSB(x) ((x) ? 0xb : 9) #define DAS08AO_AO_UPDATE 8 @@ -260,7 +264,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, /* set gain/range */ range = CR_RANGE(insn->chanspec); outb(devpriv->pg_gainlist[range], - dev->iobase + DAS08AO_GAIN_CONTROL); + dev->iobase + DAS08_GAIN_REG); } for (n = 0; n < insn->n; n++) { -- 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/