Commit Graph

311951 Commits

Author SHA1 Message Date
H Hartley Sweeten cde6f08a5e staging: comedi: adl_pci6208: refactor pci6208_find_device()
Make the "find pci device" functions consistent in the comedi
drivers. Hopefully well be able to move it into the core...

Refactor the "find pci device" function to return a pointer to
the found struct pci_dev instead of an error code. Also, change
some of the tests to reduce the indent level of the code. Pass
the struct comedi_devconfig pointer to the function instead of
the bus/slot numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:40:02 -07:00
H Hartley Sweeten 949a18d39d staging: comedi: adl_pci6208: remove thisboard and devpriv macros
The 'thisboard' and 'devpriv' macros rely on a local variable having
a specific name and yield pointers derived from that local variable.
Replace the macros with local variables where used. Use the
comedi_board() helper to get the 'thisboard' pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:40:02 -07:00
H Hartley Sweeten ac55ca32ca staging: comedi: cb_pcidas: fix dac08_write_insn()
As pointed out by Ian Abbott, the comedi INSN_WRITE instructions
are meant to iterate over, and write, all the data[] passed from
the comedi core. Modify dac08_write_insn() to work as intended.

Since doc08_write_insn() now returns the proper response to the
core, make the dac08_write() helper return void.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:28:43 -07:00
H Hartley Sweeten b436356dcc staging: comedi: cb_pcidas: cleanup dac08_write()
Reverse the logic of the test against the cached value so that
the function only has one exit point.

Make the logic of the dac write a bit clearer by create a local
variable for the address used in the outw() calls and masking the
value to write and setting the enable bits before doing the outw()
calls. Add a comment just to make sure it's clear.

Also, add a comment about the 'return 1;'.  This should be
insn->n which is the number of data parameters used to do the
dac08_write_insn() but the insn is not a parameter to this
function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:56 -07:00
H Hartley Sweeten f66faa576f staging: comedi: cb_pcidas: cleanup cb_pcidas_ai_rinsn()
Create local variables for the channel, range, and aref in order
to make the remaining code a bit cleaner.

Remove the extra space in all the comments.

Remove the 'static const int timeout' and just use the open
coded value in the loop.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:56 -07:00
H Hartley Sweeten 7671896c4f staging: comedi: cb_pcidas: cleanup cb_pcidas_ao_nofifo_winsn()
Create local variables for the channel and range in order to
cleanup to mask/set of the ao_control_bits.

Remove the extra space in all the comments.

Return the number of data parameters used (insn->n) to indicate
success instead of the open coded '1'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:55 -07:00
H Hartley Sweeten b78332daf4 staging: comedi: cb_pcidas: cleanup cb_pcidas_ao_fifo_winsn()
Create local variables for the channel and range in order to
cleanup to mask/set of the ao_control_bits.

Remove the extra space in all the comments.

Return the number of data parameters used (insn->n) to indicate
success instead of the open coded '1'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:55 -07:00
H Hartley Sweeten d478b5f6f4 staging: comedi: cb_pcidas: fix remaining checkpatch.pl issues
Fix the remaining three "WARNING: line over 80 characters" issues
reported by checkpatch.pl.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:55 -07:00
H Hartley Sweeten 6993197b75 staging: comedi: cb_pcidas: add whitespace to all the #define's
Add whitespace to all the #define's in the driver in order to
improve the readability. Fix all the comments that are, or
already were, > 80 characters.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:55 -07:00
H Hartley Sweeten 7368348ccb staging: comedi: cb_pcidas: change dac bit enums into defines
The 'bits' for the DAC_CSR register are currently defined as
enums. All the other registers use defines for the bit definitions.
Change the dac bit enums to defines to follow the other registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:54 -07:00
H Hartley Sweeten 0cdfbe157c staging: comedi: cb_pcidas: fix comments in private data struct
A number of the comments in the private data struct definition
are causing checkpatch.pl to complain about "WARNING: line over
80 characters". Fix the comments.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:54 -07:00
H Hartley Sweeten f6cf9a0260 staging: comedi: cb_pcidas: 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 <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:54 -07:00
H Hartley Sweeten 0c4ef0b90c staging: comedi: cb_pcidas: fix comments in *_cmdtest functions
Remove some cut-and-paste comments from the skel driver in the
*_cmdtest functions. Shorten some others to fix the checkpatch.pl
complaints about WARNING: line over 80 characters.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:54 -07:00
H Hartley Sweeten 55acaf2d10 staging: comedi: cb_pcidas: fix some > 80 char lines
Fix some of the comments that cause checkpatch.pl to complain
about WARNING: line over 80 characters.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:53 -07:00
H Hartley Sweeten 93c58378b5 staging: comedi: cb_pcidas: fix a space before tab issue
As reported by checkpatch.pl, spaces should not be used before
tabs.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:53 -07:00
H Hartley Sweeten 4f0036ef09 staging: comedi: cb_pcidas: check for failure of subdev_8255_init
It's possible for subdev_8255_init() to fail due to its kzalloc().
Make sure to check for this failure and pass on the error code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:53 -07:00
H Hartley Sweeten 0a5aed4876 staging: comedi: cb_pcidas: use the driver_name for the resource name
Use the dev->driver->driver_name for the resource name passed
to pci_request_regions(), by way of comedi_pci_enable(), and
to request_irq() instead of the open coded "cb_pcidas".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:53 -07:00
H Hartley Sweeten b8ac8c6342 staging: comedi: cb_pcidas: move the "find pci" dev_printk messages
Move the dev_printk messages associated with the "find pci device"
from the *attach function into the *find_pci_device function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:53 -07:00
H Hartley Sweeten f3c34b2fc6 staging: comedi: cb_pcidas: cleanup ai_config_insn()
Absorb the helper function ai_config_calibration_source() into
ai_config_insn() and remove the static const variable that
was in the helper function.

