History log of /drivers/staging/comedi/drivers/addi_apci_3xxx.c
Revision Date Author Comments
ef97126fd0f04f55e17d8beb409a6ffc9741f3dc 09-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: addi_apci_3xxx: replace comedi_board() calls

The `comedi_board(dev)` inline function calls just return
`dev->board_ptr`. Expand the inline function calls.

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>
74eede61acaa6881b9d9a733d904a314768f3eb7 03-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: addi_apci_3xxx: use CMDF_ROUND_...

Replace use of the `TRIG_ROUND_...` macros with the new names
`CMDF_ROUND_...`. The numeric values are unchanged.

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>
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>
b38d64946f8e78055f742f23678b5ebed674a5b3 26-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: use comedi_subdevice 'readback'

Use the new comedi_subdevice 'readback' member and the core provided
(*insn_read) for the readback of the analog output subdevice channels.

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>
24a446127966eb309dbdb9c5b72c5cd59bd6edf9 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: use the comedi_device 'mmio' member

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

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>
a207c12f62e8b53e1e1600ca384b13a39a9feed2 19-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: cleanup cmd->flags use

Most of the comedi drivers that support async commands have some sort
of timer to control the acquisition timing. For these drivers, Step 4
of the (*do_cmdtest) operations calls a ns_to_timer() function that
converts the desired ns time of the command into a value used to set
the timer. These ns_to_timer() functions also typically pass the
cmd->flags in order to determine the desired rounding mode.

Some of the drivers mask the cmd->flags with TRIG_ROUND_MASK when
calling the ns_to_timer() functions. Move all the masking into the
ns_to_timer() functions and just pass the cmd->flags directly.

The cmd->flags member is an unsigned int, change the parameter type
in the the ns_to_timer() functions to match.

For aesthetics, rename the parameter in all the ns_to_timer()
functions to 'flags'.

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>
9ed221faae72ab1ad16e5f51d9f290e77af2c795 16-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: checkpatch.pl cleanup (else after return)

Fix the checkpatch.pl warning in this file:

WARNING: else is not generally useful after a break or return

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>
66e3015f6ec84f7143af0f01ce096b6cd9e1a4b9 27-May-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: use comedi_fc helpers to validate timer arg

Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

For aesthetics, rename the local variable 'tmp' to 'arg'.

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>
3672effdeae5395d661a2103f69082146ef949fc 06-May-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: pass subdevice to comedi_buf_put()

Change the parameters of `comedi_buf_put()` to pass a pointer to the
comedi subdevice instead of a pointer to the "async" structure belonging
to the subdevice.

The function puts a sample value in the comedi buffer, but currently
only deals with 16-bit sample types. A future version could deal with
16 or 32-bit sample types depending on the value of the SDF_LSAMPL
subdevice flag.

The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.

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>
a1f6c2afed3f4c96194f131373b1e914b285c76b 30-Apr-2014 Luca Ellero <luca.ellero@brickedbrain.com> staging: comedi: fix checkpatch warnings

Signed-off-by: Luca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7c9fc34ea3ed02d7d8356094ac179e1c63ae443b 17-Apr-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: fix ai subdevice 'len_chanlist'

Due to a driver limitation, the (*do_cmdtest) for the analog input subdevice
overrides the cmd->chanlist_len to force single channel chanlists. But, the
cmd->scan_end_arg was already validated before this happens. Instead of
fixing the (*do_cmdtest) just set the subdevice len_chanlist to 1 to limit
the chanlist size. Move the comment also.

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>
67562be5054f325324197cfd0f478cdc76ed57e8 10-Feb-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xx: use comedi_timeout()

Use comedi_timeout() to wait for the analog input and output end-of-
conversions.

This prevents a deadlock condition that could occur by providing a
timeout in case the end-of-conversion does not happen.

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>
b0377d4bd438d00310005190a46920cb0279106f 14-Feb-2014 Chase Southwood <chase.southwood@yahoo.com> Staging: comedi: clean up conditional statement in addi_apci_3xxx.c

