Commit graph

6839 commits

Author SHA1 Message Date
H Hartley Sweeten 3a2cf2f971 staging: comedi: addi_apci_1564: fix counter code in main driver source
The Rev 1.0 APCI-1564 boards do not have counters.

Fix the code in the main driver source so that the I/O accesses to the
counters do not happen if the devpriv->counters member is not initialized.

This does not fix the code in hwdrv_apci1564.c. That code violates the
comedi API and is currently broken.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:33 -08:00
H Hartley Sweeten 6cf8ea2ebf staging: comedi: addi_apci_1564: fix timer iobase for all PLD revisions
The APCI-1564 has different I/O mapping depending on if the PLD revision
is Rev 1.0 or Rev 2.x.

Add a member, 'timer', to the private data for the base address of the
12-bit timer. Fix the register defines so they will work for all PLD
revisions and initialize the devpriv->timer appropriately.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:33 -08:00
H Hartley Sweeten 3743619652 staging: comedi: addi_apci_1564: fix dev->iobase for all PLD revisions
The APCI-1564 has different I/O mapping depending on if the PLD revision is
Rev 1.0 or Rev 2.x.

Fix the main register defines so they will work for all PLD revisions and
initialie the dev->iobase appropriately. Move the register defines to the
main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:33 -08:00
H Hartley Sweeten 951fd40b28 staging: comedi: addi_apci_1564: detect PLD revision for I/O mapping
The APCI-1564 has different I/O mapping depending on if the PLD revision is
Rev 1.0 or Rev 2.x. The revision can be determined by reading the EEPROM
register at offset 0x00 of PCI BAR 0 and checking the value of bits 7 to 4.

Add this check to apci1564_auto_attach(). Currently this driver is coded
to work with the Rev 2.x I/O mapping. For now, fail the attach if a Rev 1.0
PLD is detected. Document the I/O mapping for both revisions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:33 -08:00
H Hartley Sweeten 4484a23907 staging: comedi: addi_apci_1564: use dev->iobase for main registers
According to ADDI-DATA, the PLD Revision 2.x versions of the APCI-1564 use
PCI BAR 0 for the main registers of the board.

Remove the 'amcc_iobase' member of the private data and use the dev->iobase
to store the base address of PCI BAR 1.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:32 -08:00
H Hartley Sweeten 63f9c51a52 staging: comedi: addi_apci_1564: store PCI BAR 1 base address in private data
According to ADDI-DATA, only the PLD Revision 2.x versions of the APCI-1564
have the 3 counters. The base address for these counters is found in PCI BAR 1.

For aesthetics, save this base address in the private data. The dev->iobase
can then be used for the main registers of the board.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:32 -08:00
H Hartley Sweeten 950a6f8714 staging: comedi: addi_apci_1564: use correct I/O base for APCI1564_DI_INT_STATUS_REG
The APCI1564_DI_INT_STATUS_REG is located in the PCI BAR 0 I/O space. That
base address is stored in devpriv->amcc_iobase. Use that to correctly read
the register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:32 -08:00
H Hartley Sweeten aff24b9995 staging: comedi: addi_apci_1564: board does not use an AMCC PCI controller
According to ADDI-DATA, the APCI-1564 board has a FPGA with a PCI core, it
does not use an AMCC PCI controller chip.

Remove the amcc_s5933.h include as well as the read of the AMCC_OP_REG_INTCSR
register. That offset would actually read APCI1564_WDOG_STATUS_REG register
in the FPGA which has nothing to do with the interrupt status.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:31:32 -08:00
H Hartley Sweeten 34216792e0 staging: comedi: addi_apci_3120: absorb apci3120_ai_reset_fifo()
This function is only called by apci3120_set_chanlist(). Absorb it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:06 -08:00
H Hartley Sweeten c58f9bb622 staging: comedi: addi_apci_3120: enable AI async commands
The async command support should now work. Enable the hook up of the command
support functions in apci3120_auto_attach().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:06 -08:00
H Hartley Sweeten f50205f047 staging: comedi: addi_apci_3120: switch DMA buffers after writing samples
Currently the DMA buffers are switched before writing the current samples to
the async buffer. This works but when the EOA event happens we end up with an
outstanding DMA operation in progress that gets terminated by the (*cancel).

Avoid the outstanding DMA operation by switching the DMA buffers after writing
the samples. The driver will detect the EOA event and not retart the DMA.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten a93a0e9a30 staging: comedi: addi_apci_3120: change params to apci3120_interrupt_dma()
Pass the comedi_device and comedi_subdevice pointers to this function instead
of the irq number and void pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten cd68e0e2d0 staging: comedi: addi_apci_3120: move apci3120_interrupt_dma() to driver
Move this function from the included source file to the main driver
source file.