Return an error code (-EINVAL) when appropriate and the number
of data values used (insn->n) for success.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:52 -07:00
H Hartley Sweeten 8f608fc8ee staging: comedi: cb_pcidas: cleanup the boardinfo 4
For aesthetic reasons, rename the ai_se_chans variable to
ai_nchan. It's a bit shorter and provides the necessary
information about the variable.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:52 -07:00
H Hartley Sweeten a605be0c68 staging: comedi: cb_pcidas: cleanup the boardinfo 3
Remove the ai_diff_chans variable. This option is not used in
the driver. If it is used later, the value can be easily found
by using ai_se_chans/2.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:52 -07:00
H Hartley Sweeten 0c5ecbb0b7 staging: comedi: cb_pcidas: cleanup the boardinfo 2
Remove all the boardinfo values that are = 0. They will
default to that value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:52 -07:00
H Hartley Sweeten 17883d63b3 staging: comedi: cb_pcidas: cleanup the boardinfo 1
For aesthetic reasons, add whitespace to the boardinfo to
improve readability.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:51 -07:00
H Hartley Sweeten 23e3cce327 staging: comedi: cb_pcidas: simplify the boardinfo
The boardinfo values 'has_ai_trig_gated' and 'has_ai_trig_invert'
are both only set for the "1602" versions of the boards supported
by this driver.

Simplify the boardinfo, and the code, by replacing these two
variables with one "is_1602" variable.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:51 -07:00
H Hartley Sweeten 4466fc4500 staging: comedi: cb_pcidas: remove unused io region size defines
The defines for the size of the io regions are not used in the
driver. Also, this information can be found using the pci helper
pci_resource_len(). Remove the defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:51 -07:00
H Hartley Sweeten 193debd198 staging: comedi: cb_pcidas: remove CB_PCIDAS_DEBUG define
This define enables some debug code that output a number
of dev_dbg() messages. These might be useful for development
but should not be in the final driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:51 -07:00
H Hartley Sweeten 7302abef2e staging: comedi: cb_pcidas: remove the PCI BAR index defines
The defines for the "indices of the base address regions" don't
add much to the readability of the code. They are only used in
the pci_resource_start() calls to get the base address for
the various io regions and the names of the variables provide
adequate documentation.

