The first digital i/o subdevice has its n_chan set to S626_DIO_CHANNELS
which is defined as 48. This is actually the total number of channels
provided by all three digital i/o subdevices. Each subdevice only has
16 channels.
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>
Remove the cut-and-paste comments from the skel driver.
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>
The 'devpriv' macro relies on a local variable having a specific
name and yields a pointer derived from that local variable. Replace
the macro with a local variable where used.
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>
Like most of the comedi drivers, this one appears to have been started
based on the skel driver. Cut-and-paste from that driver has resulted
in an unnecessarily complex boardinfo struct.
Remove everything from the boardinfo struct, except the 'name', and
just use the open coded values in the attach function.
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>
The macro is just a wrapper for outb(). Just use the outb() directly.
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>
The macro is just a wrapper for inb(). Just use the inb() directly.
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>
Move the dmm32at_ns_to_timer() and dmm32at_setaitimer() functions
to remove the need for the remaining forward declarations.
Also, make dmm32at_setaitimer() static, it's only referenced in
this file.
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>
Move the attach/detach functions as well as the boardinfo variable
to remove the need to most of the forward declarations.
Add some whitespace to the boardinfo during the move.
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>
Convert driver to use the module_comedi_driver() macro to remove
some of the boilerplate.
Move the comedi_driver variable to the end of the file to keep it
with the module_comedi_driver() macro. This also removes the need
for some of the forward declarations. While moving the variable:
1) strip out the unnecessary cut-and-paste skel driver comments
2) add whitespace to improve the readability
3) rename the variable from driver* to *driver
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>
The 'thisboard' macro relies on a local variable having a specific
name and yields a pointer derived from that local variable. Replace
the macro with a local variable where used. Use the comedi_board()
helper to get the pointer.
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>
Move the comedi_driver variable to remove the need for the
forward declarations. Add some whitespace to the declaration
for aesthetic reasons.
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>
Move the pcmcia_disable_device() call where needed in the pcmcia
probe/remove and delete the das08_pcmcia_release() function.
Move the logic of the das08_pcmcia_config() directly into the
probe function and properly return an error code when the config
fails.
Only set cur_dev, used by the comedi_driver, if the pcmcia probe
is successful. Also, make sure to NULL it in the remove.
Remove all the kernel messages in the pcmcia support code. They
are just added noise.
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>
The pcmcia device-specific data is no longer needed by this driver.
Remove 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>
The pcmcia support code in this driver is cut-and-paste from the
dummy_cs.c driver of the Linux PCMCIA Card Services package. It
has code in it to stop the device during suspend but nothing in
the main comedi_driver uses it.
Remove the 'stop' variable from the pcmcia private data and all
the logic that deals with 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>
Refactor the pcmcia support code to remove the need for the
forward declarations.
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>
Move the comment about the PCMCIA support and reword it a bit
because of the move.
Remove a number of useless comments.
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>
For aesthetic reasons, add some whitespace to the declaration
of the pcmcia_driver and reorder it a bit.
Also, the symbol 'das08_cs_driver' is only referenced in this file,
make it static. This quiets the following sparse warning:
warning: symbol 'das08_cs_driver' was not declared. Should it be static?
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>
As done with the other comedi driver types, register the
comedi_driver first then the pcmcia_driver. Also, make sure
the pcmcia_driver registration succeeds and unregister the
comedi_driver if it fails.
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>
The register/unregister of the pcmcia driver is done in separate
functions that are called by the module_{init,exit} routines.
Simplify the code a bit by moving the register/unregister into
the module_{init,exit} routines.
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>
Move the MODULE_* declarations to the end of the file.
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>
The i8254_struct now only contains the iobase address used to
read/write the 8254 timer device. Move that variable into the
das08 private data struct and remove the i8254_struct.
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>
Now that the driver is using the 8253 helper functions, remove the
unused variables in the i8254_struct as well as the unused defines
for the 8254 register offsets.
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>
The internal 8254 'channels' count is the same as the comedi
subdevice 'n_chan'. There is no need to keep the internal
count.
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>
The three 8254 timers have a 1:1 relationship to the comedi
channels. The 'logic2phys' usage just makes the driver more
complex.
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>
The driver initially sets all the cached 'mode' values for the
8254 timers to (I8254_MODE0 | I8254_BINARY). It then sets the
timers to that 'mode'. Configuring the counters with the comedi
INSN_CONFIG_SET_COUNTER_MODE updates the 'mode' and then sets
the timers to the 'mode'. The cached value is never read or
used other than for storage.
Just remove the 'mode' usage as it serves no purpose.
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>
Refactor the 8254 timer support by removing the various functions
that handle the io and consolidating the logic into the initialize,
read, write, and config functions used by the driver.
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>
Instead of open-coding the 8254 timer io, use the helper functions
provided by 8253.h.
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>
All the NI 670x boards have 16-bit anaolog output DACs. The
'ao_bits' in the boardinfo is not used so remove 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>
Add local variable for the io_addr, mask. and bits used in this
function so that the comments are not needed and the writel/readl
calls are a bit cleaner.
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>
For aesthetic reasons, reorder the boardinfo struct so that the
'name' pointer is first. Also, add some whitespace to the boardinfo
to improve readability.
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>
The attach if this driver can fail before the subdevices are
allocated. If the attach fails the comedi core will call the
detach routine to allow the driver to do it's cleanup.
We need to make sure that the subdevice allocation was successful
before trying to dereference subdevice[0] to free the allocated
range table list.
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>
The comedi core expects a < 0 value during the attach to indicate
an error. The normal 'success' return for the kernel is '0' so use
that here.
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>
Convert all the prink's in this file to dev_prink's.
Change the INFO message in ni_670x_find_device into a dev_warn().
This message is only displayed if a matching device was not found.
A warning is more appropriate here than info.
Consolidate the attach messages into one dev_info() output after
the successful attach.
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>
This macro is simply the ARRAY_SIZE() of the boardinfo. Just use
the ARRAY_SIZE and remove the macro.
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>
The 'thisboard' and 'devpriv' macros rely on a local variable having
a specific name and yield pointers derived from that local variable.
Replace the macros with local variables where used. Use the
comedi_board() helper to get the 'thisboard' pointer.
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>
Move the attach and detach functions to remove the need for the
forward declarations.
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>
Refactor the driver to use the module_comedi_pci_driver() helper.
This gets rid of some of the module boilerplate code.
For aesthetic reasons, rename the comedi_driver and pci_driver to
follow the convention of the other comedi pci drivers.
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>
Use the dev->driver->driver_name for the resource name passed to
pci_request_regions(), by way of comedi_pci_enable(), instead of
the open coded string "adl_pci6208".
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>
For aesthetic reasons, set the dev->board_name as soon as the
thisboard pointer is available.
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>
For aesthetic reasons, reorder the local variables and change
the return value to 'insn->n'.
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>
Use the defines for the register map to make the code a bit
clearer. Shorten or rename some of the local variables for
the same reason.
Only the last value written to the DAC needs to be cached in
the ao_readback variable.
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>
The 'ao_readback' variable in the private data struct is used to
cache the last value written to the analog output DAC channels.
The PCI-6208 has 8 analog output channels but the variable only
allowed space to cache 2 values.
Since the PCI-6216 board could be supported by this driver and
it has 16 analog outputs, create a define for the maximum number
of channels and use that to set the size of 'ao_readback'.
For now, set the max to 8 to save space since the PCI-6216 is
not currently supported.
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>
The 'data' variable in the private data struct is not used by the
driver. Remove 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>
Remove a number of useless comments that are cut-and-paste from
the skel driver.
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>
Remove the commented out pci device entries in the MODULE_DEVICE_TABLE
as well as the associated boardinfo, which is also commented out. Add
some whitespace to the boardinfo to improve readability.
This driver should also support the pci-6216 card which has an
additional 8 analog outputs (16 total). But the device id needs
to be determined.
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>
The comedi core expects a < 0 value during the attach to indicate
an error. The normal 'success' return for the kernel is '0' so use
that here.
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>
Add whitespace to the subdev initialization and remove the
unnecessary comments to improve readability.
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>
The PCI-6208 board has 4 digital outputs and 4 digital inputs.
The support for the digital i/o subdevice was commented out and
the code was just cut-and-paste from the skel driver. Enable
the digital i/o subdevice by uncommenting the code and fixing
the insn_bits and insn_config functions.
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>
Consolidate the attach messages into one dev_info() output
at the end of a successful attach.
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>