Remove the now empty included source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten c78a1f4870 staging: comedi: addi_apci_3120: use comedi_bytes_to_samples()
Use the helper function to calculate the number of samples in the DMA
buffer. For aesthetics, tidy up the local variables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten 76e6047088 staging: comedi: addi_apci_3120: move apci3120_interrupt() to driver
Move this function from the included source file to the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten 676caedabd staging: comedi: addi_apci_3120: move apci3120_cancel() to driver
Move this function from the included source file to the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten a68809bb8d staging: comedi: addi_apci_3120: use async->events to report hardware error
In apci3120_interrupt_dma(), use the async->events to report the hardware
error and allow the core to (*cancel) the command instead of calling the
(*cancel) function directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten 18e3b50367 staging: comedi: addi_apci_3120: move apci3120_ai_cmd() to driver
Move this function from the included source file to the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten 4506249228 staging: comedi: addi_apci_3120: move apci3120_setup_dma() to driver
Move this function from the included source file to the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten ee844c51ef staging: comedi: addi_apci_3120: move apci3120_init_dma() to driver
Move this function from the included source file to the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten 0b7defa702 staging: comedi: addi_apci_3120: move apci3120_addon_write() to driver
Move this function from the included source file to the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten 4ba10fc04a staging: comedi: addi_apci_3120: remove unnecessary include
The <linux/sched.h> header is not needed by this driver. Remove the
include.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten d8cdd97c8f staging: comedi: addi_apci_3120: add copyright information
Remove the copyright info from the included source file and add it
to the main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:05 -08:00
H Hartley Sweeten d32fc427e3 staging: comedi: addi_apci_3120: move AI (*do_cmdtest) to main driver
Move apci3120_ai_cmdtest() from the included source file to the main
driver source file. Tidy up Step 4 a bit during the move.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten 38417cc46f staging: comedi: addi_apci_3120: fix cmd->convert_arg vaildation
Regardless of the cmd->scan_begin_src, the minimum cmd->convert_arg
value is 10000 (10us). Fix the validation in apci3120_ai_cmdtest().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten 6d31274053 staging: comedi: addi_apci_3120: fix timer (*insn_config)
The timer subdevice in this driver does not follow the comedi API.

Fix the (*insn_config) to correctly arm, disarm, set the mode, and
get the status of the timer.

Remove the unnecessary, and broken, (*insn_write).

The new (*insn_config) does not enable the interrupt for timer 2.
Remove the interrupt support code for the timer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten 15cf0617c0 staging: comedi: addi_apci_3120: fix timer (*insn_read)
The timer subdevice in this driver does not follow the comedi API.
Fix the (*insn_read) to work correctly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten dcb5e2c4df staging: comedi: addi_apci_3120: define the AI software trigger register
Define the offset for the analog input software trigger register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten ecaf4c41da staging: comedi: addi_apci_3120: define the AI FIFO register
Define the offset for the analog input FIFO register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten 4646364cc8 staging: comedi: addi_apci_3120: don't use timer 2 to count scans
Timer 2 can be used to count the number of scans when the cmd->stop_src
is TRIG_COUNT. Unfortunately that timer can also be used by userspace and
this breaks the async command. Timer 2 also only works for counting the
number of scans when DMA is not used.

The number of scans is counted by the core using the private data membmer
'scans_done'. Use that to detect the End-Of-Scan for both DMA and none
DMA modes.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten d895948eb8 staging: comedi: addi_apci_3120: rename private data 'ui_DmaActualBuffer'
Rename this CamelCase member of the private data and convert it to
a bit-field.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten d65d73ff5e staging: comedi: addi_apci_3120: rename private data 'b_DmaDoubleBuffer'
Rename this CamelCase member of the private data and convert it to
a bit-field.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten e6539bbc17 staging: comedi: addi_apci_3120: rename private data 'us_UseDma'
Rename this CamelCase member of the private data and convert it to
a bit-field.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten ca26b42d4f staging: comedi: addi_apci_3120: move apci3120_reset() to driver source
Move this function from the included hwdrv_apci31210.c source file to
the main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten 884218c5a3 staging: comedi: addi_apci_3120: tidy up apci3120_reset()
This function is only called during the attach of the driver and it's
called after the private data has been kzalloc'd. There is no reason
to clear any of the private data members.

Simplify the function by just writing '0' to the necessary registers
to disable all the interrupt sources and stop the timers.

