aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-05-18 09:42:40 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-19 19:15:06 -0400
commit44d8b3542f703a70fbd8f3f64816ab8bab32bce0 (patch)
treecffe80779f4440d1c9f3d0a0e61b26604e2c4f01
parent0ed731d2343f7ff964348377bde81c595f8af9e6 (diff)
staging:iio:documenation partial update.
More to be added, but this brings the docs in line with the current code. Now they are hopefully just uninformative rather than actually incorrect. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/iio/Documentation/device.txt78
-rw-r--r--drivers/staging/iio/Documentation/overview.txt19
-rw-r--r--drivers/staging/iio/Documentation/ring.txt44
-rw-r--r--drivers/staging/iio/Documentation/trigger.txt16
-rw-r--r--drivers/staging/iio/Documentation/userspace.txt12
5 files changed, 91 insertions, 78 deletions
diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt
index c81e5172aec8..1abb80cb884e 100644
--- a/drivers/staging/iio/Documentation/device.txt
+++ b/drivers/staging/iio/Documentation/device.txt
@@ -8,34 +8,66 @@ The crucial structure for device drivers in iio is iio_dev.
8 8
9First allocate one using: 9First allocate one using:
10 10
11struct iio_dev *indio_dev = iio_allocate_device(0); 11struct iio_dev *indio_dev = iio_allocate_device(sizeof(struct chip_state));
12where chip_state is a structure of local state data for this instance of
13the chip.
12 14
13Then fill in the following: 15That data can be accessed using iio_priv(struct iio_dev *)
14
15indio_dev->dev.parent
16 the struct device associated with the underlying hardware.
17
18indio_dev->num_interrupt_lines
19 number of event triggering hardware lines the device has.
20 16
21indio_dev->event_attrs 17Then fill in the following:
22 attributes used to enable / disable hardware events - note the
23 attributes are embedded in iio_event_attr structures with an
24 associated iio_event_handler which may or may note be shared.
25 If num_interrupt_lines = 0, then no need to fill this in.
26
27indio_dev->attrs
28 general attributes such as polled access to device channels.
29 18
30indio_dev->dev_data 19- indio_dev->dev.parent
31 private device specific data. 20 Struct device associated with the underlying hardware.
21- indio_dev->name
22 Name of the device being driven - made available as the name
23 attribute in sysfs.
32 24
33indio_dev->driver_module 25- indio_dev->info
34 typically set to THIS_MODULE. Used to specify ownership of some 26 pointer to a structure with elements that tend to be fixed for
35 iio created resources. 27 large sets of different parts supported by a given driver.
28 This contains:
29 * info->driver_module:
30 Set to THIS_MODULE. Used to ensure correct ownership
31 of various resources allocate by the core.
32 * info->num_interrupt_lines:
33 Number of event triggering hardware lines the device has.
34 * info->event_attrs:
35 Attributes used to enable / disable hardware events.
36 * info->attrs:
37 General device attributes. Typically used for the weird
38 and the wonderful bits not covered by the channel specification.
39 * info->read_raw:
40 Raw data reading function. Used for both raw channel access
41 and for associate parameters such as offsets and scales.
42 * info->write_raw:
43 Raw value writing function. Used for writable device values such
44 as DAC values and caliboffset.
45 * info->read_event_config:
46 Typically only set if there are some interrupt lines. This
47 is used to read if an on sensor event detector is enabled.
48 * info->write_event_config:
49 Enable / disable an on sensor event detector.
50 * info->read_event_value:
51 Read value associated with on sensor event detectors. Note that
52 the meaning of the returned value is dependent on the event
53 type.
54 * info->write_event_value:
55 Write the value associated with on sensor event detectors. E.g.
56 a threshold above which an interrupt occurs. Note that the
57 meaning of the value to be set is event type dependant.
36 58
37indio_dev->modes 59- indio_dev->modes:
38 whether direct access and / or ring buffer access is supported. 60 Specify whether direct access and / or ring buffer access is supported.
61- indio_dev->ring:
62 An optional associated buffer.
63- indio_dev->pollfunc:
64 Poll function related elements. This controls what occurs when a trigger
65 to which this device is attached sends and event.
66- indio_dev->channels:
67 Specification of device channels. Most attributes etc are built
68 form this spec.
69- indio_dev->num_channels:
70 How many channels are there?
39 71
40Once these are set up, a call to iio_device_register(indio_dev), 72Once these are set up, a call to iio_device_register(indio_dev),
41will register the device with the iio core. 73will register the device with the iio core.
diff --git a/drivers/staging/iio/Documentation/overview.txt b/drivers/staging/iio/Documentation/overview.txt
index d97106cb2b96..afc39ecde9ca 100644
--- a/drivers/staging/iio/Documentation/overview.txt
+++ b/drivers/staging/iio/Documentation/overview.txt
@@ -3,8 +3,7 @@ Overview of IIO
3The Industrial I/O subsystem is intended to provide support for devices 3The Industrial I/O subsystem is intended to provide support for devices
4that in some sense are analog to digital converters (ADCs). As many 4that in some sense are analog to digital converters (ADCs). As many
5actual devices combine some ADCs with digital to analog converters 5actual devices combine some ADCs with digital to analog converters
6(DACs) the intention is to add that functionality at a future date 6(DACs) that functionality is also supported.
7(hence the name).
8 7
9The aim is to fill the gap between the somewhat similar hwmon and 8The aim is to fill the gap between the somewhat similar hwmon and
10input subsystems. Hwmon is very much directed at low sample rate 9input subsystems. Hwmon is very much directed at low sample rate
@@ -31,32 +30,28 @@ event must be accessed via polling.
31Note: A given device may have one or more event channel. These events are 30Note: A given device may have one or more event channel. These events are
32turned on or off (if possible) via sysfs interfaces. 31turned on or off (if possible) via sysfs interfaces.
33 32
34* Hardware ring buffer support. Some recent sensors have included 33* Hardware buffer support. Some recent sensors have included
35fifo / ring buffers on the sensor chip. These greatly reduce the load 34fifo / ring buffers on the sensor chip. These greatly reduce the load
36on the host CPU by buffering relatively large numbers of data samples 35on the host CPU by buffering relatively large numbers of data samples
37based on an internal sampling clock. Examples include VTI SCA3000 36based on an internal sampling clock. Examples include VTI SCA3000
38series and Analog Device ADXL345 accelerometers. Each ring buffer 37series and Analog Device ADXL345 accelerometers. Each buffer supports
39typically has an event chrdev (similar to the more general ones above) 38polling to establish when data is available.
40to pass on events such as buffer 50% full and an access chrdev via
41which the raw data it self may be read back.
42 39
43* Trigger and software ring buffer support. In many data analysis 40* Trigger and software buffer support. In many data analysis
44applications it it useful to be able to capture data based on some 41applications it it useful to be able to capture data based on some
45external signal (trigger). These triggers might be a data ready 42external signal (trigger). These triggers might be a data ready
46signal, a gpio line connected to some external system or an on 43signal, a gpio line connected to some external system or an on
47processor periodic interrupt. A single trigger may initialize data 44processor periodic interrupt. A single trigger may initialize data
48capture or reading from a number of sensors. These triggers are 45capture or reading from a number of sensors. These triggers are
49used in IIO to fill software ring buffers acting in a very similar 46used in IIO to fill software buffers acting in a very similar
50fashion to the hardware buffers described above. 47fashion to the hardware buffers described above.
51 48
52Other documentation: 49Other documentation:
53 50
54userspace.txt - overview of ring buffer reading from userspace.
55
56device.txt - elements of a typical device driver. 51device.txt - elements of a typical device driver.
57 52
58trigger.txt - elements of a typical trigger driver. 53trigger.txt - elements of a typical trigger driver.
59 54
60ring.txt - additional elements required for ring buffer support. 55ring.txt - additional elements required for buffer support.
61 56
62sysfs-bus-iio - abi documentation file. 57sysfs-bus-iio - abi documentation file.
diff --git a/drivers/staging/iio/Documentation/ring.txt b/drivers/staging/iio/Documentation/ring.txt
index 3696c364e644..7e99ef2b7bc0 100644
--- a/drivers/staging/iio/Documentation/ring.txt
+++ b/drivers/staging/iio/Documentation/ring.txt
@@ -1,57 +1,55 @@
1Ring buffer support within IIO 1Buffer support within IIO
2 2
3This document is intended as a general overview of the functionality 3This document is intended as a general overview of the functionality
4a ring buffer may supply and how it is specified within IIO. For more 4a buffer may supply and how it is specified within IIO. For more
5specific information on a given ring buffer implementation, see the 5specific information on a given buffer implementation, see the
6comments in the source code. Note that the intention is to allow 6comments in the source code. Note that some drivers allow buffer
7some drivers to specify ring buffers choice at probe or runtime, but 7implementation to be selected at compile time via Kconfig options.
8for now the selection is hard coded within a given driver.
9 8
10A given ring buffer implementation typically embedded a struct 9A given buffer implementation typically embeds a struct
11iio_ring_buffer and it is a pointer to this that is provided to the 10iio_ring_buffer and it is a pointer to this that is provided to the
12IIO core. Access to the embedding structure is typically done via 11IIO core. Access to the embedding structure is typically done via
13container_of functions. 12container_of functions.
14 13
15struct iio_ring_buffer contains 4 function pointers 14struct iio_ring_buffer contains a struct iio_ring_setup_ops *setup_ops
16(preenable, postenable, predisable, postdisable). 15which in turn contains the 4 function pointers
17These are used to perform implementation specific steps on either side 16(preenable, postenable, predisable and postdisable).
18of the core changing it's current mode to indicate that the ring buffer 17These are used to perform device specific steps on either side
18of the core changing it's current mode to indicate that the buffer
19is enabled or disabled (along with enabling triggering etc as appropriate). 19is enabled or disabled (along with enabling triggering etc as appropriate).
20 20
21Also in struct iio_ring_buffer is a struct iio_ring_access_funcs. 21Also in struct iio_ring_buffer is a struct iio_ring_access_funcs.
22The function pointers within here are used to allow the core to handle 22The function pointers within here are used to allow the core to handle
23as much ring buffer functionality as possible. Note almost all of these 23as much buffer functionality as possible. Note almost all of these
24are optional. 24are optional.
25 25
26mark_in_use, unmark_in_use 26mark_in_use, unmark_in_use
27 Basically indicate that not changes should be made to the ring 27 Basically indicate that not changes should be made to the buffer state that
28 buffer state that will effect the form of the data being captures 28 will effect the form of the data being captures (e.g. scan elements or length)
29 (e.g. scan elements or length)
30 29
31store_to 30store_to
32 If possible, push data to ring buffer. 31 If possible, push data to the buffer.
33 32
34read_last 33read_last
35 If possible get the most recent entry from the buffer (without removal). 34 If possible, get the most recent scan from the buffer (without removal).
36 This provides polling like functionality whilst the ring buffering is in 35 This provides polling like functionality whilst the ring buffering is in
37 use without a separate read from the device. 36 use without a separate read from the device.
38 37
39rip_lots 38rip_first_n
40 The primary ring buffer reading function. Note that it may well not return 39 The primary buffer reading function. Note that it may well not return
41 as much data as requested. The deadoffset is used to indicate that some 40 as much data as requested.
42 initial data in the data array is not guaranteed to be valid.
43 41
44mark_param_changed 42mark_param_changed
45 Used to indicate that something has changed. Used in conjunction with 43 Used to indicate that something has changed. Used in conjunction with
46request_update 44request_update
47 If parameters have changed that require reinitialization or configuration of 45 If parameters have changed that require reinitialization or configuration of
48 the ring buffer this will trigger it. 46 the buffer this will trigger it.
49 47
50get_bytes_per_datum, set_bytes_per_datum 48get_bytes_per_datum, set_bytes_per_datum
51 Get/set the number of bytes for a complete scan. (All samples + timestamp) 49 Get/set the number of bytes for a complete scan. (All samples + timestamp)
52 50
53get_length / set_length 51get_length / set_length
54 Get/set the number of sample sets that may be held by the buffer. 52 Get/set the number of complete scans that may be held by the buffer.
55 53
56is_enabled 54is_enabled
57 Query if ring buffer is in use 55 Query if ring buffer is in use
diff --git a/drivers/staging/iio/Documentation/trigger.txt b/drivers/staging/iio/Documentation/trigger.txt
index 650157f5c9de..fc2012ebc100 100644
--- a/drivers/staging/iio/Documentation/trigger.txt
+++ b/drivers/staging/iio/Documentation/trigger.txt
@@ -5,14 +5,11 @@ an IIO device. Whilst this can create device specific complexities
5such triggers are registered with the core in the same way as 5such triggers are registered with the core in the same way as
6stand-alone triggers. 6stand-alone triggers.
7 7
8struct iio_trig *trig = iio_allocate_trigger(); 8struct iio_trig *trig = iio_allocate_trigger("<trigger format string>", ...);
9 9
10allocates a trigger structure. The key elements to then fill in within 10allocates a trigger structure. The key elements to then fill in within
11a driver are: 11a driver are:
12 12
13trig->control_attrs
14 Any sysfs attributes needed to control parameters of the trigger
15
16trig->private_data 13trig->private_data
17 Device specific private data. 14 Device specific private data.
18 15
@@ -20,8 +17,12 @@ trig->owner
20 Typically set to THIS_MODULE. Used to ensure correct 17 Typically set to THIS_MODULE. Used to ensure correct
21 ownership of core allocated resources. 18 ownership of core allocated resources.
22 19
23trig->name 20trig->set_trigger_state:
24 A unique name for the trigger. 21 Function that enables / disables the underlying source of the trigger.
22
23There is also a
24trig->alloc_list which is useful for drivers that allocate multiple
25triggers to keep track of what they have created.
25 26
26When these have been set call: 27When these have been set call:
27 28
@@ -30,9 +31,8 @@ iio_trigger_register(trig);
30to register the trigger with the core, making it available to trigger 31to register the trigger with the core, making it available to trigger
31consumers. 32consumers.
32 33
33
34Trigger Consumers 34Trigger Consumers
35 35
36Currently triggers are only used for the filling of software ring 36Currently triggers are only used for the filling of software
37buffers and as such any device supporting INDIO_RING_TRIGGERED has the 37buffers and as such any device supporting INDIO_RING_TRIGGERED has the
38consumer interface automatically created. 38consumer interface automatically created.
diff --git a/drivers/staging/iio/Documentation/userspace.txt b/drivers/staging/iio/Documentation/userspace.txt
deleted file mode 100644
index ff06e5dc7188..000000000000
--- a/drivers/staging/iio/Documentation/userspace.txt
+++ /dev/null
@@ -1,12 +0,0 @@
1Userspace access to IIO
2
3The sysfs attributes are documented in sysfs-bus-iio.
4
5Udev will create the following entries under /dev by default:
6
7device0:buffer0:access0 - ring access chrdev
8device0:buffer0:event0 - ring event chrdev
9device0:event0 - general event chrdev.
10
11The files, lis3l02dqbuffersimple.c and iio_utils.h in this directory provide an example
12of how to use the ring buffer and event interfaces.