ARM: cpuidle: Fix error return code
[deliverable/linux.git] / Documentation / iio / iio_configfs.txt
CommitLineData
4c3e2a40
DB
1Industrial IIO configfs support
2
31. Overview
4
5Configfs is a filesystem-based manager of kernel objects. IIO uses some
6objects that could be easily configured using configfs (e.g.: devices,
7triggers).
8
9See Documentation/filesystems/configfs/configfs.txt for more information
10about how configfs works.
11
122. Usage
13
14In order to use configfs support in IIO we need to select it at compile
15time via CONFIG_IIO_CONFIGFS config option.
16
17Then, mount the configfs filesystem (usually under /config directory):
18
19$ mkdir /config
20$ mount -t configfs none /config
21
22At this point, all default IIO groups will be created and can be accessed
23under /config/iio. Next chapters will describe available IIO configuration
24objects.
25
263. Software triggers
27
28One of the IIO default configfs groups is the "triggers" group. It is
29automagically accessible when the configfs is mounted and can be found
30under /config/iio/triggers.
31
32IIO software triggers implementation offers support for creating multiple
33trigger types. A new trigger type is usually implemented as a separate
34kernel 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
43static 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
51static 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
58static const struct iio_sw_trigger_ops iio_trig_sample_ops = {
59 .probe = iio_trig_sample_probe,
60 .remove = iio_trig_sample_remove,
61};
62
63static struct iio_sw_trigger_type iio_trig_sample = {
64 .name = "trig-sample",
65 .owner = THIS_MODULE,
66 .ops = &iio_trig_sample_ops,
67};
68
69module_iio_sw_trigger_driver(iio_trig_sample);
70
71Each trigger type has its own directory under /config/iio/triggers. Loading
72iio-trig-sample module will create 'trig-sample' trigger type directory
73/config/iio/triggers/trig-sample.
74
75We support the following interrupt sources (trigger types):
76 * hrtimer, uses high resolution timers as interrupt source
77
783.1 Hrtimer triggers creation and destruction
79
80Loading iio-trig-hrtimer module will register hrtimer trigger types allowing
81users to create hrtimer triggers under /config/iio/triggers/hrtimer.
82
83e.g:
84
85$ mkdir /config/triggers/hrtimer/instance1
86$ rmdir /config/triggers/hrtimer/instance1
87
88Each trigger can have one or more attributes specific to the trigger type.
89
903.2 "hrtimer" trigger types attributes
91
92"hrtimer" trigger type doesn't have any configurable attribute from /config dir.
93It does introduce the sampling_frequency attribute to trigger directory.
This page took 0.062234 seconds and 5 git commands to generate.