Commit Graph

654 Commits

Author SHA1 Message Date
Jonathan Cameron 7d43817803 staging:iio: add quadrature correction to chan info types.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:32:46 -07:00
Jonathan Cameron d34dbee8ac staging:iio:accel:kxsd9 cleanup and conversion to iio_chan_spec.
Lots of minor bits and pieces.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:32:46 -07:00
Jonathan Cameron 4024bc73b1 staging:iio: Remove deprecated dev_data from iio_dev.
The equivalent should always be done using iio_alllocate_device
with to create a private area for the driver and then iio_priv
to access it.  There may be other uses for a private data pointer
but right now it just leads driver writers astray.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:12 -07:00
Jonathan Cameron e05e5f2336 staging:iio:light:tsl2583 allocate chip state with iio_dev
There are some unusual corners in the probe function of this
driver, so may need another look.

V2: Now with the check for allocation success not inverted.
V3: Now with the i2c devdata calls actually being correctly cast.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Tested-by: Jon Brenner <jbrenner@TAOSinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:12 -07:00
Jonathan Cameron 355e25c1de staging:iio:sysfs cleanout header for unused definitions.
Also push one down into the only driver that actually uses it.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:12 -07:00
Jonathan Cameron 9aa1a167f0 staging:iio:core squash trivial wrappers and use ida allocation func.
Reorder to remove need for definitions currently in header.
Remove ida related utility function defs from header.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:12 -07:00
Jonathan Cameron 232b9cba13 staging:iio:core flatten convenience function that only has one user.
Fix trivial wrong index (no effect on any current drivers).

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:11 -07:00
Jonathan Cameron 17ee97e5f3 staging:iio:gyro and meter: header housecleaning.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:11 -07:00
Jonathan Cameron 779921683e staging:iio:accel header housekeeping - remove unecessary includes.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:11 -07:00
Jonathan Cameron 6dd7bcaae2 staging:iio:adc: header cleanup - remove unused.
Clear out all the excessive includes in the *_ring.c files.
Mixture of cut and paste bloat and things needed for code that
has gone away.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:10 -07:00
Jonathan Cameron ce87c128b9 staging:iio:various header includes that should never have been.
I will assume these were cut and pastes messup.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:08 -07:00
Jonathan Cameron e18ef34419 staging:iio:inclinometer.h remove as now unused.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:07 -07:00
Jonathan Cameron cdf387096e staging:iio:adc: unused header removals.
More headers now not needed after iio_chan_spec conversions.
A couple of drivers were using helpers from adc.h.

Given these were trivial, they are pushed down into the drivers.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:07 -07:00
Jonathan Cameron 5b847ccbf5 staging:iio:accel: usused header removals.
Missing from the iio_chan_spec conversion patches.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:07 -07:00
Jonathan Cameron a5e7363ca4 staging:iio:gyro:adis16130 drop control of adc resolution.
There is no clear use case for this functionality in a driver
that only supports slow reading via sysfs. The interface
use was non compliant with the abi motiving it being dropped.

It can go back in if anyone ever implements buffered reading
support for this device.  Then it will be controlled as
part of the buffering abi where this should indeed be correctly
supported.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:07 -07:00
Jonathan Cameron b066b4f89b staging:iio:imu:adis16400 remove unused headers.
These should have gone with the iio_chan_spec conversion.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:07 -07:00
Jonathan Cameron bc8ea46b55 staging:iio:gyro:adis16260 remove some unused headers
These should have gone with the iio_chan_spec conversion patch.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:06 -07:00
Jonathan Cameron d29f73db79 staging:iio:triggers introduce iio_trigger_ops to take const bits out of iio_trig_structure.
Right now this results in increased code, but I still think it is worth doing to avoid
replication across instances of drivers etc and move as much stuff as possible to constant.
Ops structure is optional for the occasional driver that uses none of it (currently
only the ad7793).

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:06 -07:00
Jonathan Cameron 214320b6ec staging:iio:imu:adis16400 remove now unused headers.
These should really have gone away with the code that needed them.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:06 -07:00
Jonathan Cameron 7a6ff010e5 staging:iio:imu:adis16400: use strtobool for reset sysfs and don't assign unused tx members.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:06 -07:00
Jonathan Cameron deda386deb staging:iio:trivial sparse related cleanups.
Getting rid of messages that make it harder to spot important issues.
Some code removed that will be useful one day.  Can put it back then.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:05 -07:00
Jonathan Cameron de1874b787 staging:iio:documentation trivial typo fix
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:45 -07:00
Jonathan Cameron 705099a763 staging:iio:various Stop drivers putting sysfs attributes in a directory named after the device.
No idea how this particularly 'quirk' got in there in the first
place.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:45 -07:00
Jonathan Cameron 9076faa9af staging:iio: in case of buggy drivers avoid using undefined mask.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:44 -07:00
Jonathan Cameron f7256877c7 staging:iio: dummy sysfs group for autogenerated base directories.
Needed to ensure the reference counting is correct.
Temporary fix whilst discussions are ongoing.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:43 -07:00
Jonathan Cameron 70a876c590 staging:iio:accel:adis16201 overflow tx buffer.
Smatch caught bug.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:43 -07:00
Jonathan Cameron 0cbb2b53fb staging:iio:dac:ad5504 dereferencing just freed st in error path.
Introduced when I did the iio_chan_spec conversion. Detected by smatch.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:43 -07:00
Jonathan Cameron 8df322385a staging:iio:addac:adt7316 make interrupt mask sane.
Coccinelle found this one. I'm not certain what
the intent is, but this fix makes no functional changes.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:43 -07:00
Jonathan Cameron 4266868c9c staging:iio: sysfs.h remove unused val2 and dead macro.
Vivien pointed out that 99e5dc45b8
removed the IIO_DEVICE_ATTR_2 macro but didn't clean up the other
macros that used it.

