Commit Graph

7506 Commits

Author SHA1 Message Date
H Hartley Sweeten
a69153f66f staging: comedi: das800: cleanup das800_probe()
Make this function return a pointer to the boardinfo instead of an index.
 Since it's not typical, add a comment to clarify why this legacy driver
does a probe. For aesthetics, rename the local variable 'board' to 'index.

Consolidate the dev_dbg() messages when a probed boardinfo is used and
remove the extra dev_dbg() message when the boardinfo is not found.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:02 -07:00
H Hartley Sweeten
cf2f9224e7 staging: comedi: das08: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:01 -07:00
H Hartley Sweeten
c6726b8173 staging: comedi: das08_isa: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:01 -07:00
H Hartley Sweeten
94be3ef2a8 staging: comedi: ni_at_a2150: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:01 -07:00
H Hartley Sweeten
30f2306642 staging: comedi: ni_at_a2150: cleanup a2150_probe()
Make this function return a pointer to the boardinfo instead of an index.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:01 -07:00
H Hartley Sweeten
6e2b126dbd staging: comedi: ni_670x: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:01 -07:00
H Hartley Sweeten
91d4beba92 staging: comedi: cb_pcidda: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:00 -07:00
H Hartley Sweeten
5e97650cf5 staging: comedi: amplc_pci230: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:00 -07:00
H Hartley Sweeten
c7f53ea17d staging: comedi: amplc_pci224: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:00 -07:00
H Hartley Sweeten
dbc855ad1f staging: comedi: amplc_pc236_common: rename 'thisboard' variables
For aesthetics, rename the 'thisboard' variables to 'board'. That name
is more commonly used for the boardinfo pointer in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-18 21:19:00 -07:00
Hari Prasath Gujulan Elango
d46bc00c3f staging: comedi: amplc_pci230: rename 'todo' variable
This patch renames the very generic variable name 'todo' to
nsamples.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-17 21:30:40 -07:00
Hari Prasath Gujulan Elango
4c05c50d72 staging: comedi: use BIT macro for bit shift operation
This patch silences the Checkpatch.pl warning 'Prefer using the
BIT macro'

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-17 21:30:40 -07:00
Hari Prasath Gujulan Elango
3bc4cc7719 staging: comedi: remove commented code
This patch removes commented code.This was a checkpatch warning.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-15 21:56:37 -07:00
Ian Abbott
57334a30c8 staging: comedi: das08: use better MODULE_DESCRIPTION()
Replace the boiler-plate Comedi module description string with something
more specific.

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>
2015-06-12 17:06:42 -07:00
Ian Abbott
34cce4628b staging: comedi: das08: clarify sign-magnitude conversion
For DAS08/JR/16 and DAS08/JR/AO-16 boards, the 16-bit analog input
readings are assumed to be in a sign-magnitude format and need
converting to the COMEDI unsigned sample format.  The expressions to do
the conversion look a little messy.  Use a local variable `magnitude` to
make it easier to follow.

