]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
9 years agostaging: comedi: adv_pci1723: use comedi_subdevice readback for 'ao_data'
H Hartley Sweeten [Fri, 21 Nov 2014 21:22:31 +0000 (14:22 -0700)]
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>
9 years agostaging: comedi: adv_pci1723: absorb pci1723_reset()
H Hartley Sweeten [Fri, 21 Nov 2014 21:22:30 +0000 (14:22 -0700)]
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>
9 years agostaging: comedi: adv_pci1723: remove board reset during (*detach)
H Hartley Sweeten [Fri, 21 Nov 2014 21:22:29 +0000 (14:22 -0700)]
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>
9 years agostaging: comedi: adv_pci1723: remove private data 'da_range'
H Hartley Sweeten [Fri, 21 Nov 2014 21:22:28 +0000 (14:22 -0700)]
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>
9 years agostaging: comedi: adv_pci1723: tidy up register map
H Hartley Sweeten [Fri, 21 Nov 2014 21:22:27 +0000 (14:22 -0700)]
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>
9 years agostaging: comedi: ni_labpc_common: use comedi_timeout() when writing to eeprom
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:36 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: ni_labpc_common: use subdevice readback for eeprom
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:35 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: ni_labpc_common: use subdevice readback for analog outputs
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:34 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: ni_labpc_common: introduce labpc_ao_write()
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:33 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: ni_labpc_common: use subdevice readback for 'caldac'
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:32 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: ni_labpc_common: move calib readback value check/save to (*insn_write)
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:31 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: ni_at_ao: use subdevice readback for 'caldac'
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:30 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas: use subdevice readback for 'dac08_value'
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:29 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas: tidy up dac08_write_insn()
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:28 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas: use subdevice readback for 'trimpot_value'
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:27 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas: fix trimpot_write_insn()
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:26 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas: use subdevice readback for 'caldac_value'
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:25 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas: fix caldac_write_insn()
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:24 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas: remove unnecessary check in caldac_8800_write()
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:23 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas64: fix ad8402_write_insn()
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:22 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas64: use subdevice readback for 'ad8402_state'
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:21 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas64: fix calib_write_insn()
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:20 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: cb_pcidas64: use subdevice readback for 'caldac_state'
H Hartley Sweeten [Thu, 20 Nov 2014 22:07:19 +0000 (15:07 -0700)]
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>
9 years agostaging: comedi: drivers: have core hook up default (*insn_read) for readback
H Hartley Sweeten [Fri, 21 Nov 2014 17:19:10 +0000 (10:19 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: rename ao_ranges_1724
H Hartley Sweeten [Thu, 20 Nov 2014 22:11:02 +0000 (15:11 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: tidy up multi-line comments
H Hartley Sweeten [Thu, 20 Nov 2014 22:11:01 +0000 (15:11 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: tidy up the comedi_driver declaration
H Hartley Sweeten [Thu, 20 Nov 2014 22:11:00 +0000 (15:11 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: tidy up the pci_driver declaration
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:59 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: remove unnecessary dev_info()
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:58 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: absorb setup_subdevices()
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:57 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: define the board id register bits
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:56 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: remove enum sync_output_trigger_contents
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:55 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: define the sync output control/status reg
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:54 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: define the dac control register bits
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:53 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: tidy up the register I/O map
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:52 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: remove PCI_VENDOR_ID_ADVANTECH define
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:51 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: absorb set_dac()
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:50 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: use comedi_timeout() to wait for DAC idle state
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:49 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: introduce adv_pci1724_insn_write()
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:48 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: remove NUM_AO_CHANNELS define
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:47 +0000 (15:10 -0700)]
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>
9 years agostaging: comedi: adv_pci1724: use subdevice readback for 'gain_value'
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:46 +0000 (15:10 -0700)]
staging: comedi: adv_pci1724: use subdevice readback for 'gain_value'

Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only gain calib subdevice. Remove the
then unused 'gain_value' member from the private data.

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

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>
9 years agostaging: comedi: adv_pci1724: use subdevice readback for 'offset_value'
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:45 +0000 (15:10 -0700)]
staging: comedi: adv_pci1724: use subdevice readback for 'offset_value'

Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
to handle the readback of the write-only offset calib subdevice. Remove the
then unused 'offset_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>
9 years agostaging: comedi: adv_pci1724: use subdevice readback for 'ao_value'
H Hartley Sweeten [Thu, 20 Nov 2014 22:10:44 +0000 (15:10 -0700)]
staging: comedi: adv_pci1724: use subdevice readback for 'ao_value'

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_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>
9 years agostaging: comedi: me4000: Fixed code style issue
Marcus Hufvudsson [Sat, 15 Nov 2014 15:55:20 +0000 (16:55 +0100)]
staging: comedi: me4000: Fixed code style issue

Fixed checkpatch.pl error message. Space prohibited before that ','

Signed-off-by: Marcus Hufvudsson <marcushuf@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das6402: add (*do_cmd) for AI async commands
H Hartley Sweeten [Thu, 13 Nov 2014 18:41:04 +0000 (11:41 -0700)]
staging: comedi: das6402: add (*do_cmd) for AI async commands

Flesh out the (*do_cmd) function to support timed analog input
acquisitions.

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>
9 years agostaging: comedi: das6402: read analog input samples in interrupt handler
H Hartley Sweeten [Thu, 13 Nov 2014 18:41:03 +0000 (11:41 -0700)]
staging: comedi: das6402: read analog input samples in interrupt handler

Currently the interrupt handler just clears the interrupt.

Add the code necessary to read the analog input samples when running
an async command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das6402: introduce das6402_ai_set_mode()
H Hartley Sweeten [Thu, 13 Nov 2014 18:41:02 +0000 (11:41 -0700)]
staging: comedi: das6402: introduce das6402_ai_set_mode()

Introduce a helper function to set the analog input acquisition mode.
This will be needed when the (*do_cmd) function is completed to support
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>
9 years agostaging: comedi: das6402: add basic (*do_cmdtest) for AI async commands
H Hartley Sweeten [Thu, 13 Nov 2014 18:41:01 +0000 (11:41 -0700)]
staging: comedi: das6402: add basic (*do_cmdtest) for AI async commands

Currently the async command support in this driver consists of just the
stubbed in functions.

Flesh out the (*do_cmdtest) function for basic support of timed analog
input acquisitions.

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>
9 years agostaging: comedi: fix scan_end_arg == chanlist_len assumption
Ian Abbott [Wed, 12 Nov 2014 16:00:48 +0000 (16:00 +0000)]
staging: comedi: fix scan_end_arg == chanlist_len assumption

Some comedi drivers allow the `scan_end_arg` value of an asynchronous
command to be a multiple (> 1) of the `chanlist_len` although most
require them to be the same value.

`comedi_bytes_per_scan()` is incorrectly using `chanlist_len` as the
length of the scan.  Change it to use `scan_end_arg`.

`comedi_nsamples_left()` is incorrectly using `cur_chan` as the current
sample position in the scan (it is actually the current position in the
channel list).  Change it to use the actual sample position in the scan.
(Unfortunately we only have the current scan position in bytes currently,
so convert that to a sample position.)

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>
9 years agostaging: comedi: dmm32at: update the MODULE_DESCRIPTION
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:46 +0000 (16:55 -0700)]
staging: comedi: dmm32at: update the MODULE_DESCRIPTION

Change 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>
9 years agostaging: comedi: dmm32at: tidy up multi-line comments
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:45 +0000 (16:55 -0700)]
staging: comedi: dmm32at: tidy up multi-line comments

Reformat the multi-line comments for 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_AIRBACK
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:44 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_AIRBACK

For aesthetics, rename this define used for the Analog I/O Readback register.
Define the bits of the 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_AICONF
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:43 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_AICONF

For aesthetics, rename this define used for the Analog Configuration register.
Define the bits of the 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_CNTRDIO
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:42 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_CNTRDIO

For aesthetics, rename this define used for the Counter and Digital I/O
Configuration register. Define the bits of the 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_INTCLOCK
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:41 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_INTCLOCK

For aesthetics, rename this define used for the Interrupt and A/D Clock Control
and Status register. Also, rename the defines for the bits of the 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_AISTAT
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:40 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_AISTAT

For aesthetics, rename this define used for the A/D Status register. Also,
rename the defines for the bits of the register.

The probe code in dmm32at_reset() checks this register to make sure the
S/D1 and S/D0 bits are set. This check actually verifies that the board is
configured (with jumpers on the board) with all the Analog Input channels
operating in single-ended mode. Add a comment about this.

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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_CNTRL
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:39 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_CNTRL

For aesthetics, rename this define used for the Miscellaneous Control
register. Also, rename the defines for the bits of the 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_FIFOSTAT
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:38 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_FIFOSTAT

For aesthetics, rename this define used for the FIFO Status register.
Define the bits of the 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_FIFOCNTRL
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:37 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_FIFOCNTRL

For aesthetics, rename this define used for the FIFO Control register.
Also, rename the defines used for the bits of 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>
9 years agostaging: comedi: dmm32at: define the FIFO Depth register
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:36 +0000 (16:55 -0700)]
staging: comedi: dmm32at: define the FIFO Depth register

This driver currently does not use the FIFO. For completeness, define
the offset to the FIFO Depth 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_DACMSB_CHAN
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:35 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_DACMSB_CHAN

For aesthetics, rename this define used to set the DACH[10] bits in
the DAC MSB register to select the D/A 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_DACSTAT
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:34 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_DACSTAT

For aesthetics, rename this define used for the Status / Auxillary Digital
Inputs register. Document the bits in the 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_DAC[LM]SB
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:33 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_DAC[LM]SB

For aesthetics, rename these defines used for the D/A LSB/MSB 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_AI{LOW,HIGH}
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:32 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_AI{LOW,HIGH}

For aesthetics, rename these defines used for the A/D Low/High Channel
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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_AUXDOUT
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:31 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_AUXDOUT

For aesthetics, rename this define used for the Auxillary Digital Output
register. This register is currently not used in the driver. Document the
bits of the register for completeness.

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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_AI[LM]SB
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:30 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_AI[LM]SB

For aesthetics, rename these defines used for the A/D LSB/MSB 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>
9 years agostaging: comedi: dmm32at: rename DMM32AT_CONV
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:29 +0000 (16:55 -0700)]
staging: comedi: dmm32at: rename DMM32AT_CONV

For aesthetics, rename this define used for the Start A/D Conversion 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>
9 years agostaging: comedi: dmm32at: use 8255 module for Digital I/O subdevice
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:28 +0000 (16:55 -0700)]
staging: comedi: dmm32at: use 8255 module for Digital I/O subdevice

