Commit Graph

56 Commits

Author SHA1 Message Date
Jonathan Cameron 4d5f8d3db5 staging:iio: add hook to allow core to perform scan related config.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-08 11:36:11 -08:00
Jonathan Cameron 5fb21c824e staging:iio:find iio channel from scan index util function
Useful for getting to the channel based on scan mask alone.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-08 11:36:10 -08:00
Jonathan Cameron df94aba81f staging:iio: filter description - low pass 3db frequency.
Introduce the first data filtering related parameter.
For now we are ignoring the filter type and merely specifying its
approximate (I read them off tiny graphs) 3db point.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-28 04:22:23 +09:00
Jonathan Cameron c8a9f8056f staging:iio:treewide only use shared to decide on interfaces
Internally the fact that say scale is shared across channels is
actually of remarkably little interest.  Hence lets not store it.
Numerous devices have weird combinations of channels sharing
scale anyway so it is not as though this was really telling
us much. Note however that we do still use the shared sysfs
attrs thus massively reducing the number of attrs in complex
drivers.

Side effect is that certain drivers that were abusing this
(mostly my work) needed to do a few more checks on what the
channel they are being queried on actually is.

This is also helpful for in kernel interfaces where we
just want to query the scale and don't care whether it
is shared with other channels or not.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 16:35:04 -08:00
Lars-Peter Clausen 924f8a21dd staging:iio: Do not use bitmasks for channel info addresses
Currently the iio framework uses bitmasks for the address field of channel info
attributes. This is for historical reasons and no longer required since it will
only ever query a single info attribute at once. This patch changes the code to
use the non-shifted iio_chan_info_enum values for the info attribute address.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 16:35:04 -08:00
Jonathan Cameron af5046af1c staging:iio: header reorganization
Issue brought up by Lars-Peter Clausen. This is a varient of what
he suggested.

io/iio.h for driver stuff (has to include types.h)
	Sub files for the bits drivers may or may not use
	iio/sysfs.h
	iio/buffer.h (contents of current buffer_generic.h)
	(obviously anything offering events will need events.h as well)
iio/types.h for the enums that matter to both
	iio_chan_type, iio_modifier
iio/events.h for the event code stuff
	IIO_EVENT_CODE and friends.  + everything in chrdev.h  So this
	is the stuff that userspace cares about.
	Also include iio_event_type, iio_event_direction

Thus iio drivers include iio.h + as required
events.h
sysfs.h
buffer.h

in kernel users (once that interface is merged) will need inkern.h
which will pull in types.h

Userspace will need just events.h (which pulls in types.h) to get
everything they need to know about.  Buffer userspace access doesn't
currently need any core defines. All information about the data
format is passed through sysfs.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 16:35:04 -08:00
Jonathan Cameron f8c6f4e9a4 staging:iio:core:naming: dev_info to indio_dev for consistency
We had a random missmatch of these two.  Lets pick the most common
and get rid of the other.  This patch covers the core.  Others
will clean up the drivers.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-11 09:58:58 -06:00
Jonathan Cameron 41ea040c7b staging:iio: rename gyro channels to anglvel
Ensure naming reflects what is measured, not how it is done.
Resolvers can measure the same thing for starters.
IIO_GYRO->IIO_ANGL_VEL to ensure consistent naming.

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-10-05 13:47:46 -07:00
Jonathan Cameron 6835cb6b43 staging:iio: unwind the IIO_IN -> IIO_VOLTAGE define
This was originally there to avoid churn during a complex change.
Now everything is stable lets get rid of this as it is missleading
and confusing.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-29 17:32:07 -07:00
Jonathan Cameron 14555b1445 staging:iio: replacing term ring with buffer in the IIO core.
They aren't always ring buffers, so just use buffer for all naming.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-26 17:31:53 -07:00
Jonathan Cameron ec3afa40c6 staging:iio: tree wide IIO_RING_TRIGGERED -> IIO_BUFFER_TRIGGERED
also, IIO_RING_HARDWARE_BUFFER -> IIO_BUFFER_HARDWARE

These aren't always rings so the naming should not imply that.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-26 17:31:52 -07:00
Jonathan Cameron ade7ef7ba3 staging:iio: Differential channel handling - use explicit flag rather than types.
Straight forward change in the core, but required some drivers to not use
the IIO_CHAN macro as that doesn't allow setting this bit (and is
going away anyway). Hence the churn.

Tested on max1363 with a couple of supported parts.

V2: differential bit in code got 7 bits and direction 1. Reversed that.
Issue spotted by Michael - thanks!

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:02:03 -07:00
Jonathan Cameron 66dbe70437 staging:iio: Add capacitance type and average_raw chan info.
These are both needed for CAPADCs

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:02:02 -07:00
Jonathan Cameron 26d25ae3f0 staging:iio: rework of attribute registration.
This set also includes quite a number of bug fixes of particularly
remove functions.

Necessary due to issue pointed out in Bart Van Assche's patch:
docs/driver-model: Document device.groups

V2: Rebase due to patch reordering.
V3: Pull various error fixes and cleanups out into their own patches.

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:02:01 -07:00
Jonathan Cameron 330c6c57e6 staging:iio:events - new 64 bit code structure and push out drivers.
This costs us nothing in event storage (as we are carrying a 64 bit
timestamp in the structure) and gives us lots more room to play with.

Also allows for more channels which some parts need.

V2: Cleanup some loose ends (such as the switch with only one option now).

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:02:00 -07:00
Jonathan Cameron 32b5eecab0 staging:iio: Switch the channel masks to bitmaps so as to allow for more channels.
This is as light as possible on changes to current drivers.
Some drivers make assumptions that their masks fit in a single
long.  Given they were previously working this is clearly valid if
not tidy.