For aesthetics, change the return type to void.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:04 -08:00
H Hartley Sweeten 994211b6ff staging: comedi: addi_apci_3120: move DMA init code to apci3120_init_dma()
Move the common code used to initialize DMA to apci3120_init_dma().

This follows the programming procedure described in the APCI-3120
documentation.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten b7d62cf812 staging: comedi: addi_apci_3120: move APCI3120_FIFO_ADVANCE_ON_BYTE_2
Move this define to the main driver source and convert it to a bit-shift.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 0c63bd5aea staging: comedi: addi_apci_3120: define the Add-On registers
Define the add-On registers and bits and remove the "magic" numbers in the
driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 636971fc9c staging: comedi: addi_apci_3120: use amcc_s5933.h defines
Use the defines for the AMCC 5933 PCI controller registers and bits instead
of creating private defines in this driver.

Move the generic AGCSTS_TC_ENABLE define from this driver to the header.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 83bec8428a staging: comedi: addi_apci_3120: introduce apci3120_addon_write()
Introduce a helper function to handle the common code that writes a 32-bit
value to the 16-bit add-on register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 3ed69b98b9 staging: comedi: addi_apci_3120: introduce apci3120_init_dma()
Introduce a helper function to handle the common code that writes the DMA
start address and number of acquisitions to the AMCC Add-on registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 3431ec2ff5 staging: comedi: addi_apci_3120: remove private data 'b_ExttrigEnable'
This member of the private data is not really needed. The devpriv->ctrl
value can be checked to determine if the external trigger is enabled.
Remove the unnecessary member.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten b278ea3cef staging: comedi: addi_apci_3120: remove private data 'b_InterruptMode'
This member of the private data is not really needed. The interrupt mode
can be determined by checking the devpriv->mode value to see if the
interrupt is enabled. Remove the unnecessary member.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 28215c6988 staging: comedi: addi_apci_3120: tidy up devpriv->mode in apci3120_ai_cmd()
There is no reason for the separate updates of the mode register in this
function. Refactor the code so that the mode register is only updated at
the end of the function after all the necessary bits have been set.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten fdeb2f5487 staging: comedi: addi_apci_3120: enable chanlist scanning if needed
The 'SCAN_ENA' bit in the mode register needs to be set if the chanlist
has more than 1 channel. Set the bit in apci3120_set_chanlist() if needed.
The callers write the mode register after setting any additional bits,

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 1022f64e75 staging: comedi: addi_apci_3120: set scan length/start after programming chanlist
The APCI-3120 documentation says that the PR/PA bits should be set after the
chanlist sequence is programmed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 15e920fb15 staging: comedi: addi_apci_3120: reset fifo after programming chanlist
The APCI-3120 documentation says that the FIFO should be reset after the
chanlist sequence is programmed.

Reset the FIFO after programming the chanlist and remove the extra FIFO
resets in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten 502ccab2b6 staging: comedi: addi_apci_3120: tidy up timer 2 programming in apci3120_ai_cmd()
Tidy up the programming of timer 2.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:03 -08:00
H Hartley Sweeten dc0a05608d staging: comedi: addi_apci_3120: tidy up timer programming in apci3120_ai_cmd()
Tidy up the programming of timers 0 and 1 so that only one local variable is
required.

Also, remove the unnecessary clear of devpriv->timer_mode. This value will get
set correctly by each apci3120_timer_set_mode() call. It's not necessary to
clear it first.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten aaf802fb30 staging: comedi: addi_apci_3120: absorb apci3120_cyclic_ai()
This functon is called by apci3120_ai_cmd() with one additional parameter,
'mode', The 'mode' is based on the cmd->scan_begin_src.

For aesthetics, absorb the function into apci3120_ai_cmd() and use the
cmd->scan_begin_src directly to determine the 'mode'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten fb43ceaf1d staging: comedi: addi_apci_3120: move start_src check into apci3120_cyclic_ai()
For aesthetics, move the check of the cmd->start_src.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten b72b365666 staging: comedi: addi_apci_3120: move timer 2 enable in apci3120_cyclic_ai()
Move the enable of timer 2 to avoid needing the extra if() check.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten 5c66a77e1d staging: comedi: addi_apci_3120: flip 'us_UseDma' test in apci3120_cyclic_ai()
For aesthetics, flip this test and do the DMA setup first.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten 76931af200 staging: comedi: addi_apci_3120: remove APCI3120_{ENABLE,DISABLE}
These true/false defines don't add any significant clarity to the code.
Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten e451dfeb4c staging: comedi: addi_apci_3120: factor DMA setup out of apci3120_cyclic_ai()
For aesthetics, factor the DMA setup code out of apci3120_cyclic_ai().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten 169f35e82c staging: comedi: addi_apci_3120: move apci3120_set_chanlist() to driver source
Move this function from the included hwdrv_apci31210.c source file to the
main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten 0a3e518102 staging: comedi: addi_apci_3120: remove check in apci3120_setup_chan_list()
The n_chan check is not needed. This value will always be >= 1. Remove
the unnecessary check.