The Dimond-MM-32-AT board uses an internal 82C55-type digital I/O circuit to
provide the 24 digital I/O lines. The only quirk is the need to set the page
selection bits in the control register to select page 1 addresses.

Instead of duplicating the 8255 code, provide an (*io) callback and use the
8255 module to support this subdevice.

This also removes the need for the private data 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>
9 years agostaging: comedi: dmm32at: introduce dmm32at_ai_set_chanspec()
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:27 +0000 (16:55 -0700)]
staging: comedi: dmm32at: introduce dmm32at_ai_set_chanspec()

Introduce a helper function to set the analog input channel scan and range
control registers. Use the new helper in the analog input (*insn_read) and
(*do_cmd) functions.

The extra sanity checks in the (*do_cmd) are not necessary. The cmd->chanlist
will always be valid and the (*do_cmdtest) validates the channel list in
Step 5.

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>
9 years agostaging: comedi: dmm32at: remove unused members of the private data
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:26 +0000 (16:55 -0700)]
staging: comedi: dmm32at: remove unused members of the private data

The 'data' and 'ai_inuse' members in the private data are not used in the
driver. 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>
9 years agostaging: comedi: dmm32at: remove dmm32at_ns_to_timer()
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:25 +0000 (16:55 -0700)]
staging: comedi: dmm32at: remove dmm32at_ns_to_timer()