The max1363 is an example where there should be no such assumptions.

V2: Add the new 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 16:01:59 -07:00
Jonathan Cameron 8310b86c3c staging:iio:scan element types: introduce endian description to the data format.
If not set in chan_spec, cpu endianness used.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 16:01:58 -07:00
Jonathan Cameron c6fc806247 staging:iio: ABI rework - add in_ or out_ prefix to channnels
Also involves changing current inX outX to in_voltageX and out_voltageX

V2: squash users of the IIO_CHAN_OUT macro and get rid of it.
There are very few of these, so it is easier to fix 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-09-06 16:01:58 -07:00
Jonathan Cameron 9dd1cb303c staging:iio: push "sysfs.h" and linux/irq.h out of iio.h
These are no longer needed.
Requires a few driver updates for places "sysfs.h" should have been
present but wasn't.

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 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
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 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 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
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 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 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 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 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
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 5c04af0483 iio: industrialio-core: iio_write_channel_info accept IIO_VAL_INT_PLUS_NANO
Allow iio_write_channel_info() to accept IIO_VAL_INT_PLUS_NANO

Changes since V1:
use callback to query expected format/precision

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:39:34 -07:00
Michael Hennerich 43a4360ea8 iio: trigger: Add filter callback
Allow devices to reject triggers and vice versa.

Changes since V1:
Added kernel-doc
Moved callback into iio_info
Changed function naming
Revised return value passing
Add forward declaration to avoid warnings

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:39:33 -07:00
Michael Hennerich 71646e2c7a iio: industrialio-core: introduce IIO_VAL_INT_PLUS_NANO
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:39:32 -07:00
Jonathan Cameron 6fe8135fcc staging:iio: implement an iio_info structure to take some of the constant elements out of iio_dev.
This was suggested by Arnd Bergmann,  Other elements may well
move in here in future, but it definitely makes sense for these.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:15:05 -07:00
Jonathan Cameron 02db0bb33a staging:iio:buffer - remove unused event code for buffer events.
These events are no longer passed up to userspace.

ad7745 - was using these events to indicate directly dataready
events.  I'm not sure when it ever makes sense to push these
to userspace so for now I've taken them to event codes 0 and 1
until someone has time to make this driver do something more
standard. (they were arbitary before, they still are, be it
in a different way!)

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:15:01 -07:00
Jonathan Cameron 41c775240a staging:iio:core clean out unused elements.
Trivial cleanup of things that have fallen by the way.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:15:00 -07:00
Michael Hennerich faf290e867 staging:iio: Add channel types IIO_CURRENT and IIO_POWER.
This is required for the ADE7758 driver cleanup.

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-05-19 16:14:58 -07:00
Jonathan Cameron eb7fea53e5 staging:iio: Add chan info support for 'peak_raw' attributes.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:14:57 -07:00
Jonathan Cameron 1b732888d8 staging:iio: Add core attribute handling for name of device.
Saves on a fair bit of code replication.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:14:54 -07:00
Jonathan Cameron aaf370db7d staging:iio: Remove legacy event handling.
This requires all drivers using the channel registration code and
events to change in one go.

V3: remove unwanted irq enable from event handler.
V2: rebase related fixes to move to new IIO_CHAN macro. All trivial.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:13:05 -07:00
Jonathan Cameron 72b38e3de1 staging:iio: Push interrupt setup down into the drivers for event lines.
It is much easier to do in driver, and the core does not add much.
Note all drivers will have to be updated with this patch.
None currently are.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:06:12 -07:00
Jonathan Cameron b9d40a9d55 staging:iio: remove legacy event chrdev for the buffers
part of sca3000 driver temporarily disabled (buffer won't run
anyway).  This section is replaced later in this patch set.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:06:12 -07:00
Jonathan Cameron 939606d5cc staging:iio: remove ability to escalate events.
Whilst it is possible to output events to say buffers have passed
a particular level there are no obvious reasons to actually do so.

The upshot of this patch is that buffers will only ever have
one threshold turned on at a time.

For now sca3000 has it's ring buffer effectively disabled.
Fixed later in series.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:06:11 -07:00
Jonathan Cameron 1d892719e7 staging:iio: allow channels to be set up using a table of iio_channel_spec structures.
V8: Add missing address in IIO_CHAN macro. Spotted by Michael Hennerich.
V7: Document additions to iio_dev structure.
V6: Fixup the docs for iio_chan_spec structure.
V5: Actually have the macro handle the _input type channels (oops)
V4: Add ability to do, _input and modified channel naming in a coherent fashion.
    Scrap all the messy IIO_CHAN_* macros and move to only one.

V3: Added more types - intensity and light.

V2: Various fixes - some thanks to Arnd.
    Bug fix for unregistering of event attr group
    Changed iio_read_channel_info to have two part value - use for
    raw value read as well.
    constify the channelspec structures
    raw write support for calibbias and similar
    Additional strings for buidling attribute names.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:06:11 -07:00
Jonathan Cameron 6f7c8ee585 staging:iio: Add ability to allocate private data space to iio_allocate_device
Suggested by Arnd Bergmann.  Note this will break ALL drivers that
are out of mainline.  The fix is trivial change of
iio_allocate_device() -> iio_allocate_device(0)
Sorry if this causes issues for any one!

V2: Include new drivers in the update

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-04-25 17:23:09 -07:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Jonathan Cameron b156cf70e1 staging: iio: convert idr to ida as pointer never provided
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-04 21:18:59 -07:00
Manuel Stahl bf32963cbe staging: iio move scan_elements into ring buffer
tested with sca3000, adis16400

Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-08-31 11:42:02 -07:00