As it turns out, no one is using val2 in tree, so lets scrap that
until it is needed.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Reported-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:42 -07:00
Jonathan Cameron cc2439fdec staging:iio:core simplify and fix a bug in iio_device_(un)register_event_set.
The unwinding index was j, not i and it is much simpler to do these as a single
loop unwinding those elements necessary in before jumping to the error handler.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:42 -07:00
Jonathan Cameron cd0380190f staging:iio:adc: max1363 fix 2 raw sysfs issues.
indio_dev->channels was accidentally removed thus preventing any sysfs
registrations occuring for direct reading.  That hid the other issue.

Unfortunately the incorrect handling leads to misspresentation of data
in sysfs reads.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:42 -07:00
Jonathan Cameron cdf6e81790 staging:iio:gyro:adis16130 fix adis16130_spi_read which was never selecting the channel
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:28:42 -07:00
Dan Carpenter 8f89615528 Staging: iio: add some unlocks to raw_read() functions
This code was cut and pasted in several places.  It's missing some
unlocks on error.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-02 16:07:51 -07:00
Jonathan Cameron e1703b329f staging:iio:meter:ade7753 should be 16 bit read not 8 bit for mode register.
Build tested only.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-18 13:25:23 -07:00
Jonathan Cameron 05a93489bc staging:iio:kfifo_buf fix double initialization of the ring device structure.
Looks like this moved into the core at somepoint and kfifo buf got left
behind.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-18 13:23:57 -07:00
Jonathan Cameron 8016934cbd staging:iio:accel:lis3l02dq: fix incorrect pointer passed to spi_set_drvdata.
This mean all sorts of interesting results on driver removal.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-18 13:23:57 -07:00
Jonathan Cameron 91ab3fc907 staging:iio:imu fix missing register table index for some channels
A number of these register indexes were not set or actually wrong.
This only effects sysfs reads.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-18 13:23:57 -07:00
Jonathan Cameron 38f71aa905 staging:iio:adc:ad7476: Incorrect pointer into spi_set_drvdata.
Will cause issues only on driver removal.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-18 13:22:52 -07:00
Bryan Freed 01e57c5742 staging:iio:light:isl29018: Convert some of the isl29018 driver to the new iio_chan_spec framework.
Remove the driver's get_sensor_data() interfaces and replace them with
iio_chan_spec channels.  This converts 4 files to the new framework.
Driver ABI change: The intensity_infrared_raw file is now intensity_ir_raw.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:11:49 -07:00
Bryan Freed f09f2c8142 staging:iio: Add an iio channel type string to support proximity sensors.
Add "proximity" to the iio_chan_type_name_spec_shared string list to
support proximity sensors.
Now this list fully matches the declared iio_chan_type enums.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:11:49 -07:00
Bryan Freed 9bff02f8f7 staging:iio: Reorder channel type strings to match the iio.h enums.
This makes comparison between the iio_chan_type_name_spec_shared strings
and the iio_chan_type enums easier.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:11:48 -07:00
Bryan Freed 152d52cf7e staging:iio:light:isl29018: Fix the "Init of isl29018 fails" failure.
The I2C clientdata is set to indio_dev instead of chip as of a couple weeks ago.
Correct the calls to i2c_get_clientdata() accordingly.
Otherwise the driver fails to initialize.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:11:48 -07:00
Dan Carpenter 85ee35e50d Staging: iio: release locks on error paths
There are a couple places here where we should have called
mutex_unlock() before returning.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:34:58 -07:00
Jonathan Cameron 7bcf302ff1 staging:iio:gyro:adis16260 fix missing num_channels setup.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Cc: stable <stable@kernel.org>  [3.0]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:31:35 -07:00
Bryan Freed 6d1ad0f8aa staging: iio: light sensor: Add a calibscale file to the isl29018 light sensor driver.
Defaulting to 1, this gives a way to amplify the lux value before being
reduced by the programmed adc_bit shift.
Only support whole numbers right now.  When this driver is converted to the new
IIO_CHAN framework, it will be easy to support the framework's pseudo float.