This function is not necessary. It simply returns the 'ns' value that was
passed to it.

Remove it as well as the unnecessary Step 4 check of the cmd->convert_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>
9 years agostaging: comedi: dmm32at: tidy up cmd->convert_{src, arg} validation
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:24 +0000 (16:55 -0700)]
staging: comedi: dmm32at: tidy up cmd->convert_{src, arg} validation

This driver only supports a single convert_src, TRIG_TIMER. Tidy up
the (*do_cmdtest) validation of the cmd->convert_{src,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>
9 years agostaging: comedi: dmm32at: tidy up cmd->scan_begin_{src, arg} validation
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:23 +0000 (16:55 -0700)]
staging: comedi: dmm32at: tidy up cmd->scan_begin_{src, arg} validation

This driver only supports a single scan_begin_src, TRIG_TIMER. Tidy up
the (*do_cmdtest) validation of the cmd->scan_begin_{src,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>
9 years agostaging: comedi: dmm32at: tidy up subdevice initialization
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:22 +0000 (16:55 -0700)]
staging: comedi: dmm32at: tidy up subdevice initialization

For aesthetics, add some whitespace to the 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>
9 years agostaging: comedi: dmm32at: introduce dmm32at_reset()
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:21 +0000 (16:55 -0700)]
staging: comedi: dmm32at: introduce dmm32at_reset()