Also, there seems to be some discrepancy between the manual for these
boards and the COMEDI code.  The manual implies that 0 is full-scale
negative and 65535 is full-scale positive.  However, the COMEDI code has
used the sign-magnitude conversion for these boards since these two
boards were initially supported by a patch from an external contributor
to the COMEDI project back in 2001.  Assume the code is correct for now,
but add a comment to mention the discrepancy.

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>
2015-06-12 17:06:42 -07:00
Ian Abbott
3919c3d589 staging: comedi: das08: rename das08_do_wbits() & das08jr_do_wbits()
`das08_do_wbits()` and `das08jr_do_wbits()` are handlers for the Comedi
`INSN_BITS` instruction for the digital output subdevice on "non-JR" and
"JR" boards, respectively.  Rename them to `das08_do_insn_bits()` and
`das08jr_do_insn_bits()` respectively for consistency.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
9f05914d0c staging: comedi: das08: rename das08_di_rbits() & das08jr_di_rbits()
`das08_di_rbits()` and `das08jr_di_rbits()` are handlers for the Comedi
`INSN_BITS` instruction for the digital input subdevice on "non-JR" and
"JR" boards, respectively.  Rename them to `das08_di_insn_bits()` and
`das08jr_di_insn_bits()` respectively for consistency.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
c224a91957 staging: comedi: das08: rename das08_ai_rinsn()
`das08_ai_rinsn()` is the handler for Comedi `INSN_READ` instructions
for the AI subdevice.  Rename the function to `das08_ai_insn_read()` for
consistency.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
fcd63ec8f3 staging: comedi: das08: rename the gainlist variables
`das08_pgh_gainlist[]`, `das08_pgl_gainlist[]`, and
`das08_pgm_gainlist[]` hold the gain codes indexed by range index for
various boards that support programmable gain. `das08_gainlist[]` is a
look-up table to find the appropriate gain list for a board.  These are
all associated with the analog input Comedi subdevice.  Rename the
variables to reflect that.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
a76ccfa81e staging: comedi: das08: rename ai range tables
The `range_das08_pgl`, `range_das08_pgm`, and `range_das08_pgh`
variables define the analog input ranges for the "PGL", "PGM", and "PGH"
board variants, and are also used for the "AOL", "AOM", and "AOH" board
variants.  Rename them to use the `das08_` prefix for consistency.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
194869dbe8 staging: comedi: das08.c: reformat remaining comments
Use the preferred style for block comments.  Squash double spaces after
the comment opening sequence for single-line comments.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
66774ce6ca staging: comedi: das08.c: reformat copyright comment
Replace double spaces with single spaces at the start of each line in
the copyright comment at the top of the file.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
646e70c5d1 staging: comedi: das08: remove board register map comments
The "das08" module contains some comments outlining the register maps
for some of the ISA boards supported by this module in combination with
the "das08_isa" module.  The comments are somewhat sporadically placed,
don't detail all the boards, and don't use the preferred block comment
style.  If anywhere, they should probably be in the "das08_isa" module.
Just remove them.  The comments for the register macros indicate which
boards they apply to anyway, so we don't lose much information.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
6814b4a3fd staging: comedi: das08: rename DAS08AO_AO_UPDATE
"AOL", "AOM", and "AOH" boards have a jumper that controls whether
analog output channels are updated simultaneously or individually.  When
set to update individually, individual channels are updated when the
high byte register is written.  When set to update simultaneously,
channels are not updated until any of the analog output registers are
read.  The driver doesn't know the jumper setting and is not interested
in the simultaneous update feature, so it updates a channel by writing
the low byte register, the high byte register, and then reading channel
0's low byte register.

