]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
10 years agostaging: comedi: addi_apci_3120: move apci3120_ao_insn_write() to driver source
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:42 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: move apci3120_ao_insn_write() to driver source

Move this function, and its helper function, from the included hwdrv_apci31210.c
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>
10 years agostaging: comedi: addi_apci_3120: move apci3120_di_insn_bits() to driver source
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:41 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: move apci3120_di_insn_bits() to driver source

Move this function from the included hwdrv_apci31210.c 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>
10 years agostaging: comedi: addi_apci_3120: move apci3120_do_insn_bits() to driver source
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:40 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: move apci3120_do_insn_bits() to driver source

Move this function from the included hwdrv_apci31210.c 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>
10 years agostaging: comedi: addi_apci_3120: remove private data 'ai_running'
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:39 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove private data 'ai_running'

This member of the private data was used to determine if the interrupt
routine was handling data for the (*insn_read) or an async command. Now
that the (*insn_read) does not use interrupts this member is not needed.

Remove the member and refactor 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>
10 years agostaging: comedi: addi_apci_3120: define status register bits
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:38 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: define status register bits

Define the bits in the status register and use them to 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>
10 years agostaging: comedi: addi_apci_3120: rename APCI3120_RD_STATUS
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:37 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: rename APCI3120_RD_STATUS

For aesthetics, rename this define used for the status register offset.

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>
10 years agostaging: comedi: addi_apci_3120: remove private data 'ui_AiChannelList'
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:36 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove private data 'ui_AiChannelList'

This member of the private data is no longer 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>
10 years agostaging: comedi: addi_apci_3120: remove private data 'ui_AiNbrofChannels'
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:35 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove private data 'ui_AiNbrofChannels'

This member of the private data is always the cmd->chanlist_len. Use that
instead and remove the member.

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>
10 years agostaging: comedi: addi_apci_3120: absorb apci3120_interrupt_handle_eos()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:34 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: absorb apci3120_interrupt_handle_eos()

Absorb this simple function into apci3120_interrupt().

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>
10 years agostaging: comedi: addi_apci_3120: fix apci3120_ai_insn_read()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:33 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: fix apci3120_ai_insn_read()

Now that the scanning and interrupt support have been removed from this
function it can be refactored to work correctly.

The comedi core expects (*insn_read) functions to read insn->n values
from the hardware and return the number of samples read. This function
currently just reads one sample but it returns insn->n.

Fix this function to work like the core expects.

Use comedi_timeout() to prevent a possible deadlock in the loop that
waits for the end-of-conversion.

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>
10 years agostaging: comedi: addi_apci_3120: remove private data 'ui_AiReadData'
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:32 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove private data 'ui_AiReadData'

This member of the private data was used to return analog input samples that
were acquired for the (*insn_read) using interrupts. The interrupt support
code for the (*insn_read) has been removed. Remove this unused 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>
10 years agostaging: comedi: addi_apci_3120: remove apci3120_ai_insn_config()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:31 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove apci3120_ai_insn_config()

This function does not follow the comedi API for (*insn_config) functions.
It's also no long needed. 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>
10 years agostaging: comedi: addi_apci_3120: remove interrupt support from ai (*insn_read)
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:30 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove interrupt support from ai (*insn_read)

(*insn_read) functions are supposed to do simple polled reads of a single
channel. This driver tries to be tricky and allow enabling interrupts in
the analog input (*insn_config) to allow the (*insn_read) to read samples
with the end-of-conversion interrupt.

The (*insn_config) doesn't follow the comedi API and this operation mode
is not part of the API.

Remove the interrupt support from the (*insn_read) as well as the support
code in the (*insn_config) and 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>
10 years agostaging: comedi: addi_apci_3120: remove private data 'ui_EocEosConversionTime'
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:29 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove private data 'ui_EocEosConversionTime'