For aesthetics, factor the board reset and detection code out of the
(*attach) 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>
9 years agostaging: comedi: dmm32at: tidy up dmm32at_ai_rinsn()
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:20 +0000 (16:55 -0700)]
staging: comedi: dmm32at: tidy up dmm32at_ai_rinsn()

For aesthetics, rename this function to dmm32at_ai_insn_read().

Get the 'chan' and 'range' from the chanspec when declaring the local
variables. Remove the unecessary masking of the 'chan'.

Remove some unnecessary comments.

Change the final return to 'insn->n' to clarify the return 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>
9 years agostaging: comedi: dmm32at: introduce dmm32_ai_get_sample()
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:19 +0000 (16:55 -0700)]
staging: comedi: dmm32at: introduce dmm32_ai_get_sample()

Introduce a helper function to read the two's complement analog input
sample from the hardware and munge it to the offset binary (unsigned)
format that comedi expects. Use the comedi_offset_munge() helper to
munge the data.

Use the new helper in the analog input (*insn_read) and in the interrupt
handler for the async command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: dmm32at: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:18 +0000 (16:55 -0700)]
staging: comedi: dmm32at: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_scans_left' and use the comedi_async
'scans_done' to detect the end-of-acquisition.

This also removes the artifical max limit on the cmd->stop_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>
9 years agostaging: comedi: dmm32at: make AI (*cancel) actually cancel async command
H Hartley Sweeten [Tue, 11 Nov 2014 23:55:17 +0000 (16:55 -0700)]
staging: comedi: dmm32at: make AI (*cancel) actually cancel async command

Currently the AI (*cancel) changes a private data member to cause the
interrupt handler to cancel the async command after the next interrupt.

Move the code that disables the interrupt and terminates the acquisition
from the interrunt handler into dmm32at_ai_cancel() so that the async
command is terminated instantly.

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>
9 years agostaging: comedi: adl_pci9111: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Tue, 11 Nov 2014 00:28:23 +0000 (17:28 -0700)]
staging: comedi: adl_pci9111: use comedi_async 'scans_done' to detect EOA

The comedi core now counts the number of samples added to the async buffer and
detects the end-of-scan and increments the comedi_async 'scans_done' counter.

Remove the private data member 'stop_counter' and use the 'scans_done' member
to detect the end-of-acquisition.

This fixes a possible interger overflow when calculating the value of the
'stop_counter' and removes the need to accumulate the 'total' number of
samples added to the async buffer in pci9111_handle_fifo_half_full().

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>
9 years agostaging: comedi: adl_pci9118: use comedi_bytes_to_samples()
H Hartley Sweeten [Tue, 11 Nov 2014 00:57:56 +0000 (17:57 -0700)]
staging: comedi: adl_pci9118: use comedi_bytes_to_samples()