For aesthetics, rename the function and change it's return type to void.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten 6a51cfc62f staging: comedi: addi_apci_3120: move apci3120_ai_insn_read() to driver source
Move this function, and its helper function, from the included hwdrv_apci31210.c
source file to the main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten 5cf5fa9579 staging: comedi: addi_apci_3120: move apci3120_ao_insn_write() to driver source
Move this function, and its helper function, from the included hwdrv_apci31210.c
source file to the main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten c737b2ce4f staging: comedi: addi_apci_3120: move apci3120_di_insn_bits() to driver source
Move this function from the included hwdrv_apci31210.c source file to the main
driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:02 -08:00
H Hartley Sweeten ae12280db7 staging: comedi: addi_apci_3120: move apci3120_do_insn_bits() to driver source
Move this function from the included hwdrv_apci31210.c source file to the main
driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 196540ee44 staging: comedi: addi_apci_3120: remove private data 'ai_running'
This member of the private data was used to determine if the interrupt
routine was handling data for the (*insn_read) or an async command. Now
that the (*insn_read) does not use interrupts this member is not needed.

Remove the member and refactor the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 3da982374a staging: comedi: addi_apci_3120: define status register bits
Define the bits in the status register and use them to clarify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten b0a0d0bc58 staging: comedi: addi_apci_3120: rename APCI3120_RD_STATUS
For aesthetics, rename this define used for the status register offset.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 08595f9da2 staging: comedi: addi_apci_3120: remove private data 'ui_AiChannelList'
This member of the private data is no longer used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 2e8fcfdd05 staging: comedi: addi_apci_3120: remove private data 'ui_AiNbrofChannels'
This member of the private data is always the cmd->chanlist_len. Use that
instead and remove the member.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten bb201b94cc staging: comedi: addi_apci_3120: absorb apci3120_interrupt_handle_eos()
Absorb this simple function into apci3120_interrupt().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 89e9057b50 staging: comedi: addi_apci_3120: fix apci3120_ai_insn_read()
Now that the scanning and interrupt support have been removed from this
function it can be refactored to work correctly.

The comedi core expects (*insn_read) functions to read insn->n values
from the hardware and return the number of samples read. This function
currently just reads one sample but it returns insn->n.

Fix this function to work like the core expects.

Use comedi_timeout() to prevent a possible deadlock in the loop that
waits for the end-of-conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 22f75dac46 staging: comedi: addi_apci_3120: remove private data 'ui_AiReadData'
This member of the private data was used to return analog input samples that
were acquired for the (*insn_read) using interrupts. The interrupt support
code for the (*insn_read) has been removed. Remove this unused member from
the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten e614d17108 staging: comedi: addi_apci_3120: remove apci3120_ai_insn_config()
This function does not follow the comedi API for (*insn_config) functions.
It's also no long needed. Just remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 7ee779a237 staging: comedi: addi_apci_3120: remove interrupt support from ai (*insn_read)
(*insn_read) functions are supposed to do simple polled reads of a single
channel. This driver tries to be tricky and allow enabling interrupts in
the analog input (*insn_config) to allow the (*insn_read) to read samples
with the end-of-conversion interrupt.

The (*insn_config) doesn't follow the comedi API and this operation mode
is not part of the API.

Remove the interrupt support from the (*insn_read) as well as the support
code in the (*insn_config) and interrupt handler.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 46ad4793a7 staging: comedi: addi_apci_3120: remove private data 'ui_EocEosConversionTime'
This driver tries to be tricky and allow passing an analog input conversion time
for the (*insn_read) in the (*insn_config).  The (*insn_config) doesn't follow
the comedi API and this programmable conversion time is not part of the API for
(*insn_read) operations.

Remove the member from the private data and use a fixed 10us (10000ns) conversion
time in the (*insn_read).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten 34c0ae09a6 staging: comedi: addi_apci_3120: remove scanning from ai (*insn_read)
(*insn_read) functions are supposed to do simple polled reads of a single
channel. This driver tries to be tricky and allow passing a chanlist in
the analog input (*insn_config) to allow the (*insn_read) to do chanlist
scanning with or without interrupts.