This driver tries to be tricky and allow passing an analog input conversion time
for the (*insn_read) in the (*insn_config).  The (*insn_config) doesn't follow
the comedi API and this programmable conversion time is not part of the API for
(*insn_read) operations.

Remove the member from the private data and use a fixed 10us (10000ns) conversion
time in the (*insn_read).

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>
10 years agostaging: comedi: addi_apci_3120: remove scanning from ai (*insn_read)
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:28 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove scanning from ai (*insn_read)

(*insn_read) functions are supposed to do simple polled reads of a single
channel. This driver tries to be tricky and allow passing a chanlist in
the analog input (*insn_config) to allow the (*insn_read) to do chanlist
scanning with or without interrupts.

The (*insn_config) doesn't follow the comedi API and this operation mode
is not part of the API.

Remove the scanning support from the (*insn_read) as well as the support
code in the (*insn_config) and 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>
10 years agostaging: comedi: addi_apci_3120: rename APCI3120_WRITE_MODE_SELECT
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:27 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: rename APCI3120_WRITE_MODE_SELECT

For aesthetics, rename this define used for the mode register offset.

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>
10 years agostaging: comedi: addi_apci_3120: define the timer 2 clock select bits
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:26 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: define the timer 2 clock select bits

For aesthetics, redefine the bits in the mode register used to select the
clock for timer 2.

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>
10 years agostaging: comedi: addi_apci_3120: define the timer 2 operation bits
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:25 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: define the timer 2 operation bits

For aesthetics, redefine the bits in the mode register used to set the
operation mode of timer 2.

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>
10 years agostaging: comedi: addi_apci_3120: define the "enable" bits in the mode register
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:24 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: define the "enable" bits in the mode register

For aesthetics, redefine the bits in the mode register that enable interrupts
and scanning.

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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_SCAN
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:23 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_SCAN

This define is not used in 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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOS_INT
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:22 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOS_INT

For aesthetics, remove this define and just use ~APCI3120_ENABLE_EOS_INT.

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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOC_INT
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:21 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOC_INT

For aesthetics, remove this define and just use ~APCI3120_ENABLE_EOC_INT.

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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_INT
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:20 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_INT

For aesthetics, remove this define and just use ~APCI3120_ENABLE_TIMER_INT.

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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_WATCHDOG
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:19 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_WATCHDOG

For aesthetics, remove this define and just use ~APCI3120_ENABLE_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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_COUNTER
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:18 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_COUNTER

For aesthetics, remove this define and just use ~APCI3120_ENABLE_TIMER_COUNTER.

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>
10 years agostaging: comedi: addi_apci_3120: remove devpriv->mode '0xef' magic value
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:17 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove devpriv->mode '0xef' magic value

This mask value is the same as APCI3120_DISABLE_TIMER_COUNTER. Use that
instead and remove the "magic" 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>
10 years agostaging: comedi: addi_apci_3120: remove unnecessary devpriv->mode masking
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:16 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove unnecessary devpriv->mode masking

The devpriv->mode is set to '0' at the start of apci3120_ai_insn_read() and
apci3120_cyclic_ai(). There is no need to clear any of the bits or do any
of the additional writes of those cleared bits.

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>
10 years agostaging: comedi: addi_apci_3120: rename private data 'b_ModeSelectRegister'
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:15 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: rename private data 'b_ModeSelectRegister'

Rename this CamelCase member of the private data and tidy up the mask/set
of its bits.

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>
10 years agostaging: comedi: addi_apci_3120: properly disable interrupts in apci3120_cancel()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:14 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: properly disable interrupts in apci3120_cancel()

The APCI3120_DISABLE_ALL_INTERRUPT define is a mask value used to clear bits
in devpriv->b_ModeSelectRegister to disable the interrupt sources. Writing this
value directly sets unintended bits.

Just set the devpriv->b_ModeSelectRegister to '0' and write that to 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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_ALL_INTERRUPT_WITHOUT_TIMER
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:13 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_ALL_INTERRUPT_WITHOUT_TIMER