Remove the defines and just use the open-coded values for the
BARs. Also, remove the incomplete comment above the initialization
of the variables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:50 -07:00
H Hartley Sweeten 9795f562bd staging: comedi: cb_pcidas: remove some obvious comments in the attach
These comments are unnecessary.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:50 -07:00
H Hartley Sweeten 327be979c1 staging: comedi: cb_pcidas: factor out the find pci device code
Factor the "find pci device" code out of the attach function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:50 -07:00
H Hartley Sweeten 82d8c74dcc staging: comedi: cb_pcidas: remove thisboard and devpriv macros
The 'thisboard' and 'devpriv' macros rely on a local variable having
a specific name and yield pointers derived from that local variable.
Replace the macros with local variables where used. use the
comedi_board() helper to get the 'thisboard' pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:50 -07:00
H Hartley Sweeten 536af69e90 staging: comedi: cb_pcidas: remove forward declarations 9
Move the nvram_read function, and its helper, to remove the need
for the last of the forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:49 -07:00
H Hartley Sweeten 20535c1f3c staging: comedi: cb_pcidas: remove forward declarations 8
Move the trimpot_{7376,8402}_write functions to remove the need
for the forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:49 -07:00
H Hartley Sweeten 0c15d55325 staging: comedi: cb_pcidas: remove forward declarations 7
Move the caldac_8800_write function, and it's helper, to remove
the need for the forward declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:49 -07:00
H Hartley Sweeten bb03694323 staging: comedi: cb_pcidas: remove forward declarations 6
Move the cb_pcidas_load_counters function to remove the need for
the forward declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:49 -07:00
H Hartley Sweeten 0aa2030467 staging: comedi: cb_pcidas: remove forward declarations 5
Move the cb_pcida_ao_cancel function to remove the need for
the forward declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:48 -07:00
H Hartley Sweeten 9a0f7631f2 staging: comedi: cb_pcidas: remove forward declarations 4
Move the cb_pcida_cancel function to remove the need for
the forward declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:48 -07:00
H Hartley Sweeten 9e11d05f89 staging: comedi: cb_pcidas: remove forward declarations 3
Move the handle_ao_interrupt function to remove the need for
the forward declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:48 -07:00
H Hartley Sweeten 1706fcc18b staging: comedi: cb_pcidas: remove forward declarations 2
Move the cb_pcidas_ao_inttrig function to remove the need for
the forward declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:48 -07:00
H Hartley Sweeten e74f209ca9 staging: comedi: cb_pcidas: remove forward declarations 1
Move the attach/detach functions to remove the need for some
of the forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 15:23:47 -07:00
Jonathan Cameron cf82cb8128 IIO: Add a modifier for x^2+y^2+z^2
There will probably be a number of such modifiers eventually but
this one is used in the adis16240 accelerometer driver.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-06-30 10:15:28 +01:00
Jonathan Cameron f699d10202 staging:iio:accel:adis16204 support the rss channel via chan spec.
Reduces code and makes this channel available within the kernel.
Note that it is not added to the buffer, thus maintaining the
previous functionality of this driver.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
2012-06-30 10:15:25 +01:00
Jonathan Cameron 8f5879b20b IIO: Add a modifier for sqrt(x^2+y^2)
There will probably be a number of such modifiers eventually but
this one is used in the adis16204 accelerometer driver.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-06-30 10:15:22 +01:00
Jonathan Cameron 07c7f79ee1 staging:iio:imu:adis16400 drop sysfs interface for manual device reset.
There is no reason for userspace to do this, so lets
drop this abi.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
2012-06-30 10:15:20 +01:00
Jonathan Cameron 15a1a7530c staging:iio:gyro:adis16260 drop sysfs interface for manual device reset.
There is no reason for userspace to do this, so lets
drop this abi.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
2012-06-30 10:15:17 +01:00
Jonathan Cameron 13d947db1c staging:iio:accel drop sysfs interface for resetting devices.
There is no reason why userspace should want to do this manually.
Hence, lets drop this abi.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
2012-06-30 10:15:14 +01:00
Jonathan Cameron 314be14bb8 iio: Rename _st_ functions to loose the bit that meant the staging version.
These were originally introduced when the plan was to have parallel
IIO cores in and out of staging with a slow move between them.
Now we have reached the point where the whole core has moved,
they need clearing up!

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-06-30 10:15:12 +01:00
Lars-Peter Clausen 6a17a0768f iio:dac:ad5064: Add support for the ad5629r and ad5669r
The ad5629r and ad5669r are the I2C variants of the ad5628 and ad5668. Since the
ad5064 driver currently only supports SPI based devices the major part of this
patch focuses on adding support for I2C based devices. Adding support for the
actual parts boils down to adding entries for them to the device id table.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-06-30 10:15:09 +01:00
Lars-Peter Clausen 8ec4cf5303 iio:adc: Add AD7265/AD7266 support
This patch adds support for the Analog Devices AD7265 and AD7266
Analog-to-Digital converters.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-06-30 10:15:07 +01:00
Jonathan Cameron c1f1a9d48f Merge branch 'fixes-togreg' into togreg 2012-06-30 10:14:29 +01:00
Jonathan Cameron 06d5199d4c staging:iio: Add some missing peak elements to the info_mask
These are supported by raw_read but not actually there.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
2012-06-30 10:12:36 +01:00