In this conditional statement, if (chan < 16), but the instruction passed
in data[0] is INSN_CONFIG_DIO_QUERY, the function does not return early,
but the else-branch does not get executed either. As a result, mask
would be used uninitialized in the next line. We want
comedi_dio_insn_config() to use a chan_mask based on the chanspec for the
INSN_CONFIG_DIO_QUERY instruction, so mask should be initialized to 0.
Then, if instead the instruction is INSN_CONFIG_DIO_{INPUT,OUTPUT}, we
return an error if (chan < 16) as these are invalid instructions for
ports 0 and 1, or update the mask otherwise, so all the io_bits are
modified for port 2. This ensures that mask is always initialized by the
time it is used.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.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>
ca5d4a20fb65a2ab2ad3c2797d7639d3dc64c147 30-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: use comedi_dio_update_state()

The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.

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>
97f4289ad08cffe55de06d4ac4f89ac540450aee 30-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_dio_update_state() for simple cases

Use comedi_dio_update_state() to handle the boilerplate code to update
the subdevice s->state for simple cases where the hardware is updated
when any channel is modified.

Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the
current state is not returned in data[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>
5dacadcca3176e2b1f8db662e503c080484d71fa 06-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_dio_insn_config() for complex cases

Convert the drivers with complex, port programmable i/o, to use the
comedi_dio_insn_config() helper function.

All of these drivers have some sort of 'port' programmable i/o where multiple
i/o channels are configured as a group. The 'mask' associated with the group
is passed to comedi_dio_insn_config() so that all the channels are configured.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3457bfd6dfb38f7bb66a227fe3473bad4773de06 13-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Revert "staging: comedi: drivers: use comedi_dio_insn_config() for complex cases"

This reverts commit f21c53945cb95f66faa9636af5f23cb00ba73019.

I applied the wrong patch :(

Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f21c53945cb95f66faa9636af5f23cb00ba73019 06-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_dio_insn_config() for complex cases

Convert the drivers with complex, port programmable i/o, to use the
comedi_dio_insn_config() helper function.

All of these drivers have some sort of 'port' programmable i/o where multiple
i/o channels are configured as a group. The 'mask' associated with the group
is passed to comedi_dio_insn_config() so that all the channels are configured.

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>
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>
656e39fedcf01b688a2aa1dca78c6c2a571264f1 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: only allocate needed subdevices

The number of subdevices needed by a given board supported by this
driver can cary from 2 (for the apci3500) to a maximum of 5. Currently
this driver always allocates 7 subdevices and sets the subdevice type
to COMEDI_SUBD_UNUSED for the ones that are not needed.

Calculate the actual number of needed subdevices from the boardinfo
and only allocate and setup the ones that are used.

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>
f32376e993a7657198974e713577152ac67833db 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: fix the analog input subdevice

The analog input subdevice support functions in hwdrv_apci3xxx.c
do not follow the comedi API.

The (*insn_config) function overrides the INSN_CONFIG_DIO_INPUT
instruction as an internal APCI3XXX_CONFIGURATION instruction. The
APCI3XXX_CONFIGURATION instruction requires 4 data parameters but
the comedi core sanity checks the INSN_CONFIG_DIO_INPUT instruction
which only has 1 data parameter. Because of this the (*insn_config)
function can never be called.

The (*insn_read) function is supposed to do "one-shot" or "software-
triggered" reads and return the data. The function in hwdrv_apci3xxx.c
does do this but it also is used to optionally start a "hardware-
triggered" conversion. Hardware-triggered conversions should be done
with the comedi_async command functions.

Delete the hwrdv_apci3xxx.c file and fix the analog input subdevice
in the driver by:

1) add a new (*insn_read) function for "one-shot" reads
2) implement the (*do_cmdtest) and (*do_cmd) functions for
"hardware-triggered" asyncronous reads
3) fix the interrupt handler to return the read data via the
comedi_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>
66573991c47f3e826f294b6ab4aa1cf967d5f426 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: stub in analog input command support

The analog input subdevice in this driver is broken. The attach of
this driver requests the irq and sets the dev->read_subdev to the
analog input subdevice but it does not setup the subdevice to support
commands.

Stub in the command support functions so we can fix the subdevice.

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>
308380e69625c347f88ba23da9dc0e9a58918838 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: tidy up analog input subdevice init

For aesthetic reasnons, add some whitespace to the analog input
subdevice initialization.

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>
040540763b5729b99e24c118d4343f489a00b456 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'b_SingleDiff' private data

The analog reference desired for the acquisition is stored in the
insn->chanspec that is passed to the (*insn_read) function. There is
no need to use a private data variable to hold the desired analog
reference that is set in the (*insn_config).

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>
8d4729066cde58c730573d6aad2ea29f8048fcb3 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'i_NbrAiChannelDiff' boardinfo

The number of differential analog input channels is always half the
number of single-ended channels, 'ai_n_chan', or all the channels
if the board does not support single-ended channels. We can use the
'ai_subdev_flags' boardinfo to determine if the board does not support
single-ended channels.

To simplify the boardinfo, remove the 'i_NbrAiChannelDiff' and just
use 'ai_n_chan' to specify the number of channels.

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>
47bd1ad800470f4786f7d35379798a7a10aff84c 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: rename 'i_NbrAiChannel'

Rename this CamelCase boardinfo 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>
8edd44251eb35b92f381b8caf495f6cc8483bc27 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: rename 'ui_MinAcquisitiontimeNs'

Rename this CamelCase boardinfo 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>
a67e0cc7aa3f15a4aa3e88945cd1d2476149191f 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: clarify 'b_AvailableConvertUnit'

This boardinfo defines the conversion time bases that the analog input
subdevice supports (ns, us, ms).

Add some defines to get rid of the magic numbers and 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>
46572bad94f97cbd16097a7b807f418c474d4ebe 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: tidy up i_APCI3XXX_InsnConfigAnalogInput()

The analog input subdevice is broken in this driver. To help fix
it, tidy up this (*insn_config) function.

Rename the CamelCase function.

Move the (insn->n == 4) test from i_APCI3XXX_AnalogInputConfigOperatingMode()
to this function.

Make the function a bit more concise and remove the printk noise.

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>
8a1ec30d75d844d21c5034152242a087230e40e5 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: properly set the analog input subdev_flags

Some of the boards supported by this driver only have differential
analog inputs. Add a new boardinfo, 'ai_subdev_flags', to allow
properly setting the subdev_flags for the analog input subdevice.

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>
5469d929087c135b5978b1f5628ec897d5c55d9f 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: rename boardinfo 'i_AiMaxData'

Rename this CamelCase boardinfo. Also, change its type to match
the type of comedi_subdevice 'maxdata'.

For aesthetic reasons, change the values to hex since this is more
common for the 'maxdata' values in 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>
6abeba097bb32e82a8b9e0a748224574b588d3a3 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: rename boardinfo 'pc_DriverName'

Rename this CamelCase boardinfo.

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>
79518d9f9c2025449e66a9f00f18d6962f859627 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'i_AiChannelList' from the boardinfo

The analog input s->len_chanlist for the boards supported by this driver
should always be the number of channels (s->n_chan). Use that instead
and remove the 'i_AiChannelList' from the boardinfo.

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>
283ce669268da5a51eaf62efe92d5dd4625817a2 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'tsk_Current' from private data

The interrupt function should be using comedi_event() to let the user
know data is available from the analog input subdevice.

The analog input subdevice is currently broken and nothing sets
tsk_Current anyway so 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>
f43abbb4ff4bbe7f92c1293c3aa06c1e43da7695 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: rename 'dw_AiBase' in private data

This variable holds the ioremap'ed PCI bar 3 used to read/write the
analog input and output registers. Rename it to simply 'mmio'.

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>
dc63364691322014e313d1eb740df1ade2a3b13d 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'iobase' from private data

The private data 'iobase' is the same as the comedi_device 'iobase'.
Use the one in the comedi_device instead.

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>
9cfd70de792133feb223f4a169ee8bbd13168bc3 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'i_IobaseReserved' from private data

This variable is not used by 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>
088e2e053d285553cb988ca50177d266d5494243 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: tidy up i_APCI3XXX_InsnReadAnalogInput()

The analog input subdevice in this driver is broken. It abuses the
comedi API and will not work as-is. Start cleaning it up so it can
be fixed.

Rename the CamelCase function and the local variables.

Refactor the function to remove the indents. Most of the indents are
left over from the previous patches.

Invert the early tests to provide a quick exit from 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>
08be3097fa1597f13b97ab390b0e80ce07cb4796 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'b_AiInitialisation' from private data

This variable is set during the attach of the board and never cleared
so the test in i_APCI3XXX_InsnReadAnalogInput() will always succeed.
Just remove the variable to help with cleaning up this 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>
da6578abd7c7535e59cae5eb0c54f5cd13902a6d 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: refactor the ttl digital i/o support

Currently, the subdevice functions used to configure and read/write the
ttl digital i/o ports is way over to complicated. The (*insn_config)
function also abuses the comedi API by overriding the instruction
command passed in data[0].

Fix the ttl digital i/o support to work like the comedi core expects.

The (*insn_config) function supports the three instructions common for
COMEDI_SUBD_DIO subdevices:

INSN_CONFIG_DIO_INPUT - configure the specified channel as input
INSN_CONFIG_DIO_OUTPUT - configure the specified channel as output
INSN_CONFIG_DIO_QUERY - returns the status of the specified channel

Port 0 (channels 0-7) is always input
Port 1 (channels 8-15) is always output
Port 2 (channels 9-23) are programmable i/o (all channels are input or output)

The (*insn_bits) function allows writing to the output channels and returns
the state of all channels.

The (*insn_read) and (*insn_write) functions are not required. The comedi
core will emulate them using the (*insn_bits) 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>
0e771e49fc2174054bbb4927f9afe8db4e16ae0b 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: absorb i_APCI3XXX_InsnWriteAnalogOutput()

Rename this CamelCase function and absorb it from hwdrv_apci3xxx.c
directly into the driver.

Tidy up the analog output subdevice init by adding some whitespace.

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>
fa81e2f186fb95dac1641e1e8d6740ed559e5204 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: refactor 'i_NbrAoChannel' boardinfo

The boards that have analog outputs always have 4 channels.

Remove the 'i_NbrAoChannel' data from the boardinfo and add a bit
field to indicate that the board 'has_ao'. Use that to conditionally
initialize the subdevice and open code the s->n_chan value of 4.

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>
383390cfd4aefad6e00d4738233aa89901211fdd 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: tidy up the ttl digital i/o subdevice init

For aesthetic reasons, add some whitespace to the initialization of the
ttl digital i/o subdevices.

Fix the subdev_flags for the subdevice. The SDF_GROUND and SDF_COMMON
flags only apply to analog subdevices.

Fix the s->iobits for the subdevice. According to the datasheet:
Port 0 (channels 0-7) are always outputs
Port 1 (channels 8-15) are always inputs
Port 2 (channels 9-23) are programmable i/o (default to inputs)

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>
ca1cc85b0ea5d1c9de91ffebf4d5272bb5a61dee 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: tidy up the digital in and out subdevice init

For aesthetic reasons, add some whitespace to the initialization of the
digital input and output subdevices.

Fix the subdev_flags for both subdevices. The SDF_GROUND and SDF_COMMON
flags only apply to analog subdevices. Digital output subdevices do not
need the SDF_READABLE flag set.

Remove the initialization of s->io_bits. It only has meaning for
COMEDI_SUBD_DIO subdevices.

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>
f1861cb0d29cdc0a28fba02a4d84918118a5ea4e 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: analog output 'maxdata' is always 12-bit

The boards that have analog outputs always have 12-bit resolution.

Remove the 'i_AoMaxdata' data from the boardinfo and open code the
s->maxdata. Use the hex value for the resolution since that is more
common in 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>
0ed9f25fbc94e8cfe6f5929e6cafa98944d51617 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: refactor 'i_NbrTTLChannel' boardinfo

The boards that have ttl input and output channels always have 24
channels.

Remove the 'i_NbrTTLChannel' data from the boardinfo and add a bit
field to indicate that the board 'has_ttl_io'. Use that to conditionally
initialize the subdevice and open code the s->n_chan value of 24.

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>
4aab8bfd1db3455c062c332e56790e6f046284c7 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: refactor 'i_NbrD[io]Channel' boardinfo