At the start of apci3120_ai_insn_read() the devpriv->b_ModeSelectRegister is set
to '0'. Remove the unnecessary masking to clear the interrupt enable bits.

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>
10 years agostaging: comedi: addi_apci_3120: move ai range table to driver source
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:12 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: move ai range table to driver source

Move the analog input comedi_lrange table from the included hwdrv_apci3120.c
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>
10 years agostaging: comedi: addi_apci_3120: introduce apci3120_ai_reset_fifo()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:11 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: introduce apci3120_ai_reset_fifo()

A dummy read of APCI3120_TIMER_MODE_REG resets the analog input FIFO. Introduce
a helper function to clarify this.

It's not necessary to do a dummy read of the FIFO (base + 0) before reseting it.
Remove the unnecessary dummy reads.

The APCI3120_TIMER_MODE_REG is a 16-bit register. This fixes a couple 8-bit reads.

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>
10 years agostaging: comedi: addi_apci_3120: remove 'check' param from apci3120_setup_chan_list()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:10 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove 'check' param from apci3120_setup_chan_list()

This parameter is always passed as '0'. Remove it and refactor 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>
10 years agostaging: comedi: addi_apci_3120: tidy up scan chanlist programming
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:09 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: tidy up scan chanlist programming

Define the chanlist register and its bits and tidy up the programming
of the scan chanlist.

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>
10 years agostaging: comedi: addi_apci_3120: remove unnecessary reset of the scan sequence
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:08 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: remove unnecessary reset of the scan sequence

The scan sequence does not need to be reset when the driver is attached. Remove
the code in apci3120_reset() that does 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>
10 years agostaging: comedi: addi_apci_3120: introduce apci3120_clr_timer2_interrupt()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:07 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: introduce apci3120_clr_timer2_interrupt()

A dummy read of APCI3120_CTR0_REG clears the timer 2 interrupt. Introduce a
helper function to clarify 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>
10 years agostaging: comedi: addi_apci_3120: move apci3120_exttrig_enable() to driver source
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:06 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: move apci3120_exttrig_enable() to driver source

Move this helper function from the included source file into 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>
10 years agostaging: comedi: addi_apci_3120: move apci3120_timer_enable() to driver source
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:05 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: move apci3120_timer_enable() to driver source

Move this helper function from the included source file into 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>
10 years agostaging: comedi: addi_apci_3120: rename APCI3120_WR_ADDRESS
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:04 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: rename APCI3120_WR_ADDRESS

For aesthetics, rename this define.

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>
10 years agostaging: comedi: addi_apci_3120: fix timer 2 disable in apci3120_write_insn_timer()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:03 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: fix timer 2 disable in apci3120_write_insn_timer()

The wrong define is being used to disable the gate to stop timer 2 in this
function.

Use the apci3120_timer_enable() helper to properly disable the 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>
10 years agostaging: comedi: addi_apci_3120: introduce apci3120_timer_enable()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:02 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: introduce apci3120_timer_enable()

Introduce a helper function to enable/disable a timer.

The disable of timers 0 and 1 in apci3120_interrupt() is probably not needed.
For now use the helper function to make sure the devpriv->ctrl bits are cleared
correctly to disable the timers.

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>
10 years agostaging: comedi: addi_apci_3120: tidy up apci3120_exttrig_{enable,disable}()
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:01 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: tidy up apci3120_exttrig_{enable,disable}()

Merge these two functions and use an 'enable' parameter to determine if the
external trigger needs to be enabled or disabled.

This function always succeeds and the callers don't check the return. Change
the return type to void.

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>
10 years agostaging: comedi: addi_apci_3120: rename APCI3120_ENABLE_EXT_TRIGGER
H Hartley Sweeten [Tue, 4 Nov 2014 17:54:00 +0000 (10:54 -0700)]
staging: comedi: addi_apci_3120: rename APCI3120_ENABLE_EXT_TRIGGER