The (*insn_config) doesn't follow the comedi API and this operation mode
is not part of the API.

Remove the scanning support from the (*insn_read) as well as the support
code in the (*insn_config) and interrupt handler.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:01 -08:00
H Hartley Sweeten aae8f725aa staging: comedi: addi_apci_3120: rename APCI3120_WRITE_MODE_SELECT
For aesthetics, rename this define used for the mode register offset.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten bd8e69e2b7 staging: comedi: addi_apci_3120: define the timer 2 clock select bits
For aesthetics, redefine the bits in the mode register used to select the
clock for timer 2.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 7cbc057d85 staging: comedi: addi_apci_3120: define the timer 2 operation bits
For aesthetics, redefine the bits in the mode register used to set the
operation mode of timer 2.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 1869ae026c staging: comedi: addi_apci_3120: define the "enable" bits in the mode register
For aesthetics, redefine the bits in the mode register that enable interrupts
and scanning.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 67d3a2e715 staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_SCAN
This define is not used in the driver. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 7a945f984d staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOS_INT
For aesthetics, remove this define and just use ~APCI3120_ENABLE_EOS_INT.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 1084dce74f staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOC_INT
For aesthetics, remove this define and just use ~APCI3120_ENABLE_EOC_INT.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 604f8e10b5 staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_INT
For aesthetics, remove this define and just use ~APCI3120_ENABLE_TIMER_INT.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten b6eb21d6df staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_WATCHDOG
For aesthetics, remove this define and just use ~APCI3120_ENABLE_WATCHDOG.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten b835aac0bd staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_COUNTER
For aesthetics, remove this define and just use ~APCI3120_ENABLE_TIMER_COUNTER.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 81ff03ba19 staging: comedi: addi_apci_3120: remove devpriv->mode '0xef' magic value
This mask value is the same as APCI3120_DISABLE_TIMER_COUNTER. Use that
instead and remove the "magic" value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 363aa5f2f4 staging: comedi: addi_apci_3120: remove unnecessary devpriv->mode masking
The devpriv->mode is set to '0' at the start of apci3120_ai_insn_read() and
apci3120_cyclic_ai(). There is no need to clear any of the bits or do any
of the additional writes of those cleared bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten 627e83a7e0 staging: comedi: addi_apci_3120: rename private data 'b_ModeSelectRegister'
Rename this CamelCase member of the private data and tidy up the mask/set
of its bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:34:00 -08:00
H Hartley Sweeten b2cf40a31d staging: comedi: addi_apci_3120: properly disable interrupts in apci3120_cancel()
The APCI3120_DISABLE_ALL_INTERRUPT define is a mask value used to clear bits
in devpriv->b_ModeSelectRegister to disable the interrupt sources. Writing this
value directly sets unintended bits.

Just set the devpriv->b_ModeSelectRegister to '0' and write that to the register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten f85c54dbe5 staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_ALL_INTERRUPT_WITHOUT_TIMER
At the start of apci3120_ai_insn_read() the devpriv->b_ModeSelectRegister is set
to '0'. Remove the unnecessary masking to clear the interrupt enable bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten 6ef6803255 staging: comedi: addi_apci_3120: move ai range table to driver source
Move the analog input comedi_lrange table from the included hwdrv_apci3120.c
source file to the main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten d0bb66aa08 staging: comedi: addi_apci_3120: introduce apci3120_ai_reset_fifo()
A dummy read of APCI3120_TIMER_MODE_REG resets the analog input FIFO. Introduce
a helper function to clarify this.

It's not necessary to do a dummy read of the FIFO (base + 0) before reseting it.
Remove the unnecessary dummy reads.

The APCI3120_TIMER_MODE_REG is a 16-bit register. This fixes a couple 8-bit reads.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten ea0bb9d221 staging: comedi: addi_apci_3120: remove 'check' param from apci3120_setup_chan_list()
This parameter is always passed as '0'. Remove it and refactor the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten 9d5b070876 staging: comedi: addi_apci_3120: tidy up scan chanlist programming
Define the chanlist register and its bits and tidy up the programming
of the scan chanlist.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten 51db6bad08 staging: comedi: addi_apci_3120: remove unnecessary reset of the scan sequence
The scan sequence does not need to be reset when the driver is attached. Remove
the code in apci3120_reset() that does this.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten 24e18c85e5 staging: comedi: addi_apci_3120: introduce apci3120_clr_timer2_interrupt()
A dummy read of APCI3120_CTR0_REG clears the timer 2 interrupt. Introduce a
helper function to clarify this.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten b17d390661 staging: comedi: addi_apci_3120: move apci3120_exttrig_enable() to driver source
Move this helper function from the included source file into the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten a8f77b40b6 staging: comedi: addi_apci_3120: move apci3120_timer_enable() to driver source
Move this helper function from the included source file into the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten 9625742666 staging: comedi: addi_apci_3120: rename APCI3120_WR_ADDRESS
For aesthetics, rename this define.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten 38abe9367f staging: comedi: addi_apci_3120: fix timer 2 disable in apci3120_write_insn_timer()
The wrong define is being used to disable the gate to stop timer 2 in this
function.

