|| ||Jonathan Cameron <email@example.com> |
|| ||LKML <firstname.lastname@example.org>,
Greg Kroah-Hartman <email@example.com>,
Kay Sievers <firstname.lastname@example.org>,
Dmitry Torokhov <email@example.com>,
"Hennerich, Michael" <Michael.Hennerich@analog.com>,
Manuel Stahl <firstname.lastname@example.org>,
"Frysinger, Michael" <Michael.Frysinger@analog.com>,
"Getz, Robin" <Robin.Getz@analog.com>,
"Trisal, Kalhan" <email@example.com>,
"Zhang, Xing Z" <firstname.lastname@example.org>,
Ira Snyder <email@example.com>,
Jean Delvare <firstname.lastname@example.org>,
Samu Onkalo <email@example.com> |
|| ||[RFC] Staging: IIO: New ABI V2 |
|| ||Fri, 05 Feb 2010 18:21:16 +0000|
|| ||Article, Thread
Here is another iteration of the ABI spec for IIO with changes made in response
to http://lkml.org/lkml/2010/1/20/195 and
http://marc.info/?l=lm-sensors&m=126496271320649&w=2 along with a few other
general tidy ups.
If there are no major issues raised, we may begin working on the move to this
ABI shortly on the basis any minor changes can always get cleaned up before
those patches merge. I'll also be doing a formal version of this file for
in kernel documentation once things are fairly stable with all of the information
not relevant to this discussion.
Changes since v1:
* iio is now a bus with directory changes resulting in this document.
* moved to in0_raw etc for voltage sensors to avoid confusion with a completely
different ABI from hwmon. Jean made the point that we shouldn't take this to
far, but as things currently stand there is no disadvantage in this name change.
* dropped freefall event for now. More discussions need to be had on this and in
a straight IIO world we normally won't care about this one anyway.
* 'device' naming changed for the various subsidiary devices so as make the
interconnections more obvious. I haven't tried implementing this yet, but I
think the small amount of pain involved is worth it for increased clarity.
The only exception is triggers where the connections are not specified as a
given trigger may not have and IIO device associated with it. Anyone suggest
a scheme for this? (see about 10 lines below to clarify what I mean here!)
* As conversion of the max1363 driver over to a consistent scan_element interface
will mean that these will only apply to the ring buffer (rather than direct
capture), scan_elements is moved into the ring buffer device directory.
* Switch ring for simply buffer as it might be a fifo or other buffer form instead.
At times I may have suppressed links that would be created by the tree of
devices. In the flat base directory a given driver can now create the following:
Which correspond to
Hence we still meet the unique naming requirements but have a much clearer
direct means fo understanding the resulting tree.
I have take liberties with not specifying obvious equivalents of scale etc
for all the channel types.
There are probably countless error in here. Please point any out you come
across. This file may well need breaking up into sysfs-class-iio-in, accel
etc so as to keep it manageable. Note this is not intended to obey the ABI
spec well. It will be cleaned up before submission and all the other
required information added.
Hardware chip or device accessed by on communication port.
Corresponds to a grouping of sensor channels.
An event driven driver of data capture to an in kernel buffer.
May be provided by a device driver that also has an IIO device
based on hardware generated events (e.g. data ready) or
provided by a separate driver for other hardware (e.g.
periodic timer, gpio or high resolution timer).
Contains trigger type specific elements. These do not
generalize well and hence are not documented in this file.
Link to /sys/class/iio/device[n]/device[n]:buffer. n indicates the
device with which this buffer buffer is associated.
Description of the physical chip / device. Typically a part
Raw (unscaled no bias removal etc) voltage measurement from
channel m. name is used in special cases where this does
not correspond to externally available input (e.g. supply
voltage monitoring in which case the file is in_supply_raw).
If known for a device, offset to be added to in[m]_raw prior
to scaling by volt[m]_scale in order to obtain voltage in
millivolts. Not present if the offset is always 0 or unknown.
If m is not present, then voltage offset applies to all in
channels. May be writable if a variable offset is controlled
by the device. Note that this is different to calibbias which
is for devices that apply offsets to compensate for variation
between different instances of the part, typically adjusted by
using some hardware supported calibration procedure.
If a small number of discrete offset values are available, this
will be a space separated list. If these are independant (but
options the same) for individual offsets then m should not be
If a more or less continuous range of voltage offsets are supported
then these specify the minimum and maximum. If shared by all
in channels then m is not present.
Hardware applied calibration offset. (assumed to fix production
Hardware applied calibration scale factor. (assumed to fix production
If known for a device, scale to be applied to volt[m]_raw post
addition of volt[m]_offset in order to obtain the measured voltage
in millivolts. If shared across all in channels then m is not present.
Raw (unscaled) differential voltage measurement equivalent to
channel m - channel o where these channel numbers apply to the physically
equivalent inputs when non differential readings are separately available.
In differential only parts, then all that is required is a consistent
Acceleration in direction x, y or z (may be arbitrarily assigned
but should match other such assignments on device)
channel m (not present if only one accelerometer channel at
this orientation). Has all of the equivalent parameters as per in[m].
Units after application of scale and offset are m/s^2.
Angular velocity about axis x, y or z (may be arbitrarily assigned)
channel m (not present if only one gyroscope at this orientation).
Data converted by application of offset then scale to
radians per second. Has all the equivalent parameters as per in[m].
Magnetic field along axis x, y or z (may be arbitrarily assigned)
channel m (not present if only one magnetometer at this orientation).
Data converted by application of offset then scale to Gauss
Has all the equivalent modifiers as per in[m].
Configuration of which hardware generated events are passed up to
userspace. Some of these are a bit complex to generalize so this
section is a work in progress.
major:minor character device numbers for the event line.
Taking accel_x0 as an example
Event generated when accel_x0 passes a threshold in correction direction
(or stays beyond one). If direction isn't specified, either triggers it.
Note driver will assume last p events requested are enabled where p is
however many it supports. So if you want to be sure you have
set what you think you have, check the contents of these. Drivers
may have to buffer any parameters so that they are consistent when a
given event type is enabled a future point (and not those for whatever
alarm was previously enabled).
Same as above but based on the first differential of the value.
A period of time (microsecs) for which the condition must be broken
before an interrupt is triggered. Applies to all alarms if type is not
The actual value of the threshold in raw device units obtained by
reverse application of scale and offset to the acceleration in m/s^2.
Directory containing interfaces for elements that will be captured
for a single triggered sample set in the buffer.
Scan element control for triggered data capture. m implies the
ordering within the buffer. Next the type is specified with
modifier and channel number as per the sysfs single channel
Scan element precision within the buffer. Note that the
data alignment must restrictions must be read from within
buffer to work out full data alignment for data read
via buffer_access chrdev. _x0 dropped if shared across all
A bit shift (to right) that must be applied prior to
extracting the bits specified by accel[_x0]_precision.
Buffer for device n event character device major:minor numbers.
Buffer for device n access character device o major:minor numbers.
The name of the trigger source being used, as per string given
Number of scans contained by the buffer.
Bytes per scan. Due to alignment fun, the scan may be larger
than implied directly by the scan_element parameters.
Actually start the buffer capture up. Will start trigger
if first device and appropriate.
Minimum data alignment. Scan elements larger than this are aligned
to the nearest power of 2 times this. (may not be true in weird
hardware buffers that pack data well)
So an example, adis16350
accel_scale (applies to all accel channels)
accel_x_raw (the raw reading)
accel_x_calibbias (calibration value - in reg XACCEL_OFF
accel_x_raw_offset assumed to be 0 so not provided).
temp_gyrox_raw (These are somewhat unusual!)
frequency (applies even when trigger not running, so a device parameter
rather than one for the data ready trigger)
//some stuff that may not generalise...
//etc. This may seem overkill but this the only option that I
//can think of that generalizes well. Other suggestions welcome!
//device specific (may generalize)
trigger0/ (adis16350 is providing a data ready trigger)
//there are no other parameters here as the datardy frequency is dependent
//on how device is configured.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/