Commit graph

494794 commits

Author SHA1 Message Date
H Hartley Sweeten
860f7c0919 staging: comedi: dt282x: remove depends on ISA_DMA_API limitation
Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

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>
2015-01-17 14:32:55 -08:00
H Hartley Sweeten
99dfc3357e staging: comedi: das1800: remove depends on ISA_DMA_API limitation
Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

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>
2015-01-17 14:32:55 -08:00
H Hartley Sweeten
1400964a2b staging: comedi: das16: remove depends on ISA_DMA_API limitation
Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

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>
2015-01-17 14:32:55 -08:00
H Hartley Sweeten
f3df482a0c staging: comedi: pcl812: remove depends on ISA_DMA_API limitation
Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

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>
2015-01-17 14:32:55 -08:00
H Hartley Sweeten
bd7ea421e3 staging: comedi: pcl816: remove depends on ISA_DMA_API limitation
Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

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>
2015-01-17 14:32:55 -08:00
H Hartley Sweeten
dd7c0f0416 staging: comedi: pcl818: remove depends on ISA_DMA_API limitation
Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

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>
2015-01-17 14:32:54 -08:00
H Hartley Sweeten
20a1ea7d6b staging: comedi: comedi_isadma: introduce helper module for ISA DMA
Introduce a new helper module to consolidate all the ISA DMA code. This will
allow removing the "depends on ISA_DMA_API" from the legacy drivers that can
use DMA for async command support.

This module is complete based on the various uses of ISA DMA in the comedi
drivers.

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>
2015-01-17 14:32:54 -08:00
H Hartley Sweeten
5e5a21cf8e staging: comedi: das1800: tidy up das1800_ai_transfer_size()
For aesthetics, pass the fill time 'ns' as a parameter to this function.

Refactor this function to calculate the transfer size in 'samples' instead
of 'bytes'. This removes the need to constantly multiply the values by the
'sample_size'. It also helps avoid any possible integer overflow issues.

Use the comedi_nsamples_left() helper to limit the samples when cmd->stop_src
is TRIG_COUNT.

Use comedi_samples_to_bytes() to return the final DMA size in bytes.

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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
620ec185a2 staging: comedi: das1800: remove hard coded 'sample_size'
Use the comedi_bytes_per_sample() helper to remove the hard coded sample_size
in suggest_transfer_size().

The helper function needs to comedi_subdevice pointer. Change the parameters
passed to suggest_transfer_size() and setup_dma() so that this pointer is
available. Rename these functions so they have namespace associated with 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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
0afa6153fb staging: comedi: ni_labpc_isadma: introduce labpc_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
f2c6bbe8e0 staging: comedi: ni_labpc_isadma: move dma programming out of labpc_drain_dma()
The external caller of labpc_drain_dma() does not enable the DMA transfer. Only
the call from handle_isa_dma() results in the programmed DMA operation getting
enabled.

For aesthetics, move the dma programming to handle_isa_dma(). Make sure the
DMA operation would actually do something (dma->size != 0) before programming
it to avoid enabling the DMA at the end of a stop_src == TRIG_COUNT 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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
72ba5c1612 staging: comedi: ni_labpc_isadma: tidy up labpc_drain_dma()
Tidy up the code that determines the number of samples to read for the
current DMA transfer and how many samples are needed for the next 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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
0f02b081da staging: comedi: ni_labpc_isadma: introduce labpc_isadma_disable()
Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

The DMA will always be disabled when labpc_setup_dma() is called. Remove
the unnecessary disable in that function.

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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
afd8f40f6f staging: comedi: ni_labpc_isadma: convert 'dma_buffer_size' to a define
For aesthetics, convert this statis const global variable to a define.