Use the apci3120_timer_enable() helper to properly disable the timer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:59 -08:00
H Hartley Sweeten 4ffa00a3cb staging: comedi: addi_apci_3120: introduce apci3120_timer_enable()
Introduce a helper function to enable/disable a timer.

The disable of timers 0 and 1 in apci3120_interrupt() is probably not needed.
For now use the helper function to make sure the devpriv->ctrl bits are cleared
correctly to disable the timers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten a6a1cfed89 staging: comedi: addi_apci_3120: tidy up apci3120_exttrig_{enable,disable}()
Merge these two functions and use an 'enable' parameter to determine if the
external trigger needs to be enabled or disabled.

This function always succeeds and the callers don't check the return. Change
the return type to void.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten 6d210c8d96 staging: comedi: addi_apci_3120: rename APCI3120_ENABLE_EXT_TRIGGER
For aesthetics, rename this define.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten 20f75b5641 staging: comedi: addi_apci_3120: tidy up APCI3120_ENABLE_TIMER[012]
For aesthetics, replace these defines with a macro that returns the
correct bit needed to set the gate bit to enable a timer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten e0ca363a3e staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER[012]
For aesthetics, remove these defines and just use ~APCI3120_ENABLE_TIMER[012].

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten c24ca0e691 staging: comedi: addi_apci_3120: tidy up devpriv->ctrl use
The apci3120_setup_chan_list() function sets devpriv->ctrl to the scan length
(PR) and scan start (PA) values and writes the value to the register. There is
no need to mask the value first.

The apci3120_ai_insn_read() function calles apci3120_setup_chan_list(). There
is no need to clear devpriv->ctrl first or clear any additional bits and write
the register again. This also fixes an incorrect use of APCI3120_DISABLE_TIMER0
to disable the timer.

apci3120_cyclic_ai() also calls apci3120_setup_chan_list() so it does not need
to clear devpriv->ctrl or clear any addidional bits and write the register.

Update the comments in apci3120_reset() and apci3120_cancel().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten 5a1f46c8fb staging: comedi: addi_apci_3120: rename private data 'us_OutputRegister'
Rename this CamelCase member of the private data and tidy up the mask/set
of its bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten b3c8ee5cbc staging: comedi: addi_apci_3120: move timer helpers to main driver source
Move the timer read/write and set mode helpers from the included source
file into the main driver source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten e6da4c6a2d staging: comedi: addi_apci_3120: introduce apci3120_timer_set_mode()
Introduce a helper function to set the operation mode of a timer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten 2016c534dd staging: comedi: addi_apci_3120: tidy up timer_mode masking
Define a macro that returns the mask of the timer_mode bits for a given
timer. Use the macro to remove the "magic" values used to clear the bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten 486beeb488 staging: comedi: addi_apci_3120: rename private data 'b_TimerSelectMode'
Rename this CamelCase member of the private data and tidy up the mask/set
of its bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten 0c188e9cc9 staging: comedi: addi_apci_3120: rename APCI3120_TIMER_VALUE
For aesthetics, rename this register offset.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:58 -08:00
H Hartley Sweeten dd62c4373a staging: comedi: addi_apci_3120: fix counter and external interrupt disable
The APCI3120_DISABLE_ALL_TIMER define define is not needed, and it's used
incorrectly in apci3120_cancel(). The define is a mask of the bits needed
to disable the counters. Writing the value directly sets unintended bits.

Prior to writing the value, the 'devpriv->us_OutputRegister' is set to 0
and written to the register. This disables all the timers and the external
trigger.

Remove the unnecessary apci3120_exttrig_disable() call as well as the write
of APCI3120_DISABLE_ALL_TIMER.

In apci3120_interrupt(), remove the unnecessary mask and write to disable
all the timers. The COMEDI_CB_EOA event will cause the core to call the
(*cancel) operation which will disable the timers.

Remove the unused define.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:57 -08:00
H Hartley Sweeten 2e2e74e17a staging: comedi: addi_apci_3120: tidy up CTR0 register defines
Define the CTR0 register in the main driver source file and remove all
the old defines in hwrdv_apci3120.c.