For aesthetics, rename this define.

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>
10 years agostaging: comedi: addi_apci_3120: tidy up APCI3120_ENABLE_TIMER[012]
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:59 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: tidy up APCI3120_ENABLE_TIMER[012]

For aesthetics, replace these defines with a macro that returns the
correct bit needed to set the gate bit to enable a 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>
10 years agostaging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER[012]
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:58 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER[012]

For aesthetics, remove these defines and just use ~APCI3120_ENABLE_TIMER[012].

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>
10 years agostaging: comedi: addi_apci_3120: tidy up devpriv->ctrl use
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:57 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: tidy up devpriv->ctrl use

The apci3120_setup_chan_list() function sets devpriv->ctrl to the scan length
(PR) and scan start (PA) values and writes the value to the register. There is
no need to mask the value first.

The apci3120_ai_insn_read() function calles apci3120_setup_chan_list(). There
is no need to clear devpriv->ctrl first or clear any additional bits and write
the register again. This also fixes an incorrect use of APCI3120_DISABLE_TIMER0
to disable the timer.

apci3120_cyclic_ai() also calls apci3120_setup_chan_list() so it does not need
to clear devpriv->ctrl or clear any addidional bits and write the register.

Update the comments in apci3120_reset() and apci3120_cancel().

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>
10 years agostaging: comedi: addi_apci_3120: rename private data 'us_OutputRegister'
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:56 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: rename private data 'us_OutputRegister'

Rename this CamelCase member of the private data and tidy up the mask/set
of its bits.

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>
10 years agostaging: comedi: addi_apci_3120: move timer helpers to main driver source
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:55 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: move timer helpers to main driver source

Move the timer read/write and set mode helpers from the included source
file into 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>
10 years agostaging: comedi: addi_apci_3120: introduce apci3120_timer_set_mode()
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:54 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: introduce apci3120_timer_set_mode()

Introduce a helper function to set the operation mode of a 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>
10 years agostaging: comedi: addi_apci_3120: tidy up timer_mode masking
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:53 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: tidy up timer_mode masking

Define a macro that returns the mask of the timer_mode bits for a given
timer. Use the macro to remove the "magic" values used to clear the bits.

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>
10 years agostaging: comedi: addi_apci_3120: rename private data 'b_TimerSelectMode'
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:52 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: rename private data 'b_TimerSelectMode'

Rename this CamelCase member of the private data and tidy up the mask/set
of its bits.

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>
10 years agostaging: comedi: addi_apci_3120: rename APCI3120_TIMER_VALUE
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:51 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: rename APCI3120_TIMER_VALUE

For aesthetics, rename this register offset.

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>
10 years agostaging: comedi: addi_apci_3120: fix counter and external interrupt disable
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:50 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: fix counter and external interrupt disable

The APCI3120_DISABLE_ALL_TIMER define define is not needed, and it's used
incorrectly in apci3120_cancel(). The define is a mask of the bits needed
to disable the counters. Writing the value directly sets unintended bits.

Prior to writing the value, the 'devpriv->us_OutputRegister' is set to 0
and written to the register. This disables all the timers and the external
trigger.

Remove the unnecessary apci3120_exttrig_disable() call as well as the write
of APCI3120_DISABLE_ALL_TIMER.

In apci3120_interrupt(), remove the unnecessary mask and write to disable
all the timers. The COMEDI_CB_EOA event will cause the core to call the
(*cancel) operation which will disable the timers.

Remove the unused define.

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>
10 years agostaging: comedi: addi_apci_3120: tidy up CTR0 register defines
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:49 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: tidy up CTR0 register defines

Define the CTR0 register in the main driver source file and remove all
the old defines in hwrdv_apci3120.c.

For aesthetics, save the raw digital output state (devpriv->do_bits) in
the digital output (*insn_bits) function and use a macro to set them when
reading/writing a timer.