Remove the assumption of the sample size by using the comedi_bytes_to_samples()
helper function to convert the number of bytes to the number of samples.

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>
9 years agostaging: comedi: adl_pci9118: absorb move_block_from_dma()
H Hartley Sweeten [Tue, 11 Nov 2014 00:57:55 +0000 (17:57 -0700)]
staging: comedi: adl_pci9118: absorb move_block_from_dma()

Absorb this simple helper function into interrupt_pci9118_ai_dma().

Remove the unnecessary local variables 'sampls' and 'm'.

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>
9 years agostaging: comedi: adl_pci9118: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Tue, 11 Nov 2014 00:57:54 +0000 (17:57 -0700)]
staging: comedi: adl_pci9118: use comedi_async 'scans_done' to detect EOA

The comedi core now counts the number of samples added to the async buffer and
detects the end-of-scan and increments the comedi_async 'scans_done' counter.

Remove the private data member 'ai_act_scan' and use the 'scans_done' member
to detect the end-of-acquisition.

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>
9 years agostaging: comedi: addi_watchdog: use addi_tcw.h defines for watchdog
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:21 +0000 (16:20 -0700)]
staging: comedi: addi_watchdog: use addi_tcw.h defines for watchdog

Use the generic TCW (timer/counter/watchdog) defines for the 8-bit watchdog.

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>
9 years agostaging: comedi: addi_apci_1564: enable support for PLD Rev 1.0 I/O mapping
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:20 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: enable support for PLD Rev 1.0 I/O mapping

Remove the error return in the (*auto_attach) and allow the driver to
attach to APC-1564 boards that use the PLD Rev 1.0 I/O mapping.

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>
9 years agostaging: comedi: addi_apci_1564: use addi_tcw.h defines for counters
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:19 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: use addi_tcw.h defines for counters

Use the generic TCW (timer/counter/watchdog) defines for the 32-bit counters.

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>
9 years agostaging: comedi: addi_apci_1564: use addi_tcw.h defines for timer
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:18 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: use addi_tcw.h defines for timer

Use the generic TCW (timer/counter/watchdog) defines for the 12-bit timer.

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>
9 years agostaging: comedi: addi_tcw.h: provide generic defines for the ADDI-DATA TCW
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:17 +0000 (16:20 -0700)]
staging: comedi: addi_tcw.h: provide generic defines for the ADDI-DATA TCW

The TCW (timer/counter/watchdog) devices in the various ADDI-DATA drivers
use a common register map definition. Provide a common generic define for
these registers so they don't have to be replicated in each 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>
9 years agostaging: comedi: addi_apci_1564: split timer and counter subdevices
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:16 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: split timer and counter subdevices

The timer subdevice is currently broken in this driver.

The Rev 1.0 and 2.x versions of the board both have a 12-bit timer. But only
the Rev 2.x boards have the 3 32-bit counters.

Split the current timer subdevice into two separate subdevices:
  1) A single channel 12-bit timer subdevice
  2) A three channel 32-bit counter subdevice

This represents the hardware correctly and the counters can be disabled on
the Rev 1.0 boards.

Split up the current (*insn_config), (*insn_write), and (*insn_read) so they
only deal with the hardware associated with 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>
9 years agostaging: comedi: addi_apci_1564: move counter register defines to driver
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:15 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: move counter register defines to driver

Move the defines for the counter registers from the included source
file to the main driver source file.

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>
9 years agostaging: comedi: addi_apci_1564: fix counter code in main driver source
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:14 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: fix counter code in main driver source

The Rev 1.0 APCI-1564 boards do not have counters.

Fix the code in the main driver source so that the I/O accesses to the
counters do not happen if the devpriv->counters member is not initialized.

This does not fix the code in hwdrv_apci1564.c. That code violates the
comedi API and is currently broken.

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>
9 years agostaging: comedi: addi_apci_1564: fix timer iobase for all PLD revisions
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:13 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: fix timer iobase for all PLD revisions

The APCI-1564 has different I/O mapping depending on if the PLD revision
is Rev 1.0 or Rev 2.x.

