[PATCH 10/15] staging: comedi: ni_daq_700: tidy up daq700_ai_config()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to the programming manual, the writes in this function are
required to initialize the DAQCard-700 hardware. For aesthetics,
rename this function to clarify this.

Remove the unused comedi_subdevice parameter.

The programming manual also says that '0x34' should be written to the
counter mode register. Using the 8253.h helpers this would be I8254_MODE2.
Both mode 1 and mode 2 will set OUT0 high so there is no real difference.
But, to follow the manual, change the mode to I8254_MODE2.

For consistency, also change the mode in daq700_ai_start_conv().

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregk@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_daq_700.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c
index ad6e404..0be7312 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -159,7 +159,7 @@ static void daq700_ai_start_conv(struct comedi_device *dev)
 	i8254_set_mode(dev->iobase + DAQ700_TIMER_BASE, 0,
 		       0, I8254_MODE0 | I8254_BINARY);	/* OUT0 low */
 	i8254_set_mode(dev->iobase + DAQ700_TIMER_BASE, 0,
-		       0, I8254_MODE1 | I8254_BINARY);	/* OUT0 high */
+		       0, I8254_MODE2 | I8254_BINARY);	/* OUT0 high */
 }
 
 static void daq700_ai_flush_fifo(struct comedi_device *dev)
@@ -244,8 +244,7 @@ static int daq700_ai_insn_read(struct comedi_device *dev,
  * The analog input circuitry is initialized to channel 0.
  * The A/D FIFO is cleared.
  */
-static void daq700_ai_config(struct comedi_device *dev,
-			     struct comedi_subdevice *s)
+static void daq700_initialize(struct comedi_device *dev)
 {
 	unsigned long iobase = dev->iobase;
 
@@ -254,7 +253,7 @@ static void daq700_ai_config(struct comedi_device *dev,
 	outb(DAQ700_CMD2_ENADAQ, iobase + DAQ700_CMD2_REG);
 	outb(DAQ700_CMD3_ARNG(0), iobase + DAQ700_CMD3_REG);
 	i8254_set_mode(iobase + DAQ700_TIMER_BASE, 0,
-		       0, I8254_MODE1 | I8254_BINARY);	/* OUT0 high */
+		       0, I8254_MODE2 | I8254_BINARY);	/* OUT0 high */
 	outb(DAQ700_TIC_CLR_INT, iobase + DAQ700_TIC_REG);
 	daq700_ai_flush_fifo(dev);
 }
@@ -295,7 +294,8 @@ static int daq700_auto_attach(struct comedi_device *dev,
 	s->maxdata = (1 << 12) - 1;
 	s->range_table = &range_daq700_ai;
 	s->insn_read = daq700_ai_insn_read;
-	daq700_ai_config(dev, s);
+
+	daq700_initialize(dev);
 
 	return 0;
 }
-- 
1.9.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux