Commit Graph

6839 Commits

Author SHA1 Message Date
Chase Southwood
6c410db7c4 staging: comedi: change some printk calls to pr_err
There are a handful of calls to printk in ni_stc.h without specified log
levels, as well as one in ni_mio_common.c.  This patch converts these
calls to pr_err() instead, so that they are now explicitly log level
ERR.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:54:43 -08:00
Ian Abbott
e87f65b238 staging: comedi: adl_pci9118: eliminate DMA buffer defragmentation step
The DMA operations used by the driver may have been set up to acquire
data from unwanted channels in addition to the wanted channels.
Currently, `interrupt_pci9118_ai_dma()` calls `defragment_dma_buffer()`
to move all the wanted data to the start of the DMA buffer and then
calls `comedi_buf_write_samples()` to copy it all to the comedi async
buffer.  Those two functions used to be called from
`move_block_from_dma()` which was absorbed into
`interrupt_pci9118_ai_dma()`.

Reinstate `move_block_from_dma()` but rewrite it to copy data directly
from the wanted fragments of the DMA buffer to the comedi async buffer
without defragmenting the buffer first.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:31:20 -08:00
Ian Abbott
bb4a51a1b5 staging: comedi: adl_pci9118: try and avoid unnecessary DMA restart
`interrupt_pci9118_ai_dma()` is called on interrupt to transfer data
from DMA buffers into the comedi async data buffer.  Currently it always
restarts DMA.  If double buffering, it restarts DMA on the next DMA
buffer before processing the current DMA buffer, otherwise it restarts
DMA on the same DMA buffer after it has been processed.

For single buffering we can avoid restarting the DMA transfer by
checking the async event flags after the current buffer has been
processed, which is easy.

For double buffering, we need to know how many valid samples there are
in the current buffer before it has been processed and determine whether
there is enough to complete the acquisition.  Call new function
`valid_samples_in_act_dma_buf()` to determine the number of valid
samples in the current DMA buffer, and compare that with the result of
`comedi_nsamples_left()` to determine if DMA needs to be restarted.
(`comedi_nsamples_left()` needs an upper bound to clamp to, so use the
number of valid samples in the DMA buffer plus one for our test.)

It is still possible for DMA to be restarted unnecessarily in the double
buffer case if a `COMEDI_CB_OVERFLOW` event occurs while copying to the
comedi async buffer, but it doesn't really matter.  The ongoing DMA
operation will get disabled when the subdevice's `cancel()` handler is
called when the events are handled later in the interrupt service
routine (as it does currently).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:31:20 -08:00
Ian Abbott
ac33c20dad staging: comedi: adl_pci9118: simplify interrupt_pci9118_ai_dma() a bit
Eliminate the `next_dma_buf` variable in `interrupt_pci9118_ai_dma()`.
It holds the next value of `devpriv->dma_actbuf` when double buffering
is used, but we can just set that to the next value directly at the
point where the buffers are switched as the old value is not used
anywhere else.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:31:20 -08:00
H Hartley Sweeten
14ec083866 staging: comedi: adv_pci1723: remove comedi_device 'write_subdev' init
The comedi_device 'write_subdev' should only be initialized if the subdevice
supports async commands.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:40:00 -08:00
H Hartley Sweeten
c3a132c75d staging: comedi: adv_pci1723: tidy up multi-line comments
Tidy up the multi-line comments 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>
2014-11-26 15:40:00 -08:00
H Hartley Sweeten
e5092d7969 staging: comedi: adv_pci1723: update the MODULE_DESCRIPTION
Update the MODULE_DESCRIPTION to something more useful than the
generic "Comedi low-level driver".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:40:00 -08:00
H Hartley Sweeten
817c5ac2dc staging: comedi: adv_pci1723: remove subdevice 'len_chanlist' initialization
The subdevice 'len_chanlist' is only used by subdevices that support async
commands. Remove the unnecessary initializations in 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>
2014-11-26 15:40:00 -08:00
H Hartley Sweeten
348aeaa712 staging: comedi: adv_pci1723: tidy up DIO io_bits initialization
Tidy up the code that determines the initial io_bits (direction) of the
digital I/O subdevice and remove the magic numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:40:00 -08:00
H Hartley Sweeten
0f35abd5ed staging: comedi: adv_pci1723: tidy up pci1723_dio_insn_config()
For aesthetics, tidy this function up and use the register defines
to remove the magic numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:40:00 -08:00
H Hartley Sweeten
c8a14b924c staging: comedi: adv_pci1723: use comedi_subdevice readback for 'ao_data'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only analog output subdevice. Remove the
then unused 'ao_data' member from the private data.

The private data is now unnecessary. Remove it and the allocation.

For aesthetics, rename the (*insn_write) function and tidy it up a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:59 -08:00
H Hartley Sweeten
5317f9a629 staging: comedi: adv_pci1723: absorb pci1723_reset()
This function is only called by the (*auto_attach) to reset all the analog
output channels. For aesthetics, absorb the function.

Fix the range programming for each channel. According to the users manual
the "range strobe" register needs to be written after setting the "DAC range
control" register in order to load the range setting.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:59 -08:00
H Hartley Sweeten
b5ed2b2843 staging: comedi: adv_pci1723: remove board reset during (*detach)
The pci1723_reset() function simply resets all the analog output channels
to 0V and a +/-10V range. This really isn't necessary when detaching the
driver.

Remove the board reset and just use comedi_pci_detach() directly for the
(*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:59 -08:00
H Hartley Sweeten
24001039a4 staging: comedi: adv_pci1723: remove private data 'da_range'
This member of the private data is initialized to 0 by pci1723_reset()
and is not used any where else in the driver. Remove it.

Use the register map defines to set the range for each output channel.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:59 -08:00
H Hartley Sweeten
01601aaf9f staging: comedi: adv_pci1723: tidy up register map
For aesthetics, rename the defines used for the register map offsets and
remove the unnecessary comments. Add the bit defines for the registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:59 -08:00
H Hartley Sweeten
5f86288fc5 staging: comedi: ni_labpc_common: use comedi_timeout() when writing to eeprom
Use the comedi_timeout() helper to wait for the eeprom to be ready to accept
writes and remove the timeout loop in labpc_eeprom_write().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
45c311c438 staging: comedi: ni_labpc_common: use subdevice readback for eeprom
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the eeprom subdevice. Remove the then unused
'eeprom_data' member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
c82f0e6b36 staging: comedi: ni_labpc_common: use subdevice readback for analog outputs
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the analog output subdevice. Remove the then unused
'ao_value' member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
8e06519b27 staging: comedi: ni_labpc_common: introduce labpc_ao_write()
Introduce a helper function to write a value to a given DAC channel.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
1e3d3a4d1b staging: comedi: ni_labpc_common: use subdevice readback for 'caldac'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only caldac subdevice. Remove the then unused
'caldac' member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
332f46e4be staging: comedi: ni_labpc_common: move calib readback value check/save to (*insn_write)
Move the check/save of the calib subdevice value to the (*insn_write) 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>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
f8990d088c staging: comedi: ni_at_ao: use subdevice readback for 'caldac'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only caldac subdevice. Remove the then unused
'caldac' member from the private data.

Tidy up atao_calib_insn_write().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
e42151f945 staging: comedi: cb_pcidas: use subdevice readback for 'dac08_value'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only dac08 calib subdevice. Remove the
then unused 'dac08_value' member from the private data.

The dac08 calib subdevice only has one channel. For consistency in the driver,
modify the subdevice init so that a loop is used to initialize the channels and
readback values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:17 -08:00
H Hartley Sweeten
9c034da124 staging: comedi: cb_pcidas: tidy up dac08_write_insn()
For consistency with the other calib subdevices, refactor this (*insn_write)
function so that it only writes the final data value to the hardware.,

For aesthetics, rename the function so it has 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>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
a1c7675898 staging: comedi: cb_pcidas: use subdevice readback for 'trimpot_value'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only trimpot calib subdevice. Remove the
then unused 'trimpot_value' member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
7a82a2c4e4 staging: comedi: cb_pcidas: fix trimpot_write_insn()
The comedi core expects the (*insn_write) functions to write 'insn->n'
values to the hardware and return the number of values written. Currently
this function only writes the first value. For this subdevice it only makes
sense to write the final data value.

Fix the function to work like the core expects. For aesthetics, rename the
function so it has 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>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
3f5ced0d02 staging: comedi: cb_pcidas: use subdevice readback for 'caldac_value'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only caldac subdevice. Remove the then
unused 'caldac_value' member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
f52e5e44a9 staging: comedi: cb_pcidas: fix caldac_write_insn()
The comedi core expects the (*insn_write) functions to write 'insn->n'
values to the hardware and return the number of values written. Currently
this function only writes the first value. For this subdevice it only makes
sense to write the final data value.

Fix the function to work like the core expects. For aesthetics, rename the
function so it has 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>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
06b66dc22b staging: comedi: cb_pcidas: remove unnecessary check in caldac_8800_write()
The 'address' passed to this function is actually the comedi channel. This
value will always be less than the subdevice n_chan (which is 8). Remove
the unnecessary sanity check in caldac_8800_write().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
dc658fdc8a staging: comedi: cb_pcidas64: fix ad8402_write_insn()
The comedi core expects the (*insn_write) functions to write 'insn->n'
values to the hardware and return the number of values written. Currently
this function only writes the first value. For this subdevice it only makes
sense to write the final data value.

Fix the function to work like the core expects. For aesthetics, rename the
function so it has 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>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
fe1184e49a staging: comedi: cb_pcidas64: use subdevice readback for 'ad8402_state'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only calibration subdevice. Remove the
then unused 'ad8402_state' member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
5e2de5e7f9 staging: comedi: cb_pcidas64: fix calib_write_insn()
The comedi core expects the (*insn_write) functions to write 'insn->n'
values to the hardware and return the number of values written. Currently
this function only writes the first value. For this subdevice it only makes
sense to write the final data value.

Fix the function to work like the core expects. For aesthetics, rename the
function so it has 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>
2014-11-26 15:39:16 -08:00
H Hartley Sweeten
37318bdb14 staging: comedi: cb_pcidas64: use subdevice readback for 'caldac_state'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only calibration subdevice. Remove the
then unused 'caldac_state' member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:39:15 -08:00
H Hartley Sweeten
aa11672ef4 staging: comedi: drivers: have core hook up default (*insn_read) for readback
Most of the comedi drivers that provide readback for write only subdevices now
use the comedi core comedi_alloc_subdev_readback() helper to allocate the subdevice
'reaback' member instead of using some member in their private data. These drivers
also hook up the (*insn_read) callback to the comedi_readback_insn_read() helper to
provide the readback.

Have the core automatically hook up the (*insn_read) callback after allocating the
memory if the driver has not already hooked it up to a private 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>
2014-11-26 15:37:52 -08:00
H Hartley Sweeten
474bfe5ff9 staging: comedi: adv_pci1724: rename ao_ranges_1724
For aesthetics, rename the analog output comedi_lrange table so
it has 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>
2014-11-26 15:36:42 -08:00
H Hartley Sweeten
bd6e4a4141 staging: comedi: adv_pci1724: tidy up multi-line comments
Tidy up the multi-line comments 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>
2014-11-26 15:36:42 -08:00
H Hartley Sweeten
35581695d0 staging: comedi: adv_pci1724: tidy up the comedi_driver declaration
For aesthetics, add some whitespace to the comedi_driver declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
4360bb2f14 staging: comedi: adv_pci1724: tidy up the pci_driver declaration
For aesthetics, add some whitespace to the pci_driver declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
bbef9b17eb staging: comedi: adv_pci1724: remove unnecessary dev_info()
Remove the unnecessary noise at the end of the (*auto_attach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
27de4358f9 staging: comedi: adv_pci1724: absorb setup_subdevices()
For aesthetics, absorb this function into the (*auto_attach).

Add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
70adf763ba staging: comedi: adv_pci1724: define the board id register bits
For aesthetics, remove the enum and define the bits for this register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
80b00a5842 staging: comedi: adv_pci1724: remove enum sync_output_trigger_contents
This enum is not used in the driver. Remove it.

For aesthetics, rename the register define and move the comment that
any value will trigger the sync output.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
14356535fb staging: comedi: adv_pci1724: define the sync output control/status reg
Define the bits for the synchronous output control/status register and
remove the enum.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
83d94bcc8e staging: comedi: adv_pci1724: define the dac control register bits
Define the bits for the DAC control register and remove the enum along
with the helper functions.

Simplify adv_pci1724_insn_write() a bit. The 'ctrl' bits are based on
the 'chan' and 'mode' and do not need to be recalculated for each 'val'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
c2edc02163 staging: comedi: adv_pci1724: tidy up the register I/O map
For aesthetics, convert the enum board_registers into defines and rename
them 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>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
7b13c4633c staging: comedi: adv_pci1724: remove PCI_VENDOR_ID_ADVANTECH define
This define is already in pci_ids.h. Remove the duplicate in 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>
2014-11-26 15:36:41 -08:00
H Hartley Sweeten
77aa39330a staging: comedi: adv_pci1724: absorb set_dac()
Absorb this simple function into adv_pci1724_insn_write().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:40 -08:00
H Hartley Sweeten
e25e22b012 staging: comedi: adv_pci1724: use comedi_timeout() to wait for DAC idle state
Use the comedi_timeout() helper to wait for the DAC to be idle before
writing to it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:40 -08:00
H Hartley Sweeten
dcbd4ed87c staging: comedi: adv_pci1724: introduce adv_pci1724_insn_write()
The analog output, offset calib, and gain calib subdevices all use similar
(*insn_write) functions. The onyl difference is the 'mode' that is passed
to the set_dac() helper.

Introduce a new (*insn_write) function that can be used by all the subdevices.
Use the s->private member to pass the 'mode' needed by set_dac(). Remove the
subdevice specific (*insn_write) functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 15:36:40 -08:00
H Hartley Sweeten
21cdf8f43b staging: comedi: adv_pci1724: remove NUM_AO_CHANNELS define
This define is now only used to set each of the subdevice 'n_chan'. For
clarity, remove the define and open code the values.

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