Use the CTR0 register define in the digital output (*insn_bits) function
and remove the current register define.

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>
10 years agostaging: comedi: addi_apci_3120: introduce apci3120_timer_read()
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:48 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: introduce apci3120_timer_read()

Introduce a helper function to select a timer and read a value from 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>
10 years agostaging: comedi: addi_apci_3120: introduce apci3120_timer_write()
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:47 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: introduce apci3120_timer_write()

Introduce a helper function to select a timer and write a value 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>
10 years agostaging: comedi: addi_apci_3120: rename private data 'b_DigitalOutputRegister'
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:46 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: rename private data 'b_DigitalOutputRegister'

Rename this CamelCase member of 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>
10 years agostaging: comedi: addi_apci_3120: introduce apci3120_ns_to_timer()
H Hartley Sweeten [Tue, 4 Nov 2014 17:53:45 +0000 (10:53 -0700)]
staging: comedi: addi_apci_3120: introduce apci3120_ns_to_timer()

The timer divisor calculations in this driver are over complicated.

There are three timers on the board. They all use the same base clock
with a fixed prescaler for each timer. The base clock used depends on
the board version and type:

  APCI-3120 Rev A boards OSC = 14.29MHz base clock (~70ns)
  APCI-3120 Rev B boards OSC = 20MHz base clock (50ns)
  APCI-3001 boards OSC = 20MHz base clock (50ns)

The prescalers for each timer are:

  Timer 0 CLK = OSC/10
  Timer 1 CLK = OSC/1000
  Timer 2 CLK = OSC/1000

Add a new member to the private data, 'osc_base', to hold the base clock
time. Set this member during the board attach.

Introduce a helper function to calculate the divisor needed to generate
a nanosecond time with a given timer.

Use the new helper function in the driver to 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>
10 years agostaging: dgap: introducing find_board_by_major()
Daeseok Youn [Thu, 6 Nov 2014 10:27:59 +0000 (19:27 +0900)]
staging: dgap: introducing find_board_by_major()

use find_board_by_major function instead of getting a brd from static
arrary. Becasue tty's major number doesn't start zero and we can
find a brd from dgap_board[].

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: remove useless variables for saving tty's major
Daeseok Youn [Thu, 6 Nov 2014 10:27:33 +0000 (19:27 +0900)]
staging: dgap: remove useless variables for saving tty's major

The board_t has a tty_struct(serial_driver and print_driver)
that has a major number. When major number is compared in
dgap_tty_open(), just use brd->serial_driver{print_driver}->major.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix memory leak caused by double allocation of tty_structs
Daeseok Youn [Thu, 6 Nov 2014 10:27:11 +0000 (19:27 +0900)]
staging: dgap: fix memory leak caused by double allocation of tty_structs

The tty_struct of serial_driver and print_driver were getting
allocated twice. One is allocated in tty_alloc_driver(), the other
is in dgap_tty_register(). So remove these in dgap_tty_register().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: set tty's flags by tty_alloc_driver()
Daeseok Youn [Thu, 6 Nov 2014 10:26:47 +0000 (19:26 +0900)]
staging: dgap: set tty's flags by tty_alloc_driver()

tty's flags can be set by calling tty_alloc_driver().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das1800: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:41 +0000 (10:31 -0700)]
staging: comedi: das1800: use comedi_async 'scans_done' to detect EOA

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

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the 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>
10 years agostaging: comedi: quatech_daqp_cs: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:40 +0000 (10:31 -0700)]
staging: comedi: quatech_daqp_cs: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'count' and use the comedi_async '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>
10 years agostaging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AO EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:39 +0000 (10:31 -0700)]
staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AO EOA

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

Use the comedi_nsamples_left() helper to get the number of samples to actually
read from the 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>
10 years agostaging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AI EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:38 +0000 (10:31 -0700)]
staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AI EOA

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

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the 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>
10 years agostaging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AO EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:37 +0000 (10:31 -0700)]
staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AO EOA

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

