Commit Graph

654 Commits

Author SHA1 Message Date
Jonathan Cameron c009f7e426 staging:iio:buffering cleanup ring_buffer_register_ex naming.
Now the old method is long gone, lets get rid of the _ex and whilst
here remove the unused id parameter.

Trivial mechanical change, but will break any out of tree drivers
using this.

V2: rebase
V3: rebase

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:28 -07:00
Jonathan Cameron 6446e9cd2c staging:iio:buffering drag some stray docs back to correct place.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:27 -07:00
Jonathan Cameron 1a25e5928e staging:iio: struct iio_dev formatting cleanup and documentation fixes.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:27 -07:00
Jonathan Cameron 1e8dfcc6c3 staging:iio:trivial add a string array for IIO_RAW and IIO_PROCESSED.
Introduce IIO_RAW and IIO_PROCESSED and an array for their strings.
Also move one function to just above where it is called.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:27 -07:00
Michael Hennerich cecfb931c8 staging:iio: fix typo
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:26 -07:00
Jonathan Cameron 36b6f4a7b6 staging:iio: remove orphaned function definition.
I have no idea what this was, or what it did, but it doesn't
do it any more.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:26 -07:00
Jonathan Cameron 9019309c2f staging:iio: remove defunct iio_put and iio_get.
All iio dependent modules statically depend on industrialio
so these aren't needed. Not sure why they originally existed,
but they aren't now.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:25 -07:00
Jonathan Cameron 47c24fdd42 staging:iio: use ida_simple_get and ida_simple_remove + merge ids
Use new simple ida allocation functions to remove some boilerplate
code.

Also, now we only have one chdev per device we don't need to maintain
a separate ida for minor numbers. Just use the devices id.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:00:25 -07:00
Jonathan Cameron 5aa9618896 staging:iio: remove broken support for multiple event interfaces.
We don't have a use case for these.  Two drivers appeared to use them
but both report all events on the first.

V2: Remove now irrelevant comment.
V3: Include fixup for adc/ad7280a.c

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-09-06 16:00:25 -07:00
Jonathan Cameron b3874069f8 staging: iio: Documentation sysfs-bus-iio update for chrdev merge.
A few element in here have been wrong for some time so cleaned them
up whilst here.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 15:59:11 -07:00
Jonathan Cameron f625cb97d4 staging: iio: remove now defunct header definitions and add some statics
Now we have combined all chrdevs into one, some bits and bobs are only
needed in industrialio-core.c and don't need to be in the core header.

Also remove some unused defines.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 15:59:10 -07:00
Jonathan Cameron 1aa0427832 staging: iio: push the main buffer chrdev down to the top level.
Sorry all, this one is very invasive, though the driver changes are
just trivial interface fixes. Not all done yet.

V2 - bring the sca3000 with us.
V3 - fix ade7758 bugs in conversion.
V4 - add ad5933

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-09-06 15:59:10 -07:00
Jonathan Cameron 6356463cf4 staging: iio: squash chrdev handler remains into users.
This no longer has any purpose given all chrdevs are pretty much the same
now the event interfaces are done via anon fds

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 15:59:10 -07:00
Jonathan Cameron 8e7d967244 staging: iio: remove specific chrdev for event reading. Get fd from ioctl on buffer.
Change suggested by Arnd Bergmann.

No real reason to have two chrdevs per device. This step merges them into one.
Currently this means that events will only work on devices with buffers. THat will
be remedied shortly.