The boards that have digital input and output channels always have
4 inputs and 4 outputs.

Remove the 'i_NbrD[io]Channel' data from the boardinfo and add two
bit fields to indicate that the board 'has_dig_in' and 'has_dig_out'.
Use those to conditionally initialize the subdevices and open code
the s->n_chan value of 4 for both subdevices.

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>
1b5f2f4fa5c276089ed7d7e910657f0e8caaa291 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove 'i_IorangeBase1' from boardinfo

This data 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>
5c70cbfb3a8ebfaac5f3588840fcbf71c3cc02a1 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: move the copyright info to the driver

Move the copyright information from hwdrv_apci3xxx.c to the actual
driver, addi_apci_3xxx.c.

Reformat the information to follow the CodingStyle.

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>
225dfd10bf1bcd47d044cd229ed68b040a1362fa 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove some unused includes

This driver does not use anything provided by these includes.
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>
641abdac09f30d3c1bf99f5a938b61336ced7988 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove COMEDI_SUBD_TTLIO

This driver abuses the enum comedi_subdevice_type by redefining
enum 11 - COMEDI_SUBD_SERIAL as COMEDI_SUBD_TTLIO. The subdevice
that uses COMEDI_SUBD_TTLIO is a TTL Digital Input/Output subdevice.

Remove COMEDI_SUBD_TTLIO and just use COMEDI_SUBD_DIO as the
subdevice type.

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>
1867add98e44d4bec01572b4cfd4becd11297e5d 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: introduce a local private data definition

The struct addi_private definition from the addi-data "common" code is
very bloated. Introduce a local struct apci3xxx_private that just has
the data needed by this driver.

Add a couple includes that this driver depends on and remove the include
of "addi-data/addi_common.h" since this driver no longer depends on 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>
e053b2419f5f0cff8ced6a8e39a93d113d9cd86a 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: introduce a private boardinfo definition

The struct addi_board definition from the addi-data "common" code is
very bloated. Introduce a private struct apci3xxx_boardinfo that just
has the data needed by this driver.

Move the #include "addi-data/hwdrv_apci3xxx.c" so it will have the new
struct definition.

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>
b9671585a9974abf448fb349083aea655b9235bf 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove (*insn_*) callbacks from boardinfo

The same subdevice callbacks are used by all the boards supported by
this driver. Remove the information from the boardinfo and initialize
the subdevices directly.

Remove the callback initializations that are always = NULL.

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>
f57b428c006486c951188354732b469b4b4a1af7 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: remove need for s_EeParameters

The boards supported by this driver do not have an eeprom. Remove the
need for the devpriv->s_EeParameters values by just using the values
from the boardinfo 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>
56e18770ae2991d315c4e164fab47171fc74c96a 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: digital output 'maxdata' is always '1'

Digital output subdevices always have a 'maxdata' of '1'. Remove the
'i_DoMaxData' boardinfo and just open code the 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>
93c0dc284dff2e2fec320662d8ef01b933096e36 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: boards do not have an eeprom

All of the boards supported by this driver have a PCI 9054 chip
without an attached eeprom.

Remove the unused support code that reads the eeprom.

Also, remove the unnecessary 'i_PCIEeprom' and 'pc_EepromChip' data
from the boardinfo.

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>
178bd8d3a61432ce24399604b13cc756293d1ac8 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: boards do not have a timer

None of the boards supported by this driver have a timer. Remove
the unnecessary 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>
fe220a444f977398cb7aa166f8e53837df0bcfff 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: driver does not use dma

This driver does not use dma. Remove the unnecessary 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>
2107347327f7bfd47e6af9fe0510a1750f10f884 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: simplify the PCI bar reading

The boards supported by this driver all have an ADDIDATA_9054 eeprom.
Knowing this we can simplify the code that reads the PCI bars to get
the iobase address used by 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>
98a856213efb9fec7a45491170d9b589ce55572d 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: absorb the private comedi_lrange tables

All the boards supported by this driver have the same private
analog input and output ranges. Absorb the comedi_lrange tables
from hwdrv_apci3xxx.c directly into the driver. For aesthetic
reasons, rename the tables so they have namespace associated
with the driver.

Remove the 'pr_AiRangelist' and 'pr_AoRangelist' data from the
boardinfo and use the range tables directly when initializing
the subdevices.

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>
6c5b0fff8eb76913f0d38e72f4e68e19ea91de04 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: absorb v_APCI3XXX_Interrupt()

All the boards supported by this driver use the same 'interrupt'
callback in the boardinfo. Absorb the interrupt function from
hwdrv_apci3xxx.c directly into the driver. Rename the CamelCase
function to apci3xxx_irq_handler().

Remove v_ADDI_Interrupt(), which indirectly called the interrupt
function, and use apci3xxx_irq_handler instead when requesting
the irq. Remove the 'interrupt' callback from the boardinfo.

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>
ae57b69639bcbd653821f7a4a14b87f6fa6743c0 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: absorb apci3xxx_di_insn_bits()

All the boards supported by this driver that have digital inputs use
the same 'di_bits' callback in the boardinfo. Absorb the function from
hwdrv_apci3xxx.c directly into the driver.

Remove the 'di_bits' callback from the boardinfo and use the function
directly to set the subdevice (*insn_bits).

None of the boards supported by this driver have a 'di_config', 'di_read',
or 'io_write' callback. Remove the unnecessary setting of the subdevice
callbacks.

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>
c3d8605fca03adb70f712512b3df0e0311ac9b61 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: absorb apci3xxx_do_insn_bits()

All the boards supported by this driver that have digital outputs use
the same 'do_bits' callback in the boardinfo. Absorb the function from
hwdrv_apci3xxx.c directly into the driver.

Remove the 'do_bits' callback from the boardinfo and use the function
directly to set the subdevice (*insn_bits).

None of the boards supported by this driver have a 'do_config', 'do_write',
or 'do_read' callback. Remove the unnecessary setting of the subdevice
callbacks.

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>
5e72c7a50709e60663217704b30501bf34afa448 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: absorb apci3xxx_reset()

All the boards supported by this driver use the same 'reset' callback
in the boardinfo. Absorb the reset function, apci3xxx_reset(), from
hwdrv_apci3xxx.c directly into the driver.

Remove i_ADDI_Reset(), which indirectly called the reset function, and
just call apci3xx_reset() directly. Remove the 'reset' callback from
the boardinfo.

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>
98d3385dd68381dd2738a825f8513366c44018b2 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: separate from addi_common.c

This driver currently uses the addi-data "common" code and contains
a lot of bloat.

Copy the code in addi_common.c to this driver and remove the #include
that caused it to be compiled with the driver. This will allow removing
the bloat.

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>
7fd1fd30fd9a12b037045c2e9eba120479e0f329 13-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: clean up i_APCI3XXX_Reset()

Rename the CamelCase function and variables.

Remove the extra comments. Leave the main comments to help with further
cleanup of this 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>
53362177da474ead9b11a4cdbbfc1556067fa2a6 10-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_common: remove i_IorangeBase0 from boardinfo

The i_IorangeBase0 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>
728394d9d059ce16369c22d956bb3315fd014859 10-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_common: remove i_IorangeBase2 from boardinfo

The i_IorangeBase2 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>
dcc8adb28638c0c09b29a551f3745f7182b1a04b 10-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_common: remove i_IorangeBase3 from boardinfo

When it is used, the entire PCI bar is ioremap'ed with pci_ioremap_bar().
The i_IorangeBase3 boardinfo is no longer needed.

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>
b9beb6c7e76a2ab4153b4c6eb675fe3c481300cf 05-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_common: remove 'i_VendorId' and 'i_Device Id'

The vendor/device ids in the boardinfo are not longer needed. Remove
them.

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>
dbae4575661da840353f12dd76499ad587c92519 05-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: addi_apci_3xxx: use the pci id_table 'driver_data'

Create an enum to the boardinfo and pass that enum in the pci_driver
id_table as the driver_data.

Change the macro used to fill in the device table from PCI_DEVICE()
to PCI_VDEVICE(). This allows passing the enum as the next field.

Set the dev->board_ptr before calling addi_auto_attach(). This
removes the need for the common code to search for the boardinfo.

Since the search is not done we can remove the unnecessary board
information from the comedi_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>
b8f4ac237e382accd4b30c75043939f7ed9e79a6 05-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_pci: change the comedi_pci_auto_config() 'context'

The comedi_pci_auto_config() function is used to allow the PCI driver
(*probe) function to automatically call the comedi driver (*auto_attach).
This allows the comedi driver to be part of the PnP process when the
PCI device is detected.

Currently the comedi_pci_auto_config() always passes a 'context' of '0'
to comedi_auto_config(). This makes the 'context' a bit useless.

Modify comedi_pci_auto_config() to allow the comedi pci drivers to pass
a 'context' from the PCI driver.

Make all the comedi pci drivers pass the pci_device_id 'driver_data' as
the 'context'. Since none of the comedi pci drivers currently set the
'driver_data' the 'context' will still be '0'.

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>
33782dd5edf8db3cdb7c81a3523bf743dd0209b7 30-Jan-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: conditionally build in PCI driver support

Separate the comedi_pci_* functions out of drivers.c into a new
source file, comedi_pci.c. This allows conditionally building
support for comedi PCI drivers into the comedi core. Fix the
Kconfig and Makefile appropriately.

Group all the comedi_pci_* prototypes and related defines into one
place in comedidev.h. Protect these prototypes with an #ifdef and
provide some dummy functions so that the mixed ISA/PCI comedi
drivers will still build correctly.

Remove the #include <linux/pci.h> from comedidev.h and drivers.c. This
include is only needed by the comedi PCI driver support code and the
PCI drivers. The include should occur in those files.

Also, remove the #include <linux/pci.h> from a couple non-PCI drivers
since it's not needed.

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>
9901a4d75d007686e8f6473189cafc4b216b7449 22-Jan-2013 Peter Huewe <peterhuewe@gmx.de> staging/comedi: Use comedi_pci_auto_unconfig directly for pci_driver.remove

(Almost) all comedi pci drivers have some wrapper for their
pci_driver.remove function which simply calls comedi_pci_auto_unconfig
which has the same function prototype as the wrapper.

-> we can remove these wrappers and call comedi_pci_auto_unconfig
directly. This removes a lot some boilerplate code and saves some bytes.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
53b800198592b0ff96577ecc5f116f7d902a4362 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: comedi: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a690b7e535f2f97a3a05ee570715abeb60a8910f 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: comedi: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a471eace7baa40cdf16d3f26b2f78ddce613ca8f 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: comedi: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
92cba8f3b42e1cb8211b64e91618102ecc8f0a6d 06-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi-data: use auto_attach instead of attach_pci

Change the addi-data drivers that use the "common" code so they
attach using the generic 'auto_attach' method instead the pci
specific 'attach_pci' method. The 'attach_pci' is deprecated and
is going to be removed.

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>
2b70a4f4f97b70e8cd9d8a16983758aa4fc3450b 06-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi_apci_3xxx: fix digital output 'insn_bits' function

This driver does not follow the comedi API. The digital output 'insn_bits'
function is passed a mask value in data[0] indicating which output bits in
data[1] are changing. The function is then supposed to update the outputs
accordingly and then return the current state of the outputs in data[1].

Fix the 'insn_bits' function so it works like the comedi core expects. The
core can then use the function to emulate the 'insn_read' and 'insn_write'
functions for individual 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>
10f71c7845686b7f93113f1fe6dbc3718d8a8673 06-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi_apci_3xxx: fix digital input 'insn_bits' function

This driver does not follow the comedi API. The digital input 'insn_bits'
function is supposed to return the status of all the input channels in
data[1]. Currently this function is returning the status in data[0]. It
is also unnecessarily testing the size of the return buffer.

Fix the function so it works like the comedi core expects. The core can
then use the function to emulate the 'insn_read' function for individual
channels. This allows removing the i_APCI3XXX_InsnReadDigitalInput()
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>
bf36f012c7ddaff083bb0ef187feddf4d85507a0 01-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi-data: remove addi_amcc_s5933.h

