aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <[email protected]>2014-11-11 16:55:40 -0700
committerGreg Kroah-Hartman <[email protected]>2014-11-26 15:33:25 -0800
commit4b82531e27c017d3e1a231fa9f87c5dd1bcda6fc (patch)
tree97a14c62b8e9fcb14eb70f6e39a7212e0b836611
parentd900a48841091e07d34d26a7cb7b29ce0447752c (diff)
staging: comedi: dmm32at: rename DMM32AT_AISTAT
For aesthetics, rename this define used for the A/D Status register. Also, rename the defines for the bits of the register. The probe code in dmm32at_reset() checks this register to make sure the S/D1 and S/D0 bits are set. This check actually verifies that the board is configured (with jumpers on the board) with all the Analog Input channels operating in single-ended mode. Add a comment about this. Signed-off-by: H Hartley Sweeten <[email protected]> Reviewed-by: Ian Abbott <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/comedi/drivers/dmm32at.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
index 4ebbd98e333d..3f36f0ebf3a9 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -80,7 +80,11 @@ Configuration Options:
#define DMM32AT_CTRL_PAGE_8254 (0 << 0)
#define DMM32AT_CTRL_PAGE_8255 (1 << 0)
#define DMM32AT_CTRL_PAGE_CALIB (3 << 0)
-#define DMM32AT_AISTAT 0x08
+#define DMM32AT_AI_STATUS_REG 0x08
+#define DMM32AT_AI_STATUS_STS (1 << 7)
+#define DMM32AT_AI_STATUS_SD1 (1 << 6)
+#define DMM32AT_AI_STATUS_SD0 (1 << 5)
+#define DMM32AT_AI_STATUS_ADCH_MASK (0x1f << 0)
#define DMM32AT_INTCLOCK 0x09
@@ -97,9 +101,6 @@ Configuration Options:
/* Board register values. */
-/* DMM32AT_AISTAT 0x08 */
-#define DMM32AT_STATUS 0x80
-
/* DMM32AT_INTCLOCK 0x09 */
#define DMM32AT_ADINT 0x80
#define DMM32AT_CLKSEL 0x03
@@ -190,7 +191,7 @@ static int dmm32at_ai_status(struct comedi_device *dev,
unsigned char status;
status = inb(dev->iobase + context);
- if ((status & DMM32AT_STATUS) == 0)
+ if ((status & DMM32AT_AI_STATUS_STS) == 0)
return 0;
return -EBUSY;
}
@@ -214,7 +215,7 @@ static int dmm32at_ai_insn_read(struct comedi_device *dev,
outb(0xff, dev->iobase + DMM32AT_AI_START_CONV_REG);
ret = comedi_timeout(dev, s, insn, dmm32at_ai_status,
- DMM32AT_AISTAT);
+ DMM32AT_AI_STATUS_REG);
if (ret)
return ret;
@@ -514,13 +515,19 @@ static int dmm32at_reset(struct comedi_device *dev)
ailo = inb(dev->iobase + DMM32AT_AI_LO_CHAN_REG);
aihi = inb(dev->iobase + DMM32AT_AI_HI_CHAN_REG);
fifostat = inb(dev->iobase + DMM32AT_FIFO_STATUS_REG);
- aistat = inb(dev->iobase + DMM32AT_AISTAT);
+ aistat = inb(dev->iobase + DMM32AT_AI_STATUS_REG);
intstat = inb(dev->iobase + DMM32AT_INTCLOCK);
airback = inb(dev->iobase + DMM32AT_AIRBACK);
+ /*
+ * NOTE: The (DMM32AT_AI_STATUS_SD1 | DMM32AT_AI_STATUS_SD0)
+ * test makes this driver only work if the board is configured
+ * with all A/D channels set for single-ended operation.
+ */
if (ailo != 0x00 || aihi != 0x1f ||
fifostat != DMM32AT_FIFO_STATUS_EF ||
- aistat != 0x60 || intstat != 0x00 || airback != 0x0c)
+ aistat != (DMM32AT_AI_STATUS_SD1 | DMM32AT_AI_STATUS_SD0) ||
+ intstat != 0x00 || airback != 0x0c)
return -EIO;
return 0;