Commit Graph

456097 Commits

Author SHA1 Message Date
Ken Cox
836bee9eee Staging: unisys: remove references to __DATE__ and __TIME__
The use of __DATE__ and __TIME__ is no longer allowed in the kernel so this
commit removes those.  They were once useful when the drivers were being
built externally, but now that the drivers are in the kernel the use of the
macros is redundant since the kernel already has the same information
elsewhere.

In addition, using these macros breaks the build if using gcc 4.9.0

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:15:27 -04:00
Paul Bolle
5573e4f615 staging: unisys: remove unused macros
The macros CONFIG_SPAR_GUEST, GUESTDRIVERBUILD, and NOAUTOVERSION are
defined in Makefiles for the Unisys SPAR driver. They are never used.
Remove the lines that define these macros.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:13:40 -04:00
H Hartley Sweeten
0c9a057ceb staging: comedi: s626: remove struct s626_enc_info
The only member left in this struct is the 'chan' which is the
comedi channel of the encoder.

Remove the struct and refactor the code to pass/use the comedi
channel instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:18 -04:00
H Hartley Sweeten
81202ecffc staging: comedi: s626: tidy up s626_enc_insn_read()
Abosorb the s626_read_latch() helper and tidy up this function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:18 -04:00
H Hartley Sweeten
f76d02f81f staging: comedi: s626: remove 'my_event_bits' from encoder private data
This array in the encoder private data just makes the driver harder to
follow.

The S626_EVBITS() macro is used to initialize the member in the declaration.
This macro creates a array of four values, based on the encoder channel, that
are used to mask and set the private data 'counter_int_enabs' member. The
values are created using the S626_OVERMASK() and S626_INDXMASK() macros using
the encoder channel number.

Remove the 'my_event_bits' member from the encoder private data as well
as the S626_EVBITS() macro. Refactor the code to use the S626_OVERMASK() and
S626_INDXMASK() macros directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:18 -04:00
H Hartley Sweeten
b35d6a38be staging: comedi: s626: remove 'set_mode' callback from encoder private data
There are two functions used for the 'set_mode' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Add a helper function, s626_set_mode(), that uses the encoder channel number
to determine which function to call.

Remove the then unnecessary 'set_mode' member and just call s626_set_mode()
directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:18 -04:00
H Hartley Sweeten
0a9844910c staging: comedi: s626: remove 'get_mode' callback from encoder private data
There are two functions used for the 'get_mode' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Add a helper function, s626_get_mode(), that uses the encoder channel number
to determine which function to call.

Remove the then unnecessary 'get_mode' member from the encoder private data.

The 'get_mode' callbacks were not being used by the driver in any of the enabled
code. For now block the s626_get_mode() functions with '#ifdef unused' to prevent
a compiler warning.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:18 -04:00
H Hartley Sweeten
26499b8bce staging: comedi: s626: remove 'reset_cap_flags' callback from encoder private data
There are two functions used for the 'reset_cap_flags' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_reset_cap_flags() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'reset_cap_flags' member and just call s626_reset_cap_flags()
directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:18 -04:00
H Hartley Sweeten
92249e1f79 staging: comedi: s626: remove 'pulse_index' callback from encoder private data
There are two functions used for the 'pulse_index' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_pulse_index() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'pulse_index' member and just call s626_pulse_index()
drectly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
13f2609da8 staging: comedi: s626: remove 'get_int_src' callback from encoder private data
There are two functions used for the 'get_int_src' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_get_int_srsc() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'get_int_src' member from the encoder private data.

The 'get_int_src' callbacks were not being used by the driver. For now block
the s626_get_int_src() function with '#ifdef unused' to prevent a compiler
warning.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
253e2ee4b2 staging: comedi: s626: remove 'set_int_src' callback from encoder private data
There are two functions used for the 'set_int_src' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_set_int_src() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'set_int_src' member and just call s626_set_int_src()
drectly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
c35b86a7cc staging: comedi: s626: remove 'get_load_trig' callback from encoder private data
There are two functions used for the 'get_load_trig' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_get_load_trig() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'get_enable' member from the encoder private data.