Add a member, 'timer', to the private data for the base address of the
12-bit timer. Fix the register defines so they will work for all PLD
revisions and initialize the devpriv->timer appropriately.

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>
9 years agostaging: comedi: addi_apci_1564: fix dev->iobase for all PLD revisions
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:12 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: fix dev->iobase for all PLD revisions

The APCI-1564 has different I/O mapping depending on if the PLD revision is
Rev 1.0 or Rev 2.x.

Fix the main register defines so they will work for all PLD revisions and
initialie the dev->iobase appropriately. Move the register defines to the
main driver source file.

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>
9 years agostaging: comedi: addi_apci_1564: detect PLD revision for I/O mapping
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:11 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: detect PLD revision for I/O mapping

The APCI-1564 has different I/O mapping depending on if the PLD revision is
Rev 1.0 or Rev 2.x. The revision can be determined by reading the EEPROM
register at offset 0x00 of PCI BAR 0 and checking the value of bits 7 to 4.

Add this check to apci1564_auto_attach(). Currently this driver is coded
to work with the Rev 2.x I/O mapping. For now, fail the attach if a Rev 1.0
PLD is detected. Document the I/O mapping for both revisions.

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>
9 years agostaging: comedi: addi_apci_1564: use dev->iobase for main registers
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:10 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: use dev->iobase for main registers

According to ADDI-DATA, the PLD Revision 2.x versions of the APCI-1564 use
PCI BAR 0 for the main registers of the board.

Remove the 'amcc_iobase' member of the private data and use the dev->iobase
to store the base address of PCI BAR 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>
9 years agostaging: comedi: addi_apci_1564: store PCI BAR 1 base address in private data
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:09 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: store PCI BAR 1 base address in private data

According to ADDI-DATA, only the PLD Revision 2.x versions of the APCI-1564
have the 3 counters. The base address for these counters is found in PCI BAR 1.

For aesthetics, save this base address in the private data. The dev->iobase
can then be used for the main registers of the board.

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>
9 years agostaging: comedi: addi_apci_1564: use correct I/O base for APCI1564_DI_INT_STATUS_REG
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:08 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: use correct I/O base for APCI1564_DI_INT_STATUS_REG

The APCI1564_DI_INT_STATUS_REG is located in the PCI BAR 0 I/O space. That
base address is stored in devpriv->amcc_iobase. Use that to correctly read
the 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>
9 years agostaging: comedi: addi_apci_1564: board does not use an AMCC PCI controller
H Hartley Sweeten [Mon, 10 Nov 2014 23:20:07 +0000 (16:20 -0700)]
staging: comedi: addi_apci_1564: board does not use an AMCC PCI controller

According to ADDI-DATA, the APCI-1564 board has a FPGA with a PCI core, it
does not use an AMCC PCI controller chip.

Remove the amcc_s5933.h include as well as the read of the AMCC_OP_REG_INTCSR
register. That offset would actually read APCI1564_WDOG_STATUS_REG register
in the FPGA which has nothing to do with the interrupt status.

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>
9 years agortl8188eu: Fix a typo in rtw_led.*
Krzysztof Konopko [Thu, 6 Nov 2014 23:24:27 +0000 (00:24 +0100)]
rtl8188eu: Fix a typo in rtw_led.*

A rather obvious typo in one of the identifier has been found.  This patch
fixes the typo and ensures any lines changed do not exceed 80 characters
as indicated by scripts/checkpatch.pl

Signed-off-by: Krzysztof Konopko <kris@konagma.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agortl8188eu: Fix FSF_MAILING_ADDRESS in rtw_led.*
Krzysztof Konopko [Thu, 6 Nov 2014 23:24:26 +0000 (00:24 +0100)]
rtl8188eu: Fix FSF_MAILING_ADDRESS in rtw_led.*

rtw_led.* files include Free Software Foundation's mailing address in
the sample GPL notice.  This is not desired and picked when running
scripts/checkpatch.pl.

Signed-off-by: Krzysztof Konopko <kris@konagma.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>