History log of /drivers/staging/comedi/drivers/ni_labpc_pci.c
Revision Date Author Comments
aac307f9dd5ce1fe651140a036ab4b0a0571b54a 26-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_pci: introduce comedi_pci_detach()

Introduce a generic (*detach) function for comedi PCI drivers to handle
the boilerplate code needed to detach a PCI driver.

This function works similar to comedi_legacy_detach() where it will:

* free the dev->irq if it has been requested
* iounmap the dev->mmio addres if it has been ioremap'ed

The helper then calls comedi_pci_disable() to release the regions and
disable the PCI device.

Use the new helper directly for the (*detach) in the following cases:

* where comedi_pci_disable() is used directly for the (*detach)
* where the detach function is just boilerplate

Use the new helper in the (*detach) of the simpler PCI drivers. Call
the helper after disabling interrupts (reset) and before any additional
cleanup (kfree) to avoid any race conditions with 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>
70f72867147b18fc36d2717cda6ddbaf4f71cf77 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: use the comedi_device 'mmio' member

Use the new 'mmio' member in the comedi_device for the ioremap'ed
base address.

Only the ni_labpc_pci module does the ioremap, its also the only
module that sets the 'has_mmio' member in the boardinfo. Remove
this member from the boardinfo and use dev->mmio to determine if
the I/O is memory mapped.

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>
319a883bfdfe163094ba32c8ab7815a109ba3bcc 14-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc_pci: remove COMEDI_MITE and HAS_DMA dependancy

The mite module provides the DMA interface for the PCI MITE ASIC used on
many National Instruments DAQ boards. This driver does not use DMA and only
depends on the mite module to initialize the MITE ASIC.

Handle the initialization localy and remove the unnecessary dependancies.

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>
b876e985c2273b7bd2d5539f2147ef69f7701129 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: mite: cleanup mite_unsetup()

This function is only called by comedi drivers during the (*detach) of the
driver. After it is called mite_free() is always called to kfree the allocated
mite_struct pointer.

Rename this function to mite_detach() and merge the kfree() from mite_free()
into it.

Remove the unnecessary clearing of the mite variables since the mite pointer
is going to be kfree()'d anyway.

The mite_detach() function checks if the pointer is valid so remove the
unnecessary checks in the callers.

The check can also be removed in ni_660x since the ni_660x_free_mite_rings()
function does not actually need the 'mite' 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>
ba9d29fe102d4b4e388ba510f4a71b8b737144b9 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: mite.h: remove mite_irq()

This inline function simply returns the 'irq' of the struct pci_dev pointer
that is stored in struct mite_struct. This pci_dev pointer is the same as
the one that is already available in the (*auto_attach) functions where
mite_irq() is used.

Use the pci_dev pointer directly to get the irq and remove the unnecessary
inline function to remove the indirection.

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>
41e043fcfa2236bb2c4a8335eb09f4c8cee224b3 03-Dec-2013 Jingoo Han <jg1.han@samsung.com> staging: remove DEFINE_PCI_DEVICE_TABLE macro

Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ce157f8032bbd46d9427034c335b0afd751da25d 25-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: don't rely on comedidev.h to include headers