The 'get_load_trig' callbacks were not being used by the driver. For now block
the s626_get_load_trig() function with '#ifdef unused' to prevent a compiler
warning.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
7f03b74999 staging: comedi: s626: remove 'set_load_trig' callback from encoder private data
There are two functions used for the 'set_load_trig' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_set_load_trig() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'set_load_trig' member and just call s626_set_load_trig()
drectly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
4487502e84 staging: comedi: s626: remove 'get_enable' callback from encoder private data
There are two functions used for the 'get_enable' callback, s626_get_enable_a()
function is used for the channel 0-2 encoders and s626_get_enable_b() is used
for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_get_enable() function and use the
encoder channel number to handle the differenced.

Remove the then unnecessary 'get_enable' member and just call s626_set_enable()
directly.

The 'get_enable' callbacks were not being used by the driver. For now block the
s626_get_enable() function with '#ifdef unused' to prevent a compiler warning.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
c718f4a14f staging: comedi: s626: remove 'set_enable' callback from encoder private data
There are two functions used for the 'set_enable' callback, s626_set_enable_a()
function is used for the channel 0-2 encoders and s626_set_enable_b() is used
for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_set_enable() function and use the
encoder channel number to handle the differenced.

Remove the then unnecessary 'set_enable' member and just call s626_set_enable()
directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
23201ebb15 staging: comedi: s626: remove my_latch_lsw from encoder private data
This member of the encoder private data can be calculated based on
the comedi channel stored in the 'chan' member of the private data.
Do that instead and remove the unnecessary 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>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
2ffe88f67f staging: comedi: s626: define S626_LP_CNTR* registers based on channel number
Redefining the Counter Preload/Latch registers as a macro that calculates
the register offset based on the comedi channel number.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
de15145299 staging: comedi: s626: remove my_cr[ab] from encoder private data
These members of the encoder private data can be calculated based on
the comedi channel stored in the 'chan' member of the private data.
Do that instead and remove the unnecessary members.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
71961c93a1 staging: comedi: s626: add comedi "chan" number to struct s626_enc_info
Add the comedi "chan" number to the encoder private data so we can then
remove some of the members 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>
2014-06-26 20:11:17 -04:00
H Hartley Sweeten
f114b45a6b staging: comedi: s626: define CRA/CRB registers based on channel number
Start cleaning up the 'struct s626_enc_info' by redefining the my_cra
and my_crb members based on the comedi channel number.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:11:16 -04:00
Chase Southwood
860ba36cbe staging: comedi: addi_apci_1564: move apci1564_interrupt() into addi_apci_1564.c
On moving the function into the driver proper, also check the device is
asserting the shared interrupt line.

This patch also fixes the interrupt handling for the digital input
change-of-state interrupts.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:09:37 -04:00
Chase Southwood
1e15687ea4 staging: comedi: addi_apci_1564: add Change-of-State interrupt subdevice and required functions
This board supports an interrupt that can be generated by an AND/OR
combination of 16 of the input channels.

Create a separate subdevice to handle this interrupt.

The apci1564_di_config() function is used to configure which
inputs are used to generate the interrupt. Currently this function
is broken since it does not follow the comedi API for insn_config
functions. Fix this function by implementing the config instruction
INSN_CONFIG_DIGITAL_TRIG.

Add the remaining subdevice operations necessary for the interrupt
subdevice to support async commands.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:09:37 -04:00
Chase Southwood
4c95a2b6b5 staging: comedi: addi_apci_1564: introduce apci1564_private struct
The addi_private struct defined in addi-data/addi_common.h is very bloated
and contains many fields which addi_apci_1564 does not require.  In the
interest of eventually removing this driver's dependency on
addi_common.h, we can create a private data struct specifically for
addi_apci_1564 containing only the fields it will actually use.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:09:37 -04:00
Chase Southwood
5f193d7365 staging: comedi: addi_apci_1564: remove unused static variables
The global variables ui_InterruptStatus_1564 and ui_InterruptData are both
set but never used.  Just remove them from the driver.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:09:37 -04:00
Chase Southwood
e8ad74f9c7 staging: comedi: addi_apci_1564: remove use of devpriv->b_OutputMemoryStatus
This member of the private data struct is only set at one location in the
entire driver, and then never even used for anything.  Let's just remove
its use.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:09:37 -04:00
H Hartley Sweeten
d7b6c574d1 staging: comedi: dt282x: automatically handle D/A data format
The DT2821 series board have jumpers that set the output range for
the two Analog Output channels. The range_table for the Analog Output
subdevice provides all possible ranges to the user. When a unipolar
range is selected the board expects the data to be in a straight
binary format. When a bipolar range is select the data should be in
two's complement format.