For aesthetics, save the raw digital output state (devpriv->do_bits) in
the digital output (*insn_bits) function and use a macro to set them when
reading/writing a timer.

Use the CTR0 register define in the digital output (*insn_bits) function
and remove the current register define.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:57 -08:00
H Hartley Sweeten 6931290785 staging: comedi: addi_apci_3120: introduce apci3120_timer_read()
Introduce a helper function to select a timer and read a value from it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:57 -08:00
H Hartley Sweeten ca578bce6d staging: comedi: addi_apci_3120: introduce apci3120_timer_write()
Introduce a helper function to select a timer and write a value to it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:57 -08:00
H Hartley Sweeten 36d553e47d staging: comedi: addi_apci_3120: rename private data 'b_DigitalOutputRegister'
Rename this CamelCase member of the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:57 -08:00
H Hartley Sweeten 546bf3382e staging: comedi: addi_apci_3120: introduce apci3120_ns_to_timer()
The timer divisor calculations in this driver are over complicated.

There are three timers on the board. They all use the same base clock
with a fixed prescaler for each timer. The base clock used depends on
the board version and type:

  APCI-3120 Rev A boards OSC = 14.29MHz base clock (~70ns)
  APCI-3120 Rev B boards OSC = 20MHz base clock (50ns)
  APCI-3001 boards OSC = 20MHz base clock (50ns)

The prescalers for each timer are:

  Timer 0 CLK = OSC/10
  Timer 1 CLK = OSC/1000
  Timer 2 CLK = OSC/1000

Add a new member to the private data, 'osc_base', to hold the base clock
time. Set this member during the board attach.

Introduce a helper function to calculate the divisor needed to generate
a nanosecond time with a given timer.

Use the new helper function in the driver to clarify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:33:56 -08:00
H Hartley Sweeten 605d76f6eb staging: comedi: das1800: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the async buffer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:42 -08:00
H Hartley Sweeten 2d7840c70d staging: comedi: quatech_daqp_cs: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten 0be887b92a staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_count' and use the comedi_async 'scans_done'
member to detect the analog output end-of-acquisition.

Use the comedi_nsamples_left() helper to get the number of samples to actually
read from the async buffer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten ccedb44075 staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_count' and use the comedi_async 'scans_done'
member to detect the analog output end-of-acquisition.

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the async buffer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten 9e4d755cdf staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_count' and use the comedi_async 'scans_done'
member to detect the analog output end-of-acquisition.

Use the comedi_nsamples_left() helper to get the number of samples to actually
read from the async buffer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten f9f9838216 staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the analog input end-of-acquisition.

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the async buffer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten 979f99963c staging: comedi: usbduxfast: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the analog input end-of-acquisition.

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the async buffer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten c6de95f467 staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_scan_count' and use the comedi_async 'scans_done'
member to detect the analog input end-of-acquisition.

Use the comedi_nsamples_left() helper to work out the number of 'wake' samples in
pci230_ai_update_fifo_trigger_level() and the number of 'todo' samples actually
added to the async buffer in pci230_handle_ai().

Remove the unnecessary COMEDI_CB_OVERFLOW event for the hardware FIFO overflow
error. The COMEDI_CB_ERROR event will terminate the command.

comedi_buf_write_samples() can fail if the async buffer does not have room for
the sample. The it will set the COMEDI_CB_OVERFLOW event and return 0. Detect
this and quit trying to read and add more samples. The event will terminate the
command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten f615915ee5 staging: comedi: drivers: introduce comedi_nsamples_left()
Introduce a helper function to calculate the number of samples remaining
when the cmd->stop_src is TRIG_COUNT.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten a65ccf634c staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ai_count' and use the comedi_async 'scans_done'
member to detect the analog output end-of-acquisition.