Add illuminance0_calibscale documentation to sysfs-bus-iio-light.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:29:17 -07:00
Dan Carpenter 03bda05d9c Staging: iio: some uninitialized variable bugs
There were some uninitialized variable warnings in iio.  Two of
these came from the recent changes to how the private data was
allocated in 83f0422dc6 "staging:iio:accel:sca3000: allocate
state in iio_dev and use iio_priv to access."

drivers/staging/iio/accel/sca3000_core.c: In function 'sca3000_probe':
drivers/staging/iio/accel/sca3000_core.c:1137:9: warning: 'st' may be used uninitialized in this function
drivers/staging/iio/adc/ad7291.c: In function 'ad7291_probe':
drivers/staging/iio/adc/ad7291.c:805:15: warning: 'chip' may be used uninitialized in this function
drivers/staging/iio/dac/ad5624r_spi.c: In function 'ad5624r_probe':
drivers/staging/iio/dac/ad5624r_spi.c:228:24: warning: 'st' may be used uninitialized in this function

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:29:16 -07:00
Greg Kroah-Hartman 0c9e98af5e Merge Linux 3.0-rc6 into staging-next
This handles the merge conflicts with the
drivers/staging/brcm80211/Kconfig file due to changes on the two
different branches.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 07:35:09 -07:00
Bryan Freed d9b42c01ae iio: light sensor: Add SMBUS support to the tsl2563 driver.
This is so we can support it on x86 SMBUS adapters.

Since i2c adapters which do not provide an smbus_xfer interface fall
back to using their I2C master_xfer interface, all the i2c_master_send()
calls in this driver are changed to i2c_smbus_*() calls.
This will fail on an i2c adapter that implements a proper subset of
(SMBUS_BYTE | SMBUS_BYTE_DATA | SMBUS_WORD_DATA), but I do not see that
in any of our adapters today.

This results in a few wrapper functions that provide little additional
functionality, so remove them and call the smbus functions directly from
the general driver code.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:52:25 -07:00
Bryan Freed 9e4216fd6a iio: light sensor: Fix a panic in the tsl2563 driver.
Add the required read/write_raw functions to the tsl2563_info_no_irq data
structure.  This structure is used insted of tsl2563_info when the I2C client
has no IRQ.
The absence of these functions causes a panic when reading or writing the
created sysfs files.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:52:25 -07:00
Bryan Freed 8f518d71f3 iio: light sensor: Fix a panic in the tsl2563 driver.
Add a wrapper for this driver around the IIO_CHAN() wrapper to make channel
parameters more readable.  This fixes a panic caused by the info_masks being
accidentally passed in as channel2 parameters which easily surpass the size
of the iio_modifier_names_light array.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:52:24 -07:00
Jonathan Cameron beeada734f staging:iio: one more fix for IIO_RING_BUFFER not enabled.
Same problem as seen and fixed in adis16204 et al.
These were fixed by Randy in:
staging: fix more iio builds when IIO_RING_BUFFER is not enabled

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:48:13 -07:00
Dan Carpenter f88af7e7d3 Staging: iio: dereferencing uninitialized variable
In the error handling, it dereferences "st" before it has been
initialized.  I also just tidied it up a bit to remove some extra
conditions.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:48:13 -07:00
maximilian attems 7959a7c477 staging: iio light Kconfig fixlet
No point to start comments with '\'.

Signed-off-by: maximilian attems <max@stro.at>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:47:26 -07:00
Michael Hennerich c2f37c8dca iio: dac: New driver for AD5686R, AD5685R, AD5684R Digital to analog converters
New driver for AD5686R, AD5685R, AD5684R Quad channel digital to analog converters

Changes since V1:

drop header file
use strtobool()
Fix dev attribute macros
Reorder probe() function

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:47:26 -07:00
Michael Hennerich ae19178eac iio: industrialio-core: Add IIO_OUT type
Add IIO_OUT type for DAC like devices
In case of IIO_OUT make sure the channel device attribute is writable

Ideally we add a flag to iio_chan_spec that tells the core that
the channel device attribute is writable...

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:47:25 -07:00
Michael Hennerich 88bc30548a IIO: ADC: New driver for AD7792/AD7793 3 Channel SPI ADC
New driver for AD7792/AD7793 3-Channel, Low Noise,
Low Power, 16-/24-Bit Sigma-Delta ADC with On-Chip In-Amp
and Reference.

The AD7792/AD7793 features a dual use data out ready DOUT/RDY output.
In order to avoid contentions on the SPI bus, it's necessary to use
spi bus locking. The DOUT/RDY output must also be wired to an
interrupt capable GPIO.

In INDIO_RING_TRIGGERED mode, this driver may block its SPI bus segment
for an extended period of time.

Changes since V1:

Use bool where applicable.
Use data buffer that lives in their own cache line.
Restructure ad7793_calibrate_all to use an array.
Use msleep.
Query REG_ID instead of doing a write/read This is a test.
Add support for unipolar mode.
Drop range attribute in favor of write scale.
Add proper locking.
Use new validate_trigger callbacks.
Use IIO_IN_DIFF for differential channels.
Change attribute naming.
Use available_scan_masks.
Some other miscellaneous cleanup (none functional changes).

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:47:25 -07:00
anish kumar 3fd47d4486 staging:iio:accel:kxsd9 replace kmallocs in power_up with use of already allocated buffer.
Signed-off-by: anish kumar <anish198519851985@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:52 -07:00
anish d5614701df staging: IIO corrected the spelling in iio-trig-gpio
Corrected the spelling.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:52 -07:00
Jonathan Cameron d31907f343 staging:iio:accel:adis16201 general cleanup, move to iio_priv and buffers in adis16201_state
Basically use various new facilities to tidy up.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:52 -07:00
Jonathan Cameron 927afbec71 staging:iio:light:isl29018: allocate device state with iio_dev
V2: Actually allocate the space for iio_priv

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:51 -07:00
Jonathan Cameron 88fa4de48e staging:iio:magnetometer:hmc5843: allocate device state with iio_dev.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:51 -07:00
Jonathan Cameron afc2ff0afa staging:iio:meter:ade7759: allocate state with iio_dev
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:51 -07:00
Jonathan Cameron 338473c819 staging:iio:magnetometer:ak8975: allocate chip state with iio_dev.
Here the ordering is a little tricky, so to keep changes minimal, a copy of the gpio
number is introduced.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:51 -07:00
Jonathan Cameron 58f08b0af8 staging:iio:resolver:ad2s90 general cleanup
Very simple driver, so not much to do.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:50 -07:00
Jonathan Cameron 8f2bd8363f staging:iio:resolver:ad2s120x cleanup.
I've currently squashed the vel + pos combined attribute.  If people need them
precisely paired I doubt they will get them from the sysfs interface anyway.
If that is a requirement it should come via a buffer implementation.