Currently, the user passes some configuration options when attaching
to the driver to select the data format for each channel. If the
user does not pass the config options, the data format is assumed to
be straight binary.

The Analog Output subdevice now has a range_table that provides the
user will all possible ranges. Use the range information to determine
if the data values need to be munged into two's complememnt values
and deprecate the config options.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
c50d32de37 staging: comedi: dt282x: fix bug where DIO direction is reset to inputs
The direction of the 16 DIO channels is controlled with two bits in the
DACSR register. The HBOE bit controls the direction of channels 15-8 and
the LBOE bit channels 7-0.

The DACSR register is also used to control the Analog Output async command
support. Currently, starting or canceling an Analog Output command would
also reset the DIO directions so that all channels were inputs.

Fix the driver so that the DIO direction is not changed when starting or
canceling an Analog Output 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>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
0f8e8c5ab6 staging: comedi: dt282x: tidy up the register map and bit defines
For aesthetics, rename the register map defines so that the bit defines
are associated with the registers. Also, convert all the bit defines into
bit-shifts to make them clear.

Remove all the verbose comments. All the registers and bits are named
according to the User Manual for the DT2821 Series, Document UM-05073-G.
That manual can be checked if necessary for the verbose information.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
3ec2e20274 staging: comedi: dt282x: avoid calculating the timer divisor multiple times
A common timer is used for analog input and output async commands. The
(*do_cmdtest) for both subdevices calculates the divisor as part of
Step 4 when validating the trigger arguments. The divisor is calculated
again in the (*do_cmd) for both subdevices in order to set the timer.

The comedi core only calls the (*do_cmd) is called after a successful
(*do_cmdtest). Save the divisor from the (*do_cmdtest) in the private
data and use that value in the (*do_cmd).

The extra check of the cmd->convert_arg in dt282x_ai_cmd() is not necessary.
The convert_arg was already checked in the (*do_cmdtest), and it's not used
in the (*do_cmd).

Tidy up dt282x_ns_to_timer(), the parameters are all unsigned int's and the
mask of the 'flags' can be moved here to simplify the callers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
7152f7d4b1 staging: comedi: dt282x: 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>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
9c64ef47a7 staging: comedi: dt282x: tidy up multi-line comments
Tidy up the multi-line comments at the beginning of the file to follow
the CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
fc00fbc990 staging: comedi: dt282x: cleanup analog output range table
The DT2821 series boards do not have programmable analog output ranges.
The range is set, per-channel, with jumpers on the board.

Currently the user has to pass some configuration options when attaching
to the driver in order to set the range for each channel. If they do not
pass the range options they will default to 0. If they pass an invalid
range option they will also default to 0. The 0 range option is bipolar
10V. If the user passes a range option that does not match the hardware
setting it doesn't cause any problems in the driver it just causes the
user space comedilib library to incorrectly convert the hardware values
to physical values.

Make the attach a bit simpler by deprecating these options and providing
a range table with all the valid ranges for the analog outputs. The user
can then select the correct range when they use the comedilib functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
d5aa6b7c31 staging: comedi: dt282x: fix Analog Input se/diff channel configuration
Most of the boards supported by this driver can do either single-ended or
differential Analog Input but there are a couple that can only do one or
the other. On the boards that can do both the type of input is set with
jumpers on the board.

The 'it->options[4]' passed by the user during the board (*attach) is used
to determine how the Analog Inputs are configured. This is used to set
the subdevice flags and number of channels correctly.

Fix the check of this option so that it only applies when the board can
actually do differential input. Also, default to differential inputs if
that is the only mode the board supports.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
810c8a88b6 staging: comedi: dt282x: tidy up Analog Input subdevice init
For aesthetics, add some whitespace to the Analog Input subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
9803bc0969 staging: comedi: dt282x: tidy up Analog Output subdevice init
For aesthetics, add some whitespace to the Analog Output subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:20 -04:00
H Hartley Sweeten
f8b987b4d3 staging: comedi: dt282x: remove the 'opt_*' enum
This enum is used to index the 'options' values that are passed
by the user attaches to the driver. These options are identified
in the comedi comment block.

For aesthetics, remove the enum and just open code the index values.