Use the helper function comedi_nscans_left() to get the number of scans in the
async buffer of left in the command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten f5345d459b staging: comedi: comedi_test: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Use the helper function comedi_nscans_left() to check if the number of scans
left in the command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten d682141e59 staging: comedi: amplc_pci224: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ao_stop_count' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Use the helper function comedi_nscans_left() to determine the number of scans
available in the async buffer or left in the command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
H Hartley Sweeten 2ee3775001 staging: comedi: drivers: introduce comedi_nscans_left()
Introduce a helper function to determine the number of scans left in
the async command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:29:41 -08:00
Ian Abbott bc3fe15655 staging: comedi: split out PCI support into new module
Setting the `CONFIG_COMEDI_PCI_DRIVERS` kernel configuration option
makes the main "comedi" module depend on the PCI support in the kernel.
That's not that big a deal since PCI support in the kernel is either
built into the kernel or is absent, and is not in a separate module.
Still, not all low-level Comedi drivers need PCI support, so we could
save a bit of space by not including it.  The Comedi PCI support
functions are all in "comedi_pci.c".  Turn it into a separate module so
the support code doesn't have to be loaded unnecessarily.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:24:33 -08:00
Ian Abbott ba9ac25e96 staging: comedi: split out USB support into new module
Setting the `CONFIG_COMEDI_USB_DRIVERS` kernel configuration option
makes the main "comedi" module depend on the "usbcore" module.  But
perhaps the machine has no USB controllers (or they have been disabled),
in which case the "usbcore" module may have been pulled in
unnecessarily.  Only a few low-level Comedi drivers require USB support.
The Comedi USB support functions are all in "comedi_usb.c".  Turn it
into a separate module so we don't have to pull in the "usbcore" and
"usb_common" modules unnecessarily.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:24:33 -08:00
Ian Abbott aae434b3c3 staging: comedi: split out PCMCIA support into new module
Setting the `CONFIG_COMEDI_PCMCIA_DRIVERS` kernel configuration option
makes the main "comedi" module depend on the "pcmcia" module, but many
machines don't have PCMCIA slots and only a few low-level Comedi drivers
need PCMCIA support.  The Comedi PCMCIA support functions are all in
"comedi_pcmcia.c".  Turn it into a separate module so we don't have to
pull in the other PCMCIA support modules unnecessarily.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:24:33 -08:00
Ian Abbott d51b365101 staging: comedi: comedidev.h: remove some #ifdefs
Some declarations and macro definitions in "comedidev.h" are protected
by various `#ifdef`s for kernel configuration options, but the header
file compiles fine without the `#ifdef`s regardless of whether those
config option macros are defined or not.  Remove the `#ifdef`s and
compile the affected code unconditionally.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:24:33 -08:00
Ian Abbott 5aa1491a63 staging: comedi: comedidev.h: remove dummy PCI support functions
Some low-level Comedi driver modules used to handle PCI devices and ISA
devices in the same module with some conditional compilation.  To reduce
the amount of conditional compilation, some dummy inline versions of
`comedi_to_pci_dev()`, `comedi_pci_enable()`, `comedi_pci_disable()`,
and `comedi_pci_detach()` are defined in "comedidev.h" if
`CONFIG_COMEDI_PCI_DRIVERS` is undefined.  Since those Comedi low-level
driver modules have since had PCI support split out into separate
modules, there is no need to keep the dummy inline functions around any
more, so remove them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07 09:24:33 -08:00
H Hartley Sweeten 5e62863aea staging: comedi: das800: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:48 -08:00
H Hartley Sweeten 324e213a06 staging: comedi: addi_apci_3120: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_AiActualScan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

The function v_APCI3120_InterruptDmaMoveBlock16bit() is then just a wrapper
for comedi_buf_write_samples(). Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:48 -08:00
H Hartley Sweeten 29ee9fbaa1 staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the analog input end-of-acquisition.

Move the EOA check so it happens after adding the samples from the current
urb to the async buffer. This prevents the unnecessary resubmit of the urb
when the EOA occurs.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 4b8ffac385 staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_sample_count' and use the comedi_async
'scans_done' member to detect the analog output end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 88340999de staging: comedi: usbdux: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the analog input end-of-acquisition.

Move the EOA check so it happens after adding the samples from the current
urb to the async buffer. This prevents the unnecessary resubmit of the urb
when the EOA occurs.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 7c5fc7dd47 staging: comedi: usbdux: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_sample_count' and use the comedi_async
'scans_done' member to detect the analog output end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten aee15aea0d staging: comedi: s626: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Also, remove the unnecessary COMEDI_CB_EOS event. The core automatically
detects and adds that event.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten b03130b649 staging: comedi: pcmuio: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'stop_count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 09959d658c staging: comedi: pcmmio: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten f831de1023 staging: comedi: adv_pci1710: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten c76844e1ff staging: comedi: pcl818: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 42dafac3a5 staging: comedi: pcl818: remove private data member 'ai_act_chan'
This member of the private data is set to '0' but never used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 64886498b2 staging: comedi: pcl816: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 5f6da288e3 staging: comedi: pcl812: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:47 -08:00
H Hartley Sweeten 8712f901c9 staging: comedi: pcl711: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ntrig' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:46 -08:00
H Hartley Sweeten e268240387 staging: comedi: amplc_dio200_common: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'stopcount' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05 14:59:46 -08:00