Use the comedi_nsamples_left() helper to get the number of samples to actually
read from the 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>
10 years agostaging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AI EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:36 +0000 (10:31 -0700)]
staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AI EOA

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

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the 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>
10 years agostaging: comedi: usbduxfast: use comedi_async 'scans_done' to detect AI EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:35 +0000 (10:31 -0700)]
staging: comedi: usbduxfast: use comedi_async 'scans_done' to detect AI EOA

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

Use the comedi_nsamples_left() helper to get the number of samples to actually
add to the 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>
10 years agostaging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AI EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:34 +0000 (10:31 -0700)]
staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AI EOA

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

Use the comedi_nsamples_left() helper to work out the number of 'wake' samples in
pci230_ai_update_fifo_trigger_level() and the number of 'todo' samples actually
added to the async buffer in pci230_handle_ai().

Remove the unnecessary COMEDI_CB_OVERFLOW event for the hardware FIFO overflow
error. The COMEDI_CB_ERROR event will terminate the command.

comedi_buf_write_samples() can fail if the async buffer does not have room for
the sample. The it will set the COMEDI_CB_OVERFLOW event and return 0. Detect
this and quit trying to read and add more samples. The event will terminate the
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>
10 years agostaging: comedi: drivers: introduce comedi_nsamples_left()
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:33 +0000 (10:31 -0700)]
staging: comedi: drivers: introduce comedi_nsamples_left()

Introduce a helper function to calculate the number of samples remaining
when the cmd->stop_src is TRIG_COUNT.

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>
10 years agostaging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AO EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:32 +0000 (10:31 -0700)]
staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AO EOA

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

Use the helper function comedi_nscans_left() to get the number of scans in the
async buffer of left in the 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>
10 years agostaging: comedi: comedi_test: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:31 +0000 (10:31 -0700)]
staging: comedi: comedi_test: use comedi_async 'scans_done' to detect EOA

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

Use the helper function comedi_nscans_left() to check if the number of scans
left in the 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>
10 years agostaging: comedi: amplc_pci224: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:30 +0000 (10:31 -0700)]
staging: comedi: amplc_pci224: use comedi_async 'scans_done' to detect EOA

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

Use the helper function comedi_nscans_left() to determine the number of scans
available in the async buffer or left in the 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>
10 years agostaging: comedi: drivers: introduce comedi_nscans_left()
H Hartley Sweeten [Wed, 5 Nov 2014 17:31:29 +0000 (10:31 -0700)]
staging: comedi: drivers: introduce comedi_nscans_left()

Introduce a helper function to determine the number of scans left in
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>
10 years agostaging: comedi: split out PCI support into new module
Ian Abbott [Fri, 31 Oct 2014 17:47:39 +0000 (17:47 +0000)]
staging: comedi: split out PCI support into new module

Setting the `CONFIG_COMEDI_PCI_DRIVERS` kernel configuration option
makes the main "comedi" module depend on the PCI support in the kernel.
That's not that big a deal since PCI support in the kernel is either
built into the kernel or is absent, and is not in a separate module.
Still, not all low-level Comedi drivers need PCI support, so we could
save a bit of space by not including it.  The Comedi PCI support
functions are all in "comedi_pci.c".  Turn it into a separate module so
the support code doesn't have to be loaded unnecessarily.

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>
10 years agostaging: comedi: split out USB support into new module
Ian Abbott [Fri, 31 Oct 2014 17:47:38 +0000 (17:47 +0000)]
staging: comedi: split out USB support into new module