Note this patch leaves the completely non standard interface alone.
That will get fixed later.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:50 -07:00
Jonathan Cameron b19e9ad5e2 staging:iio:resolver:ad2s1210 general driver cleanup.
Note I haven't made any changes to the userspace interface as yet.
This is all about cleaning up what was actually there (handling
all errors etc).

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:49 -07:00
Jonathan Cameron 937a960121 staging:iio:meter:ade7854: Allocate buffers in state and state with iio_dev.
Requires moving a few things around, but should be no functional changes.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:49 -07:00
Jonathan Cameron 57157d1c0e staging:iio:meter:ade7754: allocate state with iio_dev and buffers in state.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:48 -07:00
Jonathan Cameron bfccd4fb9a staging:iio:meter:ade7753 allocate chip state with iio_dev; allocate buffers within state
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:48 -07:00
Jonathan Cameron ba61bb18c2 staging:iio:gyro:adxrs450: allocate chip state with iio_dev
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:48 -07:00
Jonathan Cameron d088ab8388 staging:iio:gyro:adis16260: allocate chip state with iio_dev and use iio_priv to access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:47 -07:00
Jonathan Cameron 9f8632d73e staging:iio:gyro:adis16130: allocate chip state with iio_dev and use iio_priv to access it.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:47 -07:00
Jonathan Cameron 1dd9290a7e staging:iio:gyro:adis16080: allocate chip state with iio_dev
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:47 -07:00
Jonathan Cameron 3a5952f97a staging:iio:gyro:adis16060 allocate chip state with iio_dev.
This is still a very odd driver.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:47 -07:00
Jonathan Cameron 3e772581c2 staging:iio:dds:ad9951: allocate chip state with iio_dev
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:46 -07:00
Jonathan Cameron fb565f132b staging:iio:dds:ad9910: allocate chip state with iio_dev
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:46 -07:00
Jonathan Cameron a28299114b staging:iio:dds:ad9810: allocate chip state with iio_dev and use iio_priv for access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:46 -07:00
Jonathan Cameron 7be94372ca staging:iio:dds:ad9850 allocate chip state with iio_dev + fix name of attr group.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:45 -07:00
Jonathan Cameron 8b7163a5f6 staging:iio:ad9834: allocate chip state with iio_dev and use iio_priv to access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:45 -07:00
Jonathan Cameron 39f3b32eb3 staging:iio:dds:ad9832: allocate chip state with iio_dev and use iio_priv to access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:45 -07:00
Jonathan Cameron 7074e1d44f staging:iio:dds:ad5930 Fix attr group location + allocate state with iio_dev
The main attribute group was placed under driver name for some reason.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:44 -07:00
Jonathan Cameron cada11fa20 staging:iio:dac:max517: allocate chip state with iio_dev and use iio_priv to access it.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:44 -07:00
Jonathan Cameron f5730d52ba staging:iio:dac:ad5791: allocate chip state with iio_dev and use iio_priv for access.
Slightly fiddly case with two regulators - could reorder, but this is the approach with
smallest likely impact.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:43 -07:00
Jonathan Cameron 86729fc46f staging:iio:dac:ad5446: allocate chip state with iio_dev and use iio_priv for access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:43 -07:00
Jonathan Cameron a3684ded4f staging:iio:dac:ad5504: allocate chip state with iio_dev and use iio_priv for access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:43 -07:00
Jonathan Cameron 3ff242055b staging:iio:dac:ad5624r: allocate chip state with iio_dev and use iio_priv for access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:42 -07:00
Jonathan Cameron d3de2935b6 staging:iio:adc:adt7410 allocate chip state with iio_dev and use iio_priv to access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:42 -07:00
Jonathan Cameron 70be42919a staging:iio:addac:adt7316: allocate chip state with iio_dev and use iio_priv to access.
Various minor cleanups needed to deal with removal of iio_dev pointer from chip state.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:42 -07:00
Jonathan Cameron 7978f9f8f9 staging:iio:adc:adt7310: allocate chip state with iio_dev and use iio_priv for access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:41 -07:00
Jonathan Cameron 84e8d84d0f staging:iio:adc:adt75: allocate chip state with iio_dev and cleanup some function calls.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:41 -07:00
Jonathan Cameron b0011d6dba staging:iio:adc:ad7816: allocate chip state with iio_dev and use iio_priv to access.
Again, get rid of unwanted iio_dev pointer in state.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:41 -07:00
Jonathan Cameron febafb94d6 staging:iio:adc:ad7745 allocate chip state with iio_dev and use iio_priv to access.
Also remove the iio_dev pointer from chip state as never needed.

V2: Actually allocate the space for iio_priv data.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:40 -07:00
Jonathan Cameron 744e4a6b85 staging:iio:adc:ad7314 allocate chip state with iio_dev and use iio_priv to access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:39 -07:00
Jonathan Cameron d439797281 staging:iio:adc:ad7291: allocate chip state with iio_dev and use iio_priv for access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:39 -07:00
Jonathan Cameron f4c794a2c1 staging:iio:adc:ad7152: allocate chip state with iio_dev and use iio_priv for access.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:38 -07:00
Jonathan Cameron 46a6af3820 staging:iio:adc:ad7150: allocate chip state with iio_dev and use iio_priv to access.
V2 - actually allocate some space for the iio_priv data.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:38 -07:00
Jonathan Cameron d8aea29b62 staging:iio:adc:ad799x clear out last few uses of iio_dev->dev_data.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:37 -07:00
Jonathan Cameron f490f42bdf staging:iio:adc:ad7887 clear out last few uses of iio_dev->dev_data.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:37 -07:00
Jonathan Cameron 67688105af staging:iio:adc:ad7476 allocate state with iio_dev and use iio_priv to access.
Reg handling is a little fiddly given the ordering of calls.

All part of getting rid of iio_dev->dev_data

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:37 -07:00
Jonathan Cameron ed0c012b85 staging:iio:accel:kxsd9: allocate state with iio_dev and use iio_priv to access.
V2: Actually allocate the storage.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 14:39:36 -07:00