V2: set name for event attribute groups.  Otherwise they all sorts of fun occurs on
dynamic channel event attribute creation.

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-09-06 15:59:09 -07:00
Jonathan Cameron 7ae8cf6275 staging: iio: chrdev.h rationalization.
Push some functions out of header and include this where it is needed
in other headers only.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 15:59:09 -07:00
Jonathan Cameron a710cc77db staging: iio: kfifo buffer - push structure definition down into implementation.
Nothing other than the implementation needs to know about this.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 15:59:09 -07:00
Paul Gortmaker 99c978529a staging: Add module.h to drivers/staging users
Lots of people expect module.h to just "be there" without
any #include effort.  But we are crushing that.  So fix those
files in staging relying on implicit module.h presence.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-25 17:01:20 -07:00
Jonathan Cameron 208b813c04 staging:iio:trigger push functions that don't need to be generaly available down into the core.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:44 -07:00
Jonathan Cameron cb6c89a094 staging:iio:trigger core. Trivial code cleanups.
Stop exporting functions only intended for core usage.
Return void from function which can never return anything other than 0.
Trivial stype cleanups.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:43 -07:00
Jonathan Cameron 3f72395ee5 staging:iio: spit trigger.h into provider and consumer parts.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:43 -07:00
Jonathan Cameron 6aea1c364c staging:iio:rename trigger_consumer.h to indicate it is core only.
Need this out the way to create a trigger_consumer.h that actually is
for trigger consumers.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:43 -07:00
Jonathan Cameron f60c4a02aa staging:iio: prevent removal of module connected to trigger.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:42 -07:00
Jonathan Cameron e65bc6ac6f staging:iio:pollfunc: Make explicit that private data is always pointer to a struct iio_dev.
This is always true, so lets make it explicit.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:42 -07:00
Jonathan Cameron 9c0c22bd16 staging:iio:trigger:sysfs trigger: Add a release function to avoid warning on module removal.
The device is static and should never actually be deleted. The release
is just to avoid a warning from the kernel.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:41 -07:00
Jonathan Cameron 82db4249a2 staging:iio:triggers reorder module put and device put to ensure that the ops are still there if put results in device deletion.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:41 -07:00
Jonathan Cameron 5f9c035cae staging:iio:triggers. Add a reference get to the core for triggers.
This is to do with dynamically allocated triggers and the need to ensure
the underlying structures don't go away when a consumer is using them.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:23:41 -07:00
Greg Kroah-Hartman 6f4ebab568 staging: iio: adis16220_core.c: add module.h
This is needed and makes the linux-next merge easier.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 14:21:48 -07:00
Michael Hennerich 7a27b042f9 IIO: ADC: New driver for AD7190/AD7192/AD7195 4 Channel SPI ADC
New driver for AD7190/AD7192/AD7195 4.8 kHz, Ultralow Noise, 24-Bit
Sigma-Delta ADC with PGA

These devices 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:

Add missing documentation.
Remove obsoleted include files.
Fix typos and style issues.
Fix buffer size.
Split ad7192_show() into two functions.
Avoid race condition add mutex.
Abandon IIO_CHAN macro.
Reorder elements in ad7192_platform_data.
Remove driver bus type.

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-08-23 13:40:46 -07:00
Jonathan Cameron 88b42f3a75 staging:iio:imu:adis16344 support
Simple device. Note the sparse scan mask used.

Done from datasheet as very similar to existing parts.

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:40:15 -07:00
Grant Grundler 176f9f29ce STAGING:iio:light: fix ISL29018 init to handle brownout
After a voltage brownout, sensor will now operate correctly.

Page 10 of ISL29018 data sheet and the Intersil Application Note 1534
describe the required initialization sequence:
1. Write 0x00 to register 0x08 (TEST)
2. Write 0x00 to register 0x00 (CMD1)
3. msleep(1)
4. program remaining registers as before

Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Bryan Freed <bfreed@chromium.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:39:48 -07:00
Michael Hennerich f94aa354d6 iio: impedance-analyzer: New driver for AD5933/4 Impedance Converter, Network Analyzer
The AD5933 is a high precision impedance converter system solution
that combines an on-board frequency generator with a 12-bit, 1 MSPS,
analog-to-digital converter (ADC). The frequency generator allows an
external complex impedance to be excited with a known frequency.

The response signal from the impedance is sampled by the on-board ADC
and a discrete Fourier transform (DFT) is processed by an on-chip DSP engine.
The DFT algorithm returns a real (R) and imaginary (I) data-word at each
output frequency.

Changes since V1:

Apply list review feedback:
Consistently use poll_time_jiffies.
Use be|le cpu endian helpers where applicable.
Add various comments.

Changes since V2:

Fix KernelVersion tag in Documentation.
Declare ad5933_default_pdata static.
Fix typos.

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-08-23 13:37:02 -07:00
Michael Hennerich 2051f25d2a iio: adc: New driver for AD7280A Lithium Ion Battery Monitoring System
The AD7280A monitoring system contains all the functions required for
general purpose monitoring and maintenance of stacked
lithium ion batteries as used in hybrid electric vehicles,
battery backup applications, etc.

Changes since V1:

Make cell channels all type IIO_IN_DIFF, update documentation accordingly.
Remove unused and redundant defines.
Use SI units where applicable.
Remove unnecessary wrapper function.
Remove redundant initialization.
Add comments where requested.
Revise event handler.
Use const where applicable.