Setting the `CONFIG_COMEDI_USB_DRIVERS` kernel configuration option
makes the main "comedi" module depend on the "usbcore" module.  But
perhaps the machine has no USB controllers (or they have been disabled),
in which case the "usbcore" module may have been pulled in
unnecessarily.  Only a few low-level Comedi drivers require USB support.
The Comedi USB support functions are all in "comedi_usb.c".  Turn it
into a separate module so we don't have to pull in the "usbcore" and
"usb_common" modules unnecessarily.

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>
10 years agostaging: comedi: split out PCMCIA support into new module
Ian Abbott [Fri, 31 Oct 2014 17:47:37 +0000 (17:47 +0000)]
staging: comedi: split out PCMCIA support into new module

Setting the `CONFIG_COMEDI_PCMCIA_DRIVERS` kernel configuration option
makes the main "comedi" module depend on the "pcmcia" module, but many
machines don't have PCMCIA slots and only a few low-level Comedi drivers
need PCMCIA support.  The Comedi PCMCIA support functions are all in
"comedi_pcmcia.c".  Turn it into a separate module so we don't have to
pull in the other PCMCIA support modules unnecessarily.

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>
10 years agostaging: comedi: comedidev.h: remove some #ifdefs
Ian Abbott [Fri, 31 Oct 2014 17:47:36 +0000 (17:47 +0000)]
staging: comedi: comedidev.h: remove some #ifdefs

Some declarations and macro definitions in "comedidev.h" are protected
by various `#ifdef`s for kernel configuration options, but the header
file compiles fine without the `#ifdef`s regardless of whether those
config option macros are defined or not.  Remove the `#ifdef`s and
compile the affected code unconditionally.

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>
10 years agostaging: comedi: comedidev.h: remove dummy PCI support functions
Ian Abbott [Fri, 31 Oct 2014 17:47:35 +0000 (17:47 +0000)]
staging: comedi: comedidev.h: remove dummy PCI support functions

Some low-level Comedi driver modules used to handle PCI devices and ISA
devices in the same module with some conditional compilation.  To reduce
the amount of conditional compilation, some dummy inline versions of
`comedi_to_pci_dev()`, `comedi_pci_enable()`, `comedi_pci_disable()`,
and `comedi_pci_detach()` are defined in "comedidev.h" if
`CONFIG_COMEDI_PCI_DRIVERS` is undefined.  Since those Comedi low-level
driver modules have since had PCI support split out into separate
modules, there is no need to keep the dummy inline functions around any
more, so remove them.

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>
10 years agostaging: vt6655: Fix issue of byPacketType is not set at all.
Malcolm Priestley [Thu, 6 Nov 2014 20:02:05 +0000 (20:02 +0000)]
staging: vt6655: Fix issue of byPacketType is not set at all.

set by calling CARDbyGetPktType.

change CARDbIsOFDMinBasicRate to check basic_rates.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: BBbReadEmbedded replace __iomem with vnt_private
Malcolm Priestley [Thu, 6 Nov 2014 20:02:04 +0000 (20:02 +0000)]
staging: vt6655: BBbReadEmbedded replace __iomem with vnt_private

Changing callers to point to private

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: BBbWriteEmbedded replace __iomem with vnt_private for callers
Malcolm Priestley [Thu, 6 Nov 2014 20:02:03 +0000 (20:02 +0000)]
staging: vt6655: BBbWriteEmbedded replace __iomem with vnt_private for callers

Referencing dwIoBase inside function.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: baseband/rf s_bAL7230Init change __iomem for baseband functions
Malcolm Priestley [Thu, 6 Nov 2014 20:02:02 +0000 (20:02 +0000)]
staging: vt6655: baseband/rf s_bAL7230Init change __iomem for baseband functions

Replace __iomem with vnt_private providing pointer for dwIoBase

Change BBvPowerSaveModeON and BBvPowerSaveModeOFF to vnt_private and
reference __iomem there, to be removed later.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: baseband replace __iomem where caller is priv dereferenced.
Malcolm Priestley [Thu, 6 Nov 2014 20:02:01 +0000 (20:02 +0000)]
staging: vt6655: baseband replace __iomem where caller is priv dereferenced.