Cleanup the maximum 'size' calc in labpc_suggest_transfer_size(). The modulo
operation will always result in '0'.

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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
ac525a7f72 staging: comedi: ni_labpc_isadma: remove hard coded samples size
Use the comedi_bytes_per_sample() helper and remove the hard coded sample
size.

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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
10f3a2dca8 staging: comedi: ni_at_a2150: introduce a2150_isadma_disable()
Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:31 -08:00
H Hartley Sweeten
c92b0b2981 staging: comedi: ni_at_a2150: introduce a2150_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:30 -08:00
H Hartley Sweeten
0156b06a6b staging: comedi: pcl812: introduce pcl812_isadma_disable()
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

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>
2015-01-17 14:31:30 -08:00
H Hartley Sweeten
1ec64b74c9 staging: comedi: pcl812: introduce pcl812_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:30 -08:00
H Hartley Sweeten
a1ce5f037e staging: comedi: das16: introduce das16_isadma_disable()
Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:30 -08:00
H Hartley Sweeten
0196285ebd staging: comedi: das16: introduce das16_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:30 -08:00
H Hartley Sweeten
59e561f3a6 staging: comedi: das16: move dma transfer 'size' to dma descriptor
For asethetics, move the variable that holds the dma transfer 'size' into
the dma descriptor.

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>
2015-01-17 14:31:30 -08:00
H Hartley Sweeten
ae4e131e0b staging: comedi: das1800: introduce das1800_isadma_disable()
Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:30 -08:00
H Hartley Sweeten
dec3aa4fff staging: comedi: das1800: introduce das1800_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
5d12431c5c staging: comedi: das1800: move dma transfer 'size' to dma descriptor
For asethetics, move the variable that holds the dma transfer 'size' into
the dma descriptor.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
38f23ed0a6 staging: comedi: das1800: pass dma descriptor to das1800_flush_dma_channel()
Instead of passing the dma descriptor 'chan' and 'virt_addr' just pass the
dma descriptor.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
7877445b5c staging: comedi: dt282x: introduce dt282x_isadma_disable()
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
f609c29dfb staging: comedi: dt282x: introduce dt282x_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
65fdfedbc0 staging: comedi: pcl816: introduce pcl816_isadma_disable()
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
d77bf9736b staging: comedi: pcl816: introduce pcl816_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
bed8d5381c staging: comedi: pcl818: introduce pcl818_isadma_disable()
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
9cf2765f5e staging: comedi: pcl818: introduce pcl818_isadma_program()
Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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>
2015-01-17 14:31:29 -08:00
H Hartley Sweeten
ed07758759 staging: comedi: das16: board is not a PCI device
The DAS16 board is an ISA device not a PCI device. For aesthetics, use
dma_{alloc,free}_coherent() to allocate and free the DMA buffers instead
of the PCI versions.

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>
2015-01-17 14:25:22 -08:00
H Hartley Sweeten
742c4a0959 staging: comedi: das16: introduce das16_free_dma()
For aesthetics, move the freeing of the DMA channel and the buffers to
a helper function.

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>
2015-01-17 14:25:22 -08:00
H Hartley Sweeten
7447cd60a3 staging: comedi: das16 introduce das16_alloc_dma()
DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.

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>
2015-01-17 14:25:22 -08:00
H Hartley Sweeten
38a7d4999a staging: comedi: das16: introduce struct das16_dma_desc
For aesthetics, introduce a struct to hold the DMA descriptor 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>
2015-01-17 14:25:22 -08:00
H Hartley Sweeten
ef98a104c2 staging: comedi: dt282x: remove VIRT_TO_BUS dependancy
Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
eca331c20f staging: comedi: dt282x: introduce struct dt282x_dma_desc
For aesthetics, introduce a struct to hold the DMA descriptor 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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
d5702e3476 staging: comedi: dt282x: introduce dt282x_alloc_dma()
The IRA and DMA are optional with this driver but both are required to
support async commands. Introduce a helper function to request the IRQ
and DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid IRQ or DMA channel or they cannot be
requested.

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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
9fe11ffeb1 staging: comedi: pcl812: remove VIRT_TO_BUS dependancy
Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
d8332a6897 staging: comedi: pcl812: introduce struct pcl812_dma_desc
For aesthetics, introduce a struct to hold the DMA descriptor 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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
91ac6981bc staging: comedi: pcl812: introduce pcl812_free_dma()
For aesthetics, move the freeing of the DMA channel and the buffers to
a helper function.

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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
075400af76 staging: comedi: pcl812: introduce pcl812_alloc_dma()
DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.

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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
ceb41be712 staging: comedi: pcl816: fix short DMA transactions
When the cmd->stop_src == TRIG_COUNT the last DMA transfer might be smaller
than the buffer size. This results in invalid data being added to the async
buffer.

Add a 'size' member to the DMA descriptor and initialize it with the
actual size of the DMA transfer. Use that in interrupt and ai subdevice
(*poll) function to return the proper number of samples. Use the
comedi_bytes_to_samples() helper to convert the byte size to comedi
samples in the 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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
a2c3966d18 staging: comedi: pcl816: remove VIRT_TO_BUS dependancy
Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
16d87782c5 staging: comedi: pcl816: introduce struct pcl816_dma_desc
For aesthetics, introduce a struct to hold the DMA descriptor 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>
2015-01-17 14:25:21 -08:00
H Hartley Sweeten
d7b8bbb6a7 staging: comedi: pcl816: introduce pcl816_free_dma()
For aesthetics, move the freeing of the DMA channel and the buffers to
a helper function.

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>
2015-01-17 14:25:20 -08:00
H Hartley Sweeten
1fa51639e5 staging: comedi: pcl816: introduce pcl816_alloc_dma()
The IRA and DMA are optional with this driver but both are required to
support async commands. Introduce a helper function to request the IRQ
and DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid IRQ or DMA channel or they cannot be
requested.

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>
2015-01-17 14:25:20 -08:00
H Hartley Sweeten
1c53093a1d staging: comedi: pcl818: fix pcl818_handle_dma() for short DMA transaction
Currently this function always transfers the full DMA buffer to the comedi
async buffer. When the cmd->stop_src == TRIG_COUNT the last DMA transfer
might be smaller than the buffer size. This results in invalid data being
added to the asunc buffer.

Add a 'size' member to the DMA descriptor and initialize it with the
actual size of the DMA transfer. Use that in pcl818_handle_dma() to
return the proper number of samples. Use the comedi_bytes_to_samples()
helper to convert the byte size to comedi samples. Remove the unnecessary
'bufptr' local variable.

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>
2015-01-17 14:25:20 -08:00
H Hartley Sweeten
7a37b7a755 staging: comedi: pcl818: remove VIRT_TO_BUS dependancy
Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

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>
2015-01-17 14:25:20 -08:00