The `DAS08AO_AO_UPDATE` macro contains the offset to the low byte
register for analog output channel 0 on the "AOL", "AOM", and "AOH"
boards, which the driver reads to update the analog outputs.  Rename the
macro to `DAS08AOX_AO_UPDATE_REG` and add a comment.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
3c98c1d3f1 staging: comedi: das08: rename DAS08AO_AO_LSB() and DAS08AO_AO_MSB()
The `DAS08AO_AO_LSB(x)` macro returns the offset to the analog output
low byte register for channel x (0 or 1) for "AOL", "AOM", and "AOH"
boards.  The `DAS08AO_AO_MSB(x)` macro returns the offset to the
corresponding high byte register.  Rename the macros to
`DAS08AOX_AO_LSB_REG(x)` and `DAS08AOX_AO_MSB_REG(x)` respectively, and
add some comments.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
f1c04fd421 staging: comedi: das08: replace DAS08AO_GAIN_CONTROL/STATUS
The `DAS08AO_GAIN_CONTROL` and `DAS08AO_GAIN_STATUS` macros hold the
offset to the "programmable gain" register on "PGL", "PGM", "PGH",
"AOL", "AOM" and "AOH" boards.  Writing a code to this register sets the
gain for the current analog input channel (selected in the main control
register).  The written value can be read back in bits 3..0 of the
register.  Other bits of the register are read-only and not used by the
driver.  Rename `DAS08AO_GAIN_CONTROL` to `DAS08_GAIN_REG` and add a
comment.  Remove `DAS08AO_GAIN_STATUS` as the driver does not use it and
the read-only parts of the register are documented in the comment.

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>
2015-06-12 17:06:41 -07:00
Ian Abbott
09ed1b72cf staging: comedi: das08: add DAS08JR_AO_UPDATE_REG
"JR" boards with analog output channels have a jumper that controls
whether analog output channels are updated simultaneously or
individually.  When set to update individually, individual channels are
updated when the high byte register is written. When set to update
simultaneously, channels are not updated until the digital inputs
register is read.  The driver doesn't know how the jumper is set and is
not interested in the simultaneous output feature, so it updates a
channel by writing the low byte, then the high byte, then reading the
digital inputs register.  To make the code more explicit, add a macro
`DAS08JR_AO_UPDATE_REG` with the same value as the `DAS08JR_DI_REG`
macro (for digital inputs) and use it when reading the register to
update the analog outputs.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
7b2098f626 staging: comedi: das08: rename DAS08JR_AO_LSB() and DAS08JR_AO_MSB()
The `DAS08JR_AO_LSB(x)` macro returns the offset to the analog output
low byte register for channel x (0 or 1) for "JR" boards with analog
output support.  The `DAS08JR_AO_MSB(x)` macro returns the offset to the
corresponding high byte register.  Rename the macros to
`DAS08JR_AO_LSB_REG(x)` and `DAS08JR_AO_MSB_REG(x)` respectively, and
add some comments.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
c47c0ed2d5 staging: comedi: das08: rename and split DAS08JR_DIO
The `DAS08JR_DIO` macro contains the offset to the read-only digital
input register and write-only digital output register on the "JR"
boards.  Replace the macro with two new macros (with the same numeric
value) named `DAS08JR_DI_REG` for the digital input register and
`DAS08JR_DO_REG` for the digital output register, and add some comments.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
11e8457f02 staging: comedi: das08: rename DAS08_OP() and DAS08_DO_MASK
The `DAS08_DO_MASK` macro is a bitmask for the control register
corresponding to the digital output channels (except on "JR" boards).
Rename it to `DAS08_CONTROL_DO_MASK` and add a comment.

The `DAS08_OP(x)` macro takes a bitvector of the desired digital output
channel states and returns the corresponding bits for the control
register (except on "JR" boards).  Rename it to `DAS08_CONTROL_DO(x)`
and add a comment.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
6a3a22bcad staging: comedi: das08: rename and rewrite DAS08_INTE
The `DAS08_INTE` macro contains a mask for the "INTE" bit in the control
register (except on "JR" boards).  Setting it to 1 enables interrupts.
Setting it to 0 disables interrupts and clears the "IRQ" bit in the
status register.  Rename the macro to `DAS08_CONTROL_INTE` and add a
comment.  Also use the `BIT()` macro to define its value.  (Note: the
driver does not currently enable interrupts.)

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
ac81df6097 staging: comedi: das08: rename DAS08_MUX() and DAS08_MUX_MASK
The `DAS08_MUX_MASK` macro is a bitmask for the control register
corresponding to the analog input multiplexor channel selection bits.
Rename it to `DAS08_CONTROL_MUX_MASK` and add a comment.  Note that the
current setting of the multiplexor can also be read from the same bit
positions in the status register, but the driver does not use it.  Add a
comment to that effect.