Replace with stucture vnt_private *priv

in functions
BBvSoftwareReset
BBvSetTxAntennaMode
BBvSetRxAntennaMode
BBvSetDeepSleep
BBvExitDeepSleep

__iomem *dwIoBase will be moved into BBbWriteEmbedded and BBbReadEmbedded
later.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: baseband.h remove pDevice from struct vnt_private pointer
Malcolm Priestley [Thu, 6 Nov 2014 20:02:00 +0000 (20:02 +0000)]
staging: vt6655: baseband.h remove pDevice from struct vnt_private pointer

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: dereferencing NULL pointer
Sudip Mukherjee [Fri, 7 Nov 2014 12:18:35 +0000 (17:48 +0530)]
staging: unisys: dereferencing NULL pointer

we can reach the label Away in total five situation and in four of
of them pDevInfo is NULL. so we were basically dereferencing a NULL
pointer.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: unneeded NULL check
Sudip Mukherjee [Fri, 7 Nov 2014 12:18:34 +0000 (17:48 +0530)]
staging: unisys: unneeded NULL check

the NULL check for memregion is not required as it has already been
checked for NULL after kzalloc. so we can reach this part of the code
only if memregion is not NULL.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Add braces to else arm of if/else statement
Bryan Thompson [Thu, 6 Nov 2014 19:13:11 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Add braces to else arm of if/else statement

Add braces to the else arm of an if/else block in visorchannel_funcs.c

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Rename goto label Away
Bryan Thompson [Thu, 6 Nov 2014 19:13:10 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Rename goto label Away

Rename the goto label used throughout visorchannel_funcs.c from Away to cleanup.

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Adjust lines to contain a maximum of 80 characters
Bryan Thompson [Thu, 6 Nov 2014 19:13:09 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Adjust lines to contain a maximum of 80 characters

Split multiple logging lines to get them closer to 80 characters per line.

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Place logical continuation at the end of a line
Bryan Thompson [Thu, 6 Nov 2014 19:13:08 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Place logical continuation at the end of a line

Move the || logical continuation from the start of the second line of an if statement to the end of the first line.

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Remove unnecessary parentheses
Bryan Thompson [Thu, 6 Nov 2014 19:13:07 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Remove unnecessary parentheses

Remove extraneous parentheses around a variable in visorchannel_funcs.c

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Remove space between cast and variable
Bryan Thompson [Thu, 6 Nov 2014 19:13:06 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Remove space between cast and variable

Remove the whitespace between a cast and the variable in visorchannel_funcs.c

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Fix alignment issues
Bryan Thompson [Thu, 6 Nov 2014 19:13:05 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Fix alignment issues

Use the appropriate whitespace for multiline statements in visorchannel_funcs.c

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorchannel: Remove multiple blank lines
Bryan Thompson [Thu, 6 Nov 2014 19:13:04 +0000 (14:13 -0500)]
staging: unisys: visorchannel: Remove multiple blank lines

Remove the instances of multiple blank lines in the visorchannel files.

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das800: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:09 +0000 (10:21 -0700)]
staging: comedi: das800: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'count' and use the comedi_async '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>
10 years agostaging: comedi: addi_apci_3120: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:08 +0000 (10:21 -0700)]
staging: comedi: addi_apci_3120: use comedi_async 'scans_done' to detect EOA

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

The function v_APCI3120_InterruptDmaMoveBlock16bit() is then just a wrapper
for comedi_buf_write_samples(). 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>
10 years agostaging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AI EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:07 +0000 (10:21 -0700)]
staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AI EOA

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

Move the EOA check so it happens after adding the samples from the current
urb to the async buffer. This prevents the unnecessary resubmit of the urb
when the EOA occurs.

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>
10 years agostaging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:06 +0000 (10:21 -0700)]
staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA

Remove the private data member 'ao_sample_count' and use the comedi_async
'scans_done' member to detect the analog output 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>