diff options
author | Daniel Baluta <daniel.baluta@intel.com> | 2015-11-09 02:14:02 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-12-03 13:19:28 -0500 |
commit | 4c3e2a4036054deca4819758f59ff65f27938388 (patch) | |
tree | 2985776af3edacb149b3fba286b45ac960cb213e | |
parent | ac5006a2a558a2441a840c7be1e0e717839d5e07 (diff) |
iio: Documentation: Add IIO configfs documentation
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | Documentation/ABI/testing/configfs-iio | 21 | ||||
-rw-r--r-- | Documentation/iio/iio_configfs.txt | 93 |
2 files changed, 114 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/configfs-iio b/Documentation/ABI/testing/configfs-iio new file mode 100644 index 000000000000..2483756fccf5 --- /dev/null +++ b/Documentation/ABI/testing/configfs-iio | |||
@@ -0,0 +1,21 @@ | |||
1 | What: /config/iio | ||
2 | Date: October 2015 | ||
3 | KernelVersion: 4.4 | ||
4 | Contact: linux-iio@vger.kernel.org | ||
5 | Description: | ||
6 | This represents Industrial IO configuration entry point | ||
7 | directory. It contains sub-groups corresponding to IIO | ||
8 | objects. | ||
9 | |||
10 | What: /config/iio/triggers | ||
11 | Date: October 2015 | ||
12 | KernelVersion: 4.4 | ||
13 | Description: | ||
14 | Industrial IO software triggers directory. | ||
15 | |||
16 | What: /config/iio/triggers/hrtimers | ||
17 | Date: October 2015 | ||
18 | KernelVersion: 4.4 | ||
19 | Description: | ||
20 | High resolution timers directory. Creating a directory here | ||
21 | will result in creating a hrtimer trigger in the IIO subsystem. | ||
diff --git a/Documentation/iio/iio_configfs.txt b/Documentation/iio/iio_configfs.txt new file mode 100644 index 000000000000..f0add35cd52e --- /dev/null +++ b/Documentation/iio/iio_configfs.txt | |||
@@ -0,0 +1,93 @@ | |||
1 | Industrial IIO configfs support | ||
2 | |||
3 | 1. Overview | ||
4 | |||
5 | Configfs is a filesystem-based manager of kernel objects. IIO uses some | ||
6 | objects that could be easily configured using configfs (e.g.: devices, | ||
7 | triggers). | ||
8 | |||
9 | See Documentation/filesystems/configfs/configfs.txt for more information | ||
10 | about how configfs works. | ||
11 | |||
12 | 2. Usage | ||
13 | |||
14 | In order to use configfs support in IIO we need to select it at compile | ||
15 | time via CONFIG_IIO_CONFIGFS config option. | ||
16 | |||
17 | Then, mount the configfs filesystem (usually under /config directory): | ||
18 | |||
19 | $ mkdir /config | ||
20 | $ mount -t configfs none /config | ||
21 | |||
22 | At this point, all default IIO groups will be created and can be accessed | ||
23 | under /config/iio. Next chapters will describe available IIO configuration | ||
24 | objects. | ||
25 | |||
26 | 3. Software triggers | ||
27 | |||
28 | One of the IIO default configfs groups is the "triggers" group. It is | ||
29 | automagically accessible when the configfs is mounted and can be found | ||
30 | under /config/iio/triggers. | ||
31 | |||
32 | IIO software triggers implementation offers support for creating multiple | ||
33 | trigger types. A new trigger type is usually implemented as a separate | ||
34 | kernel module following the interface in include/linux/iio/sw_trigger.h: | ||
35 | |||
36 | /* | ||
37 | * drivers/iio/trigger/iio-trig-sample.c | ||
38 | * sample kernel module implementing a new trigger type | ||
39 | */ | ||
40 | #include <linux/iio/sw_trigger.h> | ||
41 | |||
42 | |||
43 | static struct iio_sw_trigger *iio_trig_sample_probe(const char *name) | ||
44 | { | ||
45 | /* | ||
46 | * This allocates and registers an IIO trigger plus other | ||
47 | * trigger type specific initialization. | ||
48 | */ | ||
49 | } | ||
50 | |||
51 | static int iio_trig_hrtimer_remove(struct iio_sw_trigger *swt) | ||
52 | { | ||
53 | /* | ||
54 | * This undoes the actions in iio_trig_sample_probe | ||
55 | */ | ||
56 | } | ||
57 | |||
58 | static const struct iio_sw_trigger_ops iio_trig_sample_ops = { | ||
59 | .probe = iio_trig_sample_probe, | ||
60 | .remove = iio_trig_sample_remove, | ||
61 | }; | ||
62 | |||
63 | static struct iio_sw_trigger_type iio_trig_sample = { | ||
64 | .name = "trig-sample", | ||
65 | .owner = THIS_MODULE, | ||
66 | .ops = &iio_trig_sample_ops, | ||
67 | }; | ||
68 | |||
69 | module_iio_sw_trigger_driver(iio_trig_sample); | ||
70 | |||
71 | Each trigger type has its own directory under /config/iio/triggers. Loading | ||
72 | iio-trig-sample module will create 'trig-sample' trigger type directory | ||
73 | /config/iio/triggers/trig-sample. | ||
74 | |||
75 | We support the following interrupt sources (trigger types): | ||
76 | * hrtimer, uses high resolution timers as interrupt source | ||
77 | |||
78 | 3.1 Hrtimer triggers creation and destruction | ||
79 | |||
80 | Loading iio-trig-hrtimer module will register hrtimer trigger types allowing | ||
81 | users to create hrtimer triggers under /config/iio/triggers/hrtimer. | ||
82 | |||
83 | e.g: | ||
84 | |||
85 | $ mkdir /config/triggers/hrtimer/instance1 | ||
86 | $ rmdir /config/triggers/hrtimer/instance1 | ||
87 | |||
88 | Each trigger can have one or more attributes specific to the trigger type. | ||
89 | |||
90 | 3.2 "hrtimer" trigger types attributes | ||
91 | |||
92 | "hrtimer" trigger type doesn't have any configurable attribute from /config dir. | ||
93 | It does introduce the sampling_frequency attribute to trigger directory. | ||