The `DAS08_MUX(x)` macro takes an analog input channel number and
returns the corresponding analog input multiplexor channel selection
bits for the control register.  Rename it to `DAS08_CONTROL_MUX(x)` and
add a comment.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
c800e51310 staging: comedi: das08: rename DAS08_CONTROL
The `DAS08_CONTROL` macro contains the offset to the write-only control
register.  Rename it to `DAS08_CONTROL_REG` and add a comment.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
4d14ac8a90 staging: comedi: das08: rename and rewrite DAS08_IP
The `DAS08_IP()` macro takes a value read from the status register and
returns the state of the three digital input channels (except on "JR"
boards).  Rename it to `DAS08_STATUS_DI()` and add a comment.  Also
re-arrange the expression used to extract the state of the digital
inputs for consistency with other register macros.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
2398391017 staging: comedi: das08: rename and rewrite DAS08_IRQ
The `DAS08_IRQ` macro contains a mask for the "IRQ" status bit.  This is
set to 1 when a rising edge is detected on the external interrupt input
pin of the external connector (which may be jumpered to a pacer output).
It is cleared by setting the "INTE" control bit to 0.  It is not used on
"JR" boards.  Rename the macro to `DAS08_STATUS_IRQ` and add a comment.
Also use the `BIT()` macro to define the value.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
851e5d5475 staging: comedi: das08: rename and rewrite DAS08_EOC
The `DAS08_EOC` macro contains a mask for the "end of A/D conversion"
bit in the status register.  The logic is reverse sense in that the bit
is set to 1 while the conversion is in progress and set to 0 when the
conversion is complete.  Rename the macro to `DAS08_STATUS_AI_BUSY` and
add a comment.  Also make use of the `BIT()` macro to define the value.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
b00b3f769a staging: comedi: das08: rename DAS08_STATUS
The `DAS08_STATUS` macro contains the offset to the read-only status
register.  Rename it to `DAS08_STATUS_REG` and add a comment.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
c2ba9e9637 staging: comedi: das08: rename DAS08_TRIG_12BIT
The `DAS08_TRIG_12BIT` macro contains the offset to the write-only
software trigger register for 12-bit or 16-bit analog-to-digital
conversions.  Rename the macro to `DAS08_AI_TRIG_REG` and add a comment.

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>
2015-06-12 17:06:40 -07:00
Ian Abbott
5826d99aed staging: comedi: das08: rename DAS08_LSB and DAS08_MSB
The `DAS08_LSB` and `DAS08_MSB` macros contain the offsets to the
least-significant and most-significant analog input data registers.
Rename them to `DAS08_AI_LSB_REG` and `DAS08_AI_MSB_REG` respectively
and add comments to document 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>
2015-06-12 17:06:40 -07:00
Ian Abbott
3c7cab30f4 staging: comedi: das08.h: make self-reliant
The Comedi "das08.h" header file is included by drivers for the
ComputerBoards/MeasurementComputing and Keithley Metrabyte boards in the
DAS08 series.  It does not compile cleanly when it is the first header
included by the ".c" file.  It uses `struct comedi_device *` in the
parameter list of a function prototype, so just declare `struct
comedi_device` as an incomplete type.  It also uses `bool`, so include
<linux/types.h> to declare it.

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>
2015-06-12 17:06:39 -07:00
Ian Abbott
2b56b35820 staging: comedi: das08: improve test for programmable gain
`das08_ai_rinsn()` handles Comedi `INSN_READ` instructions for the AI
subdevice.  This programs the gain for the analog input channel if the
board has support for that, and acquires data from the channel.  If
programmable gain is supported, the gain code is read from the array
pointed to by `devpriv->pg_gainlist` indexed by the range index.  The
function assumes that programmable gain is supported if the AI
subdevice's range table supports more than one range.  Replace that with
a more direct test for `devpriv->pg_gainlist` being non-NULL, as it is
only initialized to a non-NULL pointer for boards that support
programmable gain.