comedidev.h is the main kernel header for comedi. Every comedi
driver includes this header which then includes a number of
<linux/*> headers. All the drivers need <linux/module.h> and some
of them need <linux/delay.h>. The rest are not needed by any of
the drivers.

Remove all the includes in comedidev.h except for <linux/dma-mapping.h>,
which is needed to pick up the enum dma_data_direction for the
comedi_subdevice definition, and "comedi.h", which is the uapi
header for comedi.

Add <linux/module.h> to all the comedi drivers and <linux/delay.h>
to the couple that need it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0bdab509bf9c6d838dc0a3b1d68bbf841fc20b5a 25-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: use comedi_alloc_devpriv()

Use the helper function to allocate memory and set the comedi_device
private data pointer.

This removes the dependency on slab.h from most of the drivers so
remove the global #include in comedidev.h and the local #include
in some of the 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>
588ba6dc5fb4bdca47a3da38c2718fbb82d3eee1 11-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: let core handle freeing s->private

Introduce a new subdevice runflags, SRF_FREE_SPRIV, and a new helper
function, comedi_set_spriv(), that the drivers can use to set the
comedi_subdevice private data pointer. The helper function will also
set SRF_FREE_SPRIV to allow the comedi core to automatically free the
subdevice private data during the cleanup_device() stage of the detach.

Currently s->private is only allocated by the 8255, addi_watchdog,
amplc_dio200_common, and ni_65xx drivers. All users of those drivers
can then have the comedi_spriv_free() calls removed and in many cases
the (*detach) can then simply be the appropriate comedi core provided
function.

The ni_65xx driver uses a helper function, ni_65xx_alloc_subdevice_private(),
to allocate the private data. Refactor the function to return an errno
or call comedi_set_spriv() instead of returning a pointer to the private
data and requiring the caller to handle 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>
5e763f7bd9fea0027e246e6c2cee291566a390a9 14-May-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove *_ai_gain_bits tables

The bits needed to set the analog input gain can be simply calculated
based on the 'range'.

The LabPC versions of the board do not have the '0x10' gain that the
LabPC+ board supports. By incrementing the range appropriately the
correct gain bits can still be calculated.

This allows removing the two gain tables, as well as the export, along
with the 'ai_range_code' data in the boardinfo.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
641f064e5df6fb3aaeb6256031a153a5efb16ca6 25-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: remove FSF address from boilerplate text

Addresses change...

Remove the paragraph with the FSF address from all the comedi source
files.

Also, remove the paragraph about the finding the complete GPL in the
COPYING file since it's unnecessary.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
70d52bce5523f2c6a7bf3f9a54dacc0be112a3e8 23-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove range_labpc_1200_ai export

The 'ai_range_table' boardinfo is only used to initialize the
analog input subdevice s->range_table. We can use the 'is_labpc1200'
flag in the boardinfo to determine which range table is needed.

This allows making range_labpc_1200_ai static and removing the
export as well as removing the 'ai_range_table' from the boardinfo.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
63d6ba20bab01ea1a92b3fe7718416a8527e009a 23-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup true/false flags in boardinfo

The 'register_layout' in the boardinfo can be represented as
a true/false flag instead of an enum. Rename the variable to
'is_labpc1200' and change it to an unsigned 1-bit bit-field.

The 'has_ao' variable is also a true/false flag. Change it to
an unsigned 1-bit bit-field.

Reorder the boardinfo data so that the bit-field data is grouped
together.

For aesthetic reasons, and move the 'const' variables then
reorder the boardinfo declarations to match the definition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a9b3ea3dbbb54f9160465f6f1086f877e958fdcc 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove 'bustype' from boardinfo

The 'bustype' in the boardinfo is not 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>
3e034797191de9981cddff4d1a8203d020360958 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: pass the isr_flags to labpc_common_attach()

The PCI and PCMCIA LabPC boards use shared interrupts and need the
IRQF_SHARED flag set when requesting the irq, the ISA boards do not.

Instead of checking the 'bustype' in labpc_common_attach() in order
to determine the isr_flags, just pass the flags as a parameter to the
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>
767308842b4b970ca105b1e80cd92af39355dfc5 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: move DMA init out of the common attach

Only the ISA versions of the LabPC boards support DMA. Move the DMA
initialization out of the labpc_common_attach() and put it in the
ISA specific labpc_attach() function.

Remove the 'dma_chan' parameter from labpc_common_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>
fa3cb2191091657038ddb9207888b6cfb11fdf6e 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: split out PCI support

Currently the ni_labpc driver is used by the legacy (ISA), PCI, and
PCMCIA versions of the LabPC board. The driver is enabled under the
COMEDI_PCI_DRIVERS section of the Kconfig. This means that PCI support
must be enabled in order to use the ni_labpc driver for the PCI or
PCMCIA drivers.

Split the PCI support code out of the ni_labpc driver into a separate
driver, ni_labpc_pci. The PCMCIA support is already slip out as
ni_labpc_cs.

Modify the Kconfig so that the common code in ni_labpc is enabled by the
Kconfig option COMEDI_NI_LABPC. The ISA support code is currently still
in the ni_labpc driver but is only compiled in if COMEDI_NI_LABPC_ISA is
also enabled.

This allows the PCI and PCMCIA drivers to be enabled without the need
for the ISA stuff.

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>