Now that the PCI bus walking has been removed from the addi-data
drivers, the only differenced between addi_amcc_s9533.h and the
standard comedi amcc_s5933.h is the additional defines for the
apci3120 "ADDON RELATED ADDITIONS". Move those defines to
hwdrv_apci3120.c.

Modify all the addi-data drivers to then include the standard
comedi amcc_s5933.h header and delete the duplicate in addi-data.

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>
41be28db534330192bbbec9783e6d43d4432a7fb 01-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi-data: use attach_pci callback

Use the comedi pci auto config mechanism to attach the addi-data
drivers. This allows removing all the PCI bus walking code.

Add a function, addi_find_boardinfo(), to find the driver specific
boardinfo. Since this function is currently in the common code we
have to use the pointer to the boardinfo that is stored in the
comedi_driver 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>
20a22b706b8ee37d1a2282f2c9bf7f2c73a5a7a5 31-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi_apci_*: add module_comedi_pci_driver()

Pull the module init code out of addi_common.c and add it to
each addi-data driver. Rename the data and functions so they
have namespace associated with the drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c33ef61ff9f731efa4a630a9566a4cdf8945f4af 31-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi_apci_*: remove unneeded CONFIG_APCI_* defines

These defines were needed for the #ifdef'ery that used to exist
in addi_common.c. Since that has been removed these are no longer
used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c0a053b8b24d72413a82a16a41f635e6040ccf34 30-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi-data: remove the boardinfo #ifdef'ery

Move the boardinfo for each addi-data driver from addi_common.c to
the individual driver files. This removes the need #ifdef'ery.

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>
317285d71acccbda2fbab7e53d6b33c52a151a32 30-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi-data: remove the MODULE_DEVICE_TABLE #ifdef'ery

Move the MODULE_DEVICE_TABLE for each addi-data driver from addi_common.c
to the individual driver files. This removes the need #ifdef'ery.

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>
bf6a1578c10a4f3ef94a3c744267f18f9c3642bd 30-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi-data: remove the addi-data #include ifdef'ery

Move the addi-data specific #include's from addi_common.h to the
individual driver files.

The apci-1710, apci-3200, and apci-3300 drivers still have floating
point code in them and are currently disabled in the Kconfig and
Makefile. For now, move the fpu_{begin,end} functions from addi_common.c
to the main driver file so we can get rid of the #ifdef'ery.

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>
3d41c44370a9a1e78e53c9997289347ec97d46ee 30-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: addi-data: move the main #include's to the drivers

The addi-data drivers are all built by the main driver files including
addi-data/addi_common.c. That file then includes other files depending
on what driver is being compiled. This is makes the code quite messy
and hard to follow.

Start cleaning it up by removing the unneeded #include's in addi_common.c
and moving the some of the comedi #include's into the individual driver
files.

This is the first step in getting rid of the #ifdef'ery in addi_common.c.

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>
90f703d30dd3e0c16ff80f35e34e511385a05ad5 06-Jun-2010 Arun Thomas <arun.thomas@gmail.com> Staging: comedi: Remove COMEDI_MODULES_MACRO

Add MODULE_AUTHOR, MODULE_LICENSE, and MODULE_DESCRIPTION calls
to the respective C source files instead of calling COMEDI_MODULES_MACRO

Signed-off-by: Arun Thomas <arun.thomas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6d8b0f5be5108f6a3fc922ca4acfbf10e14d6cd0 19-May-2010 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: Give the addi_apci_* drivers different driver names

It is not currently possible for more than one of the addi_apci_*
drivers to register themselves with comedi at once because they all use
the same comedi driver name "addi_common". Give them different names.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c995fe9475e062bab6f5a45ed28cd2d3d955ef43 13-Feb-2009 ADDI-DATA GmbH <info@addi-data.com> Staging: comedi: add addi-data drivers

This adds the addi-data family of comedi drivers to the staging tree

From: ADDI-DATA GmbH <info@addi-data.com>
Cc: David Schleef <ds@schleef.org>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>