This will also allow range tables to be included for convenience for
those boards that support multiple ranges by DIP switches.  Those boards
are currently initialized to use a single "unknown" range.

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>
2015-06-12 17:06:39 -07:00
Ian Abbott
fba5963c92 staging: comedi: das08: use indexed initializer for AI range table types
The "das08" common module for DAS08 ISA, PCI, and PCMCIA drivers
includes a predefined set of AI range tables.  The static board data (of
type `struct das08_board_struct`) for a particular board contains an
index in its `ai_pg` member (of type `enum das08_lrange`) indicating
which of the predefined AI range tables to use.  The "das08" common
module looks up this index in `das08_ai_lranges[]` to get a pointer to
the predefined range table for the board.  The same index is also looked
up in `das08_gainlists[]` to get a corresponding pointer to a list of
hardware gain values for each range supported by the board (NULL for
boards without programmable gain).

To make this clearer, used indexed initializers for `das08_ai_lranges[]`
and `das08_gainlists[]`, using the enumerated constants from `enum
das08_lrange` as the indices.  Also add a short comment to the
definition of `enum das08_lrange`.

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>
2015-06-12 17:06:39 -07:00
Ian Abbott
d4d794330d staging: comedi: das08.h: reformat remaining comments
Reformat remaining comments to use the preferred style for single-line
and block comments.

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>
2015-06-12 17:06:39 -07:00
Ian Abbott
884f01c949 staging: comedi: das08.h: change description in copyright header comment
The copyright header comment includes a single-line description saying
it is for "das08.c" and "das08_cs.c".  However, it is also used by
"das08_isa.c" and "das08_pci.c".  Update the description to say it is
for common DAS08 support, similar to description in "das08.c" (the
common module for the DAS08 ISA/PCI/PCMCIA drivers).

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>
2015-06-12 17:06:39 -07:00
Ian Abbott
71f0d052cc staging: comedi: das08.h: reformat copyright comment
Reformat the copyright comment at the top of the file to use the
preferred block comment style.

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>
2015-06-12 17:06:39 -07:00
Ian Abbott
b08ad6657a staging: comedi: cb_pcimdas: fix handlers for DI and DO subdevices
Normally, low-level Comedi drivers set an `insn_bits` handler for
digital input (DI), digital output (DO) and digital input/output (DIO)
subdevice types to handle normal reading and writing of digital
channels.  The "cb_pcimdas" driver currently has an `insn_read` handler
for the DI subdevice and an `insn_write` handler for the DO subdevice.
However, the actual handler functions `cb_pcimdas_di_insn_read()` and
`cb_pcimdas_do_insn_write()` are written to behave like `insn_bits`
handlers.  Something's wrong there!  To fix it, set the functions as
`insn_bits` handlers and rename them for consistency.

Fixes: e56d03dee1 ("staging: comedi: cb_pcimdas: add main connector digital input/output")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:05:40 -07:00
Abhishek Sharma
e1f9ae3bca Staging: comedi: adv_pci1724: Remove redundant return statements
Replace unnecessary conditional checks for variable 'ret' and replace
by single return statement.

Signed-off-by: Abhishek Sharma <asharm14@visteon.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 13:21:37 -07:00
Joglekar Tejas
51bb618bff Staging: comedi: ni_at_a2150: remove extra spaces before tab
This patch fix warning given by checkpatch.pl abouts spaces given
before tab

Signed-off-by: Joglekar Tejas <joglekartejas@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 13:21:37 -07:00
Nicholas Mc Guire
60c77d1adb staging: me_daq: use schedule_timeout_interruptible()
API consolidation with coccinelle found:
./drivers/staging/comedi/drivers/me_daq.c:177:1-17:
        consolidation with schedule_timeout_*() recommended

This is a 1:1 conversion of the current calls to an available helper
only - so only an API consolidation to improve readability.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 12:04:35 +09:00
Matthew Needes
d0e2f8f0be staging: comedi/drivers/pcl.* coding style fixes
pcl812.c (resend of earlier patch)
    Fixed lines exceeding 80 columns, correcting some spelling in process

Signed-off-by: Matthew Needes <mneedes@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 10:07:18 +09:00