Refactor the Analog Input subdevice init so that the it->options[4],
indicating differential inputs, does not have to be checked multiple
times.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
f4af8d4991 staging: comedi: dt282x: factor board initialization out of (*attach)
For aesthetics, factor the code that initializes the then checks to see
if it is actually a DT2821 series board out of the (*attach).

For clarity, remove the MASK and VAL defines used to check the board and
jsut open code the values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
9504be8a1b staging: comedi: dt282x: fix dt282x_ao_insn_read()
The comedi core expects the (*insn_read) functions to return 'insn->n'
samples. Fix this function to work like the core expects.

For aesthetics, rename the private data 'ao' member to clarify its
use. Also, remove the unnecessary comment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
de91bb9725 staging: comedi: dt282x: tidy up dt282x_ai_dma_interrupt()
The main interrupt handler already has the comedi_subdevice pointer
needed in this function. Pass that subdevice pointer so that it does
not need to be fetched as a local variable.

Tidy up the function a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
e6cff3990d staging: comedi: dt282x: tidy up dt282x_ao_dma_interrupt()
The main interrupt handler already has the comedi_subdevice pointer
needed in this function. Pass that subdevice pointer so that it does
not need to be fetched as a local variable.

Tidy up the function a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
ecac148c60 staging: comedi: dt282x: remove sanity checks of 's->async->prealloc_buf'
The comedi core sanity checks that the subdevice has a buffer allocated
before allowing an async command to start. The helper functions in comedi_buf
will also sanity check the buffer as a side effect of the 'alloc' helpers
with reading or writing data for the buffer.

Remove the unnecessary sanity checks in the ai/ao dma interrupt handlers.
This will allow the handlers to disable the dma and then fail when they
try to read/write the buffer. Currently dma is left enabled due to the
sanity checks.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
f83cbc53da staging: comedi: dt282x: tidy up Digital I/O subdevice init
For aesthetics, add some whitespace to the Digital I/O subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
198c15a63d staging: comedi: dt282x: rename the prep_{ai,ao}_dma() functions
Rename these functions so they have namespace associated with the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
6ee9c91fbb staging: comedi: dt282x: remove unused chan_to_DAC() macro
This macro 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>
2014-06-26 20:08:19 -04:00
H Hartley Sweeten
30dadbd208 staging: comedi: dt282x: convert private data flags to bit-fields
Convert the '2scomp' flags in the private data into bit-fields to save
a bit of space.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:18 -04:00
H Hartley Sweeten
c53a62f64a staging: comedi: dt282x: remove DT2821_SIZE define
This define is only used in the comedi_request_region() call to specify
the size of the I/O region. Remove it and just open code the value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:18 -04:00
H Hartley Sweeten
cb3d0d3996 staging: comedi: dt282x: IRQ and DMA are needed for async command support
This driver requires an IRQ and 2 DMA channels in order to execute async
commands.

Modify the (*attach) so that command support is only hooked up if
DMA is available. This allows removing the extra checks in the
command support functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:18 -04:00
H Hartley Sweeten
ebf86ea9a6 staging: comedi: dt282x: remove 'volatile' on private data variables
As indicated by checkpatch.pl, "WARNING: Use of volatile is usually
wrong: ...". The variables in the private data that are marked
volatile don't need to be. Remove the volatile.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:08:18 -04:00
H Hartley Sweeten
804ee9ac04 staging: comedi: dt282x: fix dt282x_ao_insn_write()
The (*insn_write) functions are expected to write 'insn->n' samples to the
hardware. Fix this function so it works like the comedi core expects.

The comedi core sanity checks that the samples are within the 'maxdata' range
of the subdevice before calling the (*insn_write) so this function does not
need to mask each sample by 's->maxdata'.

Also, the wrong '*2scomp' flag in the private data was being checked to see
if the sample needs to be munged before being written. Fix 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>
2014-06-26 20:08:18 -04:00
H Hartley Sweeten
58c8c47fda staging: comedi: dt282x: convert 'dabits' boardinfo to 'ao_maxdata'
This member of the boardinfo is the number of bits in the analog output data.
Convert this member into the subdevice 'maxdata', (1 << board->dabits) - 1,
to avoid needing to do the calculation.

Use the subdevice 'maxdata' in the driver instead of using the boardinfo and
use the comedi_offset_munge() helper to convert the two's complement data to
the offset binary form that the comedi core expects.

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