Changes since V2:

Remove redundant adc.h include file, scheduled for removal.

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-08-23 13:35:49 -07:00
Michael Hennerich 1c5e6a3f76 iio: core: deconstify members of struct iio_chan_spec
Allow dynamic allocation and population of channel spec.

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-08-23 13:35:49 -07:00
Jonathan Cameron 4bfd542103 staging:iio: remove unneeded include
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:34:24 -07:00
Jonathan Cameron c4b14d99bb staging:iio:events: use IIO_<TYPE> and IIO_MOD_<> instead of IIO_EV_CLASS_<TYPE> etc
The original definitions were duplicated to reduce tree churn during introduction of chan_spec
registration.  Now there is no point in maintaining the two sets of definitions.

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:34:24 -07:00
Jonathan Cameron df9c1c42c2 staging:iio: Introduce iio_core.h and move all core only stuff out of iio.h.
Also get rid of a few function defs where they are only now in one core file
anyway.
Whilst here add mask = 0 to get rid of warning.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:34:24 -07:00
Jonathan Cameron 657b90473b staging:iio:adc remove unused adc.h.
Another header unused after chan_spec conversions.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:34:23 -07:00
Jonathan Cameron bbb658a99b staging:iio:accel remove unused accel.h header.
The chan spec conversions and a small amount of pushdown of defines
mean this header is no longer used.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:34:23 -07:00
Jonathan Cameron 9a0a73f485 staging:iio:gyro: remove gyro.h
Not longer needed now all devices with gyro channels are using
iio_chan_spec registration.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:34:23 -07:00
Jonathan Cameron 765f88f2ea staging:iio:magnetometer: remove unused header magnet.h
Now all magnetomers are using iio_chan_spec there is no need for
the macros in magnet.h

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:34:23 -07:00
Jonathan Cameron 694e1b5f95 staging:iio:magnetometer:ak8975 convert to iio_chan_spec + cleanups.
iio_chan_spec conversion is straight forward.

Other changes:
* use i2c_smbus_write_byte_data in write_data
* c99 isms to setup various structures.
* move the comment about the scale factor and kill off trivial access func.
* make mode setting code use a bool rather than a ulong.

Ultimately I'd like to get rid of that mode bit entirely and handle it through
core pm routines, but have left it for now.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:32:49 -07:00
Jonathan Cameron 7991029a55 staging:iio:accel:adis16220 iio_chan_spec conversion.
I still have numerous issues with this driver and it
needs a substantial rewrite.

Whilst doing this patch at least one bug has been fixed (temp
reading didn't have an address) and a number of missing channel
info elements added.

Untested!

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:32:48 -07:00
Jonathan Cameron c9b9e49e13 staging:iio:accel:adis16204: use peak_raw info_mask element + push some defs down from header.
Currently this is the only driver using some of the defines in accel.h.
If these become common we'll just add them to the channel_spec options,
for now push down into this 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-08-23 13:32:48 -07:00
Jonathan Cameron 4f2ca0809c staging:iio:gyro:adis16060 convert to iio_chan_spec
Still a very odd driver. This patch has the side effect of changing
it's name slightly.

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:32:48 -07:00
Jonathan Cameron ae0b4bddc6 staging:iio:gyro:adis16130 move to iio_chan_spec registration.
Simple conversion now we've dropped the type attributes.

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:32:48 -07:00
Jonathan Cameron 494c6b150a staging:iio:magnetometer:hmc5843 iio_chan_spec conversion.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:32:48 -07:00
Jonathan Cameron 584c81fbee staging:iio:gyro:adis16080 convert to iio_chan_spec.
This is a rare driver that is so simple it actually gets longer
as a result of this conversion.  Oh well, swings and roundabouts.

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:32:47 -07:00
Jonathan Cameron 037bad9a72 staging:iio:gyro:adxrs450 squish some trivial single call point wrappers functions.
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:32:47 -07:00
Jonathan Cameron cb4496876f staging:iio:gyro:adxrs450 make more use of spi_read and spi_write.
This needs confirmation that the devices is happy if another part is
talked to in between the request for a register and the read back.

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:32:47 -07:00
Jonathan Cameron 58ea7784a3 staging:iio:gyro:adxrs450 move to iio_chan_spec registration
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:32:47 -07:00