Add initial configfs support for IIO
Subsystems (4)
v8 cover Add initial configfs support for IIO
This patchset introduces IIO software triggers, offers a way of configuring them via configfs and adds the IIO hrtimer based interrupt source to be used with software triggers.
The arhitecture is now split in 3 parts, to remove all IIO trigger specific parts from IIO configfs core:
(1) IIO configfs - offers a generic way of creating IIO objects. So far there is one default group for triggers.
(2) IIO software triggers - software trigger implementation.
(3) IIO hrtimer trigger - is the first interrupt source for software triggers (with syfs to follow). Each trigger type can implement its own set of attributes.
Lockdep seems to be happy with the locking in configfs patch.
Changes since v7:
* patch 1/5
* do not add dentry parameter for create_default_group, we can retrieve it from group.
* call configfs_detach_prep before configfs_detach_group in configfs_unregister_group.
* call link_group/unlink_group under su_mutex lock
* take configfs_dirent_lock when calling configfs_dir_set_ready
* patch 2/5
* export iio_triggers_group, this will be later used by sw triggers
* patch 3/5
* make iio_sw_trigger part of industrialio core
* fix compilation problem reported by Vladimir and Lars. Things didn't get well when having IIO_SW_TRIGGER enabled and IIO_CONFIGFS disabled.
* use format string in config_item_set_name
* make iio_unregister_sw_trigger_type return type void.
* patch 4/5
* none
* patch 5/5
* include a small trigger type sample example.
Changes since v6:
* implemented Lars-Peter's idea (https://lkml.org/lkml/2015/5/13/302)
to switch from /config/iio/triggers/hrtimer-instance1 to /config/iio/triggers/instance1.
Changes since v5: (after Lars comments)
* the most important change is that we moved sampling_frequency attribute from configfs to trigger's directory in /sys.
* couple of const added to strings
* documentation to public API in sw_trigger.h
* replace pr_err with WARN_ONCE in trigger_make_group to avoid spamming kernel log, but without leaving user clueless in case of errors.
* we still need to decide if we get a real gain by adding min/max limits for sampling frequency in /config dir. Anyhow, this can be done in a later patch.
* fix race in hrtimer_remove
Changes since v4:
* patch 1/4
- fixed "new line" nit in industrialio-sw-trigger.c
- added license header in sw_trigger.h o
* patch 2/4
- none
* patch 3/4
- none
* patch 4/4
- removed "Further work" chapter in iio_configfs.txt
- added configfs-iio file in Documentation/ABI/testing
Daniel Baluta (5):
configfs: Allow dynamic group creation
iio: core: Introduce IIO configfs support
iio: core: Introduce IIO software triggers
iio: trigger: Introduce IIO hrtimer based trigger
iio: Documentation: Add IIO configfs documentation
Documentation/ABI/testing/configfs-iio | 21 ++++ Documentation/iio/iio_configfs.txt | 93 ++++++++++++++++ drivers/iio/Kconfig | 15 +++ drivers/iio/Makefile | 2 + drivers/iio/industrialio-configfs.c | 103 ++++++++++++++++++ drivers/iio/industrialio-sw-trigger.c | 137 +++++++++++++++++++++++ drivers/iio/trigger/Kconfig | 10 ++ drivers/iio/trigger/Makefile | 2 + drivers/iio/trigger/iio-trig-hrtimer.c | 193 +++++++++++++++++++++++++++++++++ fs/configfs/dir.c | 50 +++++++++ include/linux/configfs.h | 4 + include/linux/iio/sw_trigger.h | 120 ++++++++++++++++++++ 12 files changed, 750 insertions(+) create mode 100644 Documentation/ABI/testing/configfs-iio create mode 100644 Documentation/iio/iio_configfs.txt create mode 100644 drivers/iio/industrialio-configfs.c create mode 100644 drivers/iio/industrialio-sw-trigger.c create mode 100644 drivers/iio/trigger/iio-trig-hrtimer.c create mode 100644 include/linux/iio/sw_trigger.h
Signature · 1 line
1.9.1
PATCH v8 1/5 configfs: Allow dynamic group creation
We don't want to hardcode default groups at subsystem creation time. We export:
* configfs_register_group
* configfs_unregister_group
to allow drivers to programatically create/destroy groups later, after module init time.
This is needed for IIO configfs support.
--- fs/configfs/dir.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/configfs.h | 4 ++++ 2 files changed, 54 insertions(+)
fs/configfs/dir.c +50 -0
@@ -1636,6 +1636,56 @@ const struct file_operations configfs_dir_operations = { .iterate = configfs_readdir, }; +int configfs_register_group (struct config_group *parent_group, +struct config_group *group) +{ +struct configfs_subsystem *subsys = parent_group->cg_subsys; +struct dentry *parent; +int ret; + +mutex_lock (&subsys->su_mutex); +link_group (parent_group, group); +mutex_unlock (&subsys->su_mutex); + + parent = parent_group->cg_item.ci_dentry; + +mutex_lock_nested (&d_inode (parent)->i_mutex,I_MUTEX_PARENT ); + ret =create_default_group (parent_group, group); +if (!ret) { +spin_lock (&configfs_dirent_lock); +configfs_dir_set_ready (group->cg_item.ci_dentry->d_fsdata); +spin_unlock (&configfs_dirent_lock); + } +mutex_unlock (&d_inode (parent)->i_mutex); +return ret; +} +EXPORT_SYMBOL (configfs_register_group); + +void configfs_unregister_group (struct config_group *group) +{ +struct configfs_subsystem *subsys = group->cg_subsys; +struct dentry *dentry = group->cg_item.ci_dentry; +struct dentry *parent = group->cg_item.ci_parent->ci_dentry; + +mutex_lock_nested (&d_inode (parent)->i_mutex,I_MUTEX_PARENT ); +spin_lock (&configfs_dirent_lock); +configfs_detach_prep (dentry,NULL ); +spin_unlock (&configfs_dirent_lock); + +configfs_detach_group (&group->cg_item); +d_inode (dentry)->i_flags |=S_DEAD ; +dont_mount (dentry); +d_delete (dentry); +mutex_unlock (&d_inode (parent)->i_mutex); + +dput (dentry); + +mutex_lock (&subsys->su_mutex); +unlink_group (group); +mutex_unlock (&subsys->su_mutex); +} +EXPORT_SYMBOL (configfs_unregister_group); +int configfs_register_subsystem (struct configfs_subsystem *subsys) {int err;
include/linux/configfs.h +4 -0
@@ -252,6 +252,10 @@ static inline struct configfs_subsystem *to_configfs_subsystem(struct config_groint configfs_register_subsystem (struct configfs_subsystem *subsys);void configfs_unregister_subsystem (struct configfs_subsystem *subsys); +int configfs_register_group (struct config_group *parent_group, +struct config_group *group); +void configfs_unregister_group (struct config_group *group); +/* These functions can sleep and can alloc with GFP_KERNEL */ /* WARNING: These cannot be called underneath configfs callbacks!! */ int configfs_depend_item (struct configfs_subsystem *subsys,struct config_item *target);
Signature · 1 line
1.9.1
Re: [PATCH v8 1/5] configfs: Allow dynamic group creation
Quoted 8 lines · Daniel Baluta
We don't want to hardcode default groups at subsystem creation time. We export:
*configfs_register_group
*configfs_unregister_group
to allow drivers to programatically create/destroy groups later, after module init time.This is needed for IIO configfs support.
This looks like a good start, and maybe we should merge it as is given that merge window is about to end. But I have two requests, one trivial and one not so:
a) please provide kerneldoc comments for the new functions
b) just pass the name and item type and dynamically allocate the actua group. With that we can avoid a lot of boilerplate code and could also replace the horrible static sized defaults_groups array in current users with your new function.
Re: [PATCH v8 1/5] configfs: Allow dynamic group creation
Quoted 14 lines · Christoph Hellwig
Quoted 8 lines · Daniel Baluta
We don't want to hardcode default groups at subsystem creation time. We export:
*configfs_register_group
*configfs_unregister_group
to allow drivers to programatically create/destroy groups later, after module init time.This is needed for IIO configfs support.
This looks like a good start, and maybe we should merge it as is given that merge window is about to end. But I have two requests, one trivial and one not so:
Quoted 5 lines
a) please provide kerneldoc comments for the new functions
b) just pass the name and item type and dynamically allocate the actua group. With that we can avoid a lot of boilerplate code and could also replace the horrible static sizeddefaults_groupsarray in current users with your new function.
Will try to see how quick I can do this. Eventually we can introduce the new function + use it in IIO and fix current users later.
Thanks Christoph!
Daniel.
PATCH v8 2/5 iio: core: Introduce IIO configfs support
In reply to Daniel BalutaThis creates an IIO configfs subystem named "iio", with a default "triggers" group. Next patches will add trigger types support, allowing new triggers creation using configfs.
--- drivers/iio/Kconfig | 8 +++++ drivers/iio/Makefile | 1 + drivers/iio/industrialio-configfs.c | 68 +++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 drivers/iio/industrialio-configfs.c
drivers/iio/Kconfig +8 -0
@@ -22,6 +22,14 @@ if IIO_BUFFER source "drivers/iio/buffer/Kconfig" endif # IIO_BUFFER +config IIO_CONFIGFS + bool "Enable IIO configuration via configfs" + select CONFIGFS_FS + help + This allows configuring various IIO bits through configfs + (e.g. software triggers). For more info see + Documentation/iio/iio_configfs.txt. + config IIO_TRIGGER bool "Enable triggered sampling support" help
drivers/iio/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_IIO) += industrialio.o industrialio-y := industrialio-core.o industrialio-event.o inkern.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o +industrialio-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o obj-$(CONFIG_IIO_TRIGGERED_EVENT) += industrialio-triggered-event.o
drivers/iio/industrialio-configfs.c new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.9.1
kbuild test robot
build botRe: [PATCH v8 2/5] iio: core: Introduce IIO configfs support
reproduce:
Hi Daniel,
[auto build test ERROR on next-20151020 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Daniel-Baluta/configfs-Allow-dynamic-group-creation/20151020-185453 config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
drivers/iio/industrialio-configfs.o: In function `iio_configfs_exit':
>> industrialio-configfs.c:(.exit.text+0x0): multiple definition of `cleanup_module' drivers/iio/industrialio-core.o:industrialio-core.c:(.exit.text+0x0): first defined here drivers/iio/industrialio-configfs.o: In function `iio_configfs_init': >> industrialio-configfs.c:(.init.text+0x0): multiple definition of `init_module'
drivers/iio/industrialio-core.o:industrialio-core.c:(.init.text+0x0): first defined here
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v8 3/5 iio: core: Introduce IIO software triggers
In reply to Daniel BalutaA software trigger associates an IIO device trigger with a software interrupt source (e.g: timer, sysfs). This patch adds the generic infrastructure for handling software triggers.
Software interrupts sources are kept in a iio_trigger_types_list and registered separately when the associated kernel module is loaded.
Software triggers can be created directly from drivers or from user space via configfs interface.
--- drivers/iio/Kconfig | 7 ++ drivers/iio/Makefile | 1 + drivers/iio/industrialio-configfs.c | 37 ++++++++- drivers/iio/industrialio-sw-trigger.c | 137 ++++++++++++++++++++++++++++++++++ include/linux/iio/sw_trigger.h | 120 +++++++++++++++++++++++++++++ 5 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 drivers/iio/industrialio-sw-trigger.c create mode 100644 include/linux/iio/sw_trigger.h
drivers/iio/Kconfig +7 -0
@@ -46,6 +46,13 @@ config IIO_CONSUMERS_PER_TRIGGER This value controls the maximum number of consumers that a given trigger may handle. Default is 2. +config IIO_SW_TRIGGER + bool "Enable software triggers support" + help + Provides IIO core support for software triggers. A software + trigger can be created via configfs or directly by a driver + using the API provided. + config IIO_TRIGGERED_EVENT tristate select IIO_TRIGGER
drivers/iio/Makefile +1 -0
@@ -7,6 +7,7 @@ industrialio-y := industrialio-core.o industrialio-event.o inkern.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o industrialio-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o +industrialio-$(CONFIG_IIO_SW_TRIGGER) += industrialio-sw-trigger.o obj-$(CONFIG_IIO_TRIGGERED_EVENT) += industrialio-triggered-event.o
drivers/iio/industrialio-configfs.c +36 -1
@@ -15,8 +15,43 @@#include <linux/slab.h> #include <linux/iio/iio.h> +#include <linux/iio/sw_trigger.h> -static struct config_item_type iio_triggers_group_type = { +static struct config_group *trigger_make_group (struct config_group *group, +const char *name) +{ +struct iio_sw_trigger *t; + + t =iio_sw_trigger_create (group->cg_item.ci_name, name); +if (IS_ERR (t)) +return ERR_CAST (t); + +config_item_set_name (&t->group.cg_item,"%s" , name); + +return &t->group; +} + +static void trigger_drop_group (struct config_group *group, +struct config_item *item) +{ +struct iio_sw_trigger *t =to_iio_sw_trigger (item); + +iio_sw_trigger_destroy (t); +config_item_put (item); +} + +static struct configfs_group_operations trigger_ops = { + .make_group = &trigger_make_group, + .drop_item = &trigger_drop_group, +}; + +struct config_item_type iio_trigger_type_group_type = { + .ct_group_ops = &trigger_ops, + .ct_owner =THIS_MODULE , +}; +EXPORT_SYMBOL (iio_trigger_type_group_type); + +struct config_item_type iio_triggers_group_type = { .ct_owner =THIS_MODULE , };
drivers/iio/industrialio-sw-trigger.c new file +137 -0
137 lines not on this page · raw message
include/linux/iio/sw_trigger.h new file +120 -0
120 lines not on this page · raw message
Signature · 1 line
1.9.1
kbuild test robot
build bot[RFC PATCH] iio: core: iio_triggers_group_type can be static
Signed-off-by: Fengguang Wu <[email protected]>
--- industrialio-configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-configfs.c +1 -1
@@ -51,7 +51,7 @@ struct config_item_type iio_trigger_type_group_type = { };EXPORT_SYMBOL (iio_trigger_type_group_type); -struct config_item_type iio_triggers_group_type = { +static struct config_item_type iio_triggers_group_type = { .ct_owner =THIS_MODULE , };
kbuild test robot
build botRe: [PATCH v8 3/5] iio: core: Introduce IIO software triggers
In reply to Daniel Balutaurl: https://github.com/0day-ci/linux/commits/Daniel-Baluta/configfs-Allow-dynamic-group-creation/20151020-185453 reproduce:
Hi Daniel,
[auto build test WARNING on next-20151020 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Daniel-Baluta/configfs-Allow-dynamic-group-creation/20151020-185453
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
>> drivers/iio/industrialio-configfs.c:54:25: sparse: symbol 'iio_triggers_group_type' was not declared. Should it be static?
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v8 4/5 iio: trigger: Introduce IIO hrtimer based trigger
In reply to Daniel BalutaThis patch registers a new IIO software trigger interrupt source based on high resolution timers.
Notice that if configfs is enabled we create sampling_frequency attribute allowing users to change hrtimer period (1/sampling_frequency).
The IIO hrtimer trigger has a long history, this patch is based on an older version from Marten and Lars-Peter.
--- drivers/iio/trigger/Kconfig | 10 ++ drivers/iio/trigger/Makefile | 2 + drivers/iio/trigger/iio-trig-hrtimer.c | 193 +++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 drivers/iio/trigger/iio-trig-hrtimer.c
drivers/iio/trigger/Kconfig +10 -0
@@ -5,6 +5,16 @@ menu "Triggers - standalone" +config IIO_HRTIMER_TRIGGER + tristate "High resolution timer trigger" + select IIO_SW_TRIGGER + help + Provides a frequency based IIO trigger using high resolution + timers as interrupt source. + + To compile this driver as a module, choose M here: the + module will be called iio-trig-hrtimer. + config IIO_INTERRUPT_TRIGGER tristate "Generic interrupt trigger" help
drivers/iio/trigger/Makefile +2 -0
@@ -3,5 +3,7 @@ # # When adding new entries keep the list in alphabetical order + +obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o
drivers/iio/trigger/iio-trig-hrtimer.c new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 5/5 iio: Documentation: Add IIO configfs documentation
In reply to Daniel Baluta--- Documentation/ABI/testing/configfs-iio | 21 ++++++++ Documentation/iio/iio_configfs.txt | 93 ++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 Documentation/ABI/testing/configfs-iio create mode 100644 Documentation/iio/iio_configfs.txt
Documentation/ABI/testing/configfs-iio new file +21 -0
@@ -0,0 +1,21 @@ +What: /config/iio +Date: October 2015 +KernelVersion: 4.4 +Contact: [email protected] +Description: + This represents Industrial IO configuration entry point + directory. It contains sub-groups corresponding to IIO + objects. + +What: /config/iio/triggers +Date: October 2015 +KernelVersion: 4.4 +Description: + Industrial IO software triggers directory. + +What: /config/iio/triggers/hrtimers +Date: October 2015 +KernelVersion: 4.4 +Description: + High resolution timers directory. Creating a directory here + will result in creating a hrtimer trigger in the IIO subsystem.
Documentation/iio/iio_configfs.txt new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v8 5/5] iio: Documentation: Add IIO configfs documentation
Quoted 60 lines · Daniel Baluta
Signed-off-by Daniel Baluta <[email protected]>--- Documentation/ABI/testing/configfs-iio | 21 ++++++++ Documentation/iio/iio_configfs.txt | 93 ++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 Documentation/ABI/testing/configfs-iio create mode 100644 Documentation/iio/iio_configfs.txtDocumentation/ABI/testing/configfs-iio new file +21
-0@@ -0,0 +1,21 @@ +What: /config/iio +Date: October 2015 +KernelVersion: 4.4 +Contact: [email protected] +Description: + This represents Industrial IO configuration entry point + directory. It contains sub-groups corresponding to IIO + objects. + +What: /config/iio/triggers +Date: October 2015 +KernelVersion: 4.4 +Description: + Industrial IO software triggers directory. + +What: /config/iio/triggers/hrtimers +Date: October 2015 +KernelVersion: 4.4 +Description: + High resolution timers directory. Creating a directory here + will result in creating a hrtimer trigger in the IIO subsystem.Documentation/iio/iio_configfs.txt new file +19
-0@@ -0,0 +1,93 @@ +Industrial IIO configfs support + +1. Overview + +Configfs is a filesystem-based manager of kernel objects. IIO uses some +objects that could be easily configured using configfs (e.g.: devices, +triggers). + +See Documentation/filesystems/configfs/configfs.txt for more information +about how configfs works. + +2. Usage + +In order to use configfs support in IIO we need to select it at compile +time via CONFIG_IIO_CONFIGFS config option. + +Then, mount the configfs filesystem (usually under /config directory): + +$ mkdir /config
Documentation/iio/iio_configfs.txt line 29
Quoted 10 lines
Documentation/iio/iio_configfs.txt new file +10
-0+$ mount -t configfs none /config + +At this point, all default IIO groups will be created and can be accessed +under /config/iio. Next chapters will describe available IIO configuration +objects. + +3. Software triggers + +One of the IIO default configfs groups is the "triggers" group. It is +automagically accessible when the configfs is mounted and can be found
automagically is probably automatically?
Quoted 65 lines
Documentation/iio/iio_configfs.txt new file +64
-1+under /config/iio/triggers. + +IIO software triggers implementation offers support for creating multiple +trigger types. A new trigger type is usually implemented as a separate +kernel module following the interface in include/linux/iio/sw_trigger.h: + +/* + * drivers/iio/trigger/iio-trig-sample.c + * sample kernel module implementing a new trigger type + */ +#include <linux/iio/sw_trigger.h> + + +static struct iio_sw_trigger *iio_trig_sample_probe(const char *name) +{ + /* + * This allocates and registers an IIO trigger plus other + * trigger type specific initialization. + */ +} + +static int iio_trig_hrtimer_remove(struct iio_sw_trigger *swt) +{ + /* + * This undoes the actions in iio_trig_sample_probe + */ +} + +static const struct iio_sw_trigger_ops iio_trig_sample_ops = { + .probe = iio_trig_sample_probe, + .remove = iio_trig_sample_remove, +}; + +static struct iio_sw_trigger_type iio_trig_sample = { + .name = "trig-sample", + .owner = THIS_MODULE, + .ops = &iio_trig_sample_ops, +}; + +module_iio_sw_trigger_driver(iio_trig_sample); + +Each trigger type has its own directory under /config/iio/triggers. Loading +iio-trig-sample module will create 'trig-sample' trigger type directory +/config/iio/triggers/trig-sample. + +We support the following interrupt sources (trigger types): + * hrtimer, uses high resolution timers as interrupt source + +3.1 Hrtimer triggers creation and destruction + +Loading iio-trig-hrtimer module will register hrtimer trigger types allowing +users to create hrtimer triggers under /config/iio/triggers/hrtimer. + +e.g: + +$ mkdir /config/triggers/hrtimer/instance1 +$ rmdir /config/triggers/hrtimer/instance1 + +Each trigger can have one or more attributes specific to the trigger type. + +3.2 "hrtimer" trigger types attributes + +"hrtimer" trigger type doesn't have any configurable attribute from /config dir. +It does introduce the sampling_frequency attribute to trigger directory. --
Re: [PATCH v8 5/5] iio: Documentation: Add IIO configfs documentation
Quoted 64 lines · Crt Mori
Quoted 63 lines · Daniel Baluta
Signed-off-by Daniel Baluta <[email protected]>--- Documentation/ABI/testing/configfs-iio | 21 ++++++++ Documentation/iio/iio_configfs.txt | 93 ++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 Documentation/ABI/testing/configfs-iio create mode 100644 Documentation/iio/iio_configfs.txtDocumentation/ABI/testing/configfs-iio new file +21
-0@@ -0,0 +1,21 @@ +What: /config/iio +Date: October 2015 +KernelVersion: 4.4 +Contact: [email protected] +Description: + This represents Industrial IO configuration entry point + directory. It contains sub-groups corresponding to IIO + objects. + +What: /config/iio/triggers +Date: October 2015 +KernelVersion: 4.4 +Description: + Industrial IO software triggers directory. + +What: /config/iio/triggers/hrtimers +Date: October 2015 +KernelVersion: 4.4 +Description: + High resolution timers directory. Creating a directory here + will result in creating a hrtimer trigger in the IIO subsystem.Documentation/iio/iio_configfs.txt new file +22
-0@@ -0,0 +1,93 @@ +Industrial IIO configfs support + +1. Overview + +Configfs is a filesystem-based manager of kernel objects. IIO uses some +objects that could be easily configured using configfs (e.g.: devices, +triggers). + +See Documentation/filesystems/configfs/configfs.txt for more information +about how configfs works. + +2. Usage + +In order to use configfs support in IIO we need to select it at compile +time via CONFIG_IIO_CONFIGFS config option. + +Then, mount the configfs filesystem (usually under /config directory): + +$ mkdir /config +$ mount -t configfs none /config + +At this point, all default IIO groups will be created and can be accessed
Quoted 8 lines
Documentation/iio/iio_configfs.txt line 29
Quoted 7 lines
Documentation/iio/iio_configfs.txt new file +7
-0+under /config/iio. Next chapters will describe available IIO configuration +objects. + +3. Software triggers + +One of the IIO default configfs groups is the "triggers" group. It is +automagically accessible when the configfs is mounted and can be foundautomagically is probably automatically?
Automagically is more fun :).
http://www.urbandictionary.com/define.php?term=automagically
Quoted 69 lines
Quoted 55 lines
Documentation/iio/iio_configfs.txt new file +55
-0+under /config/iio/triggers. + +IIO software triggers implementation offers support for creating multiple +trigger types. A new trigger type is usually implemented as a separate +kernel module following the interface in include/linux/iio/sw_trigger.h: + +/* + * drivers/iio/trigger/iio-trig-sample.c + * sample kernel module implementing a new trigger type + */ +#include <linux/iio/sw_trigger.h> + + +static struct iio_sw_trigger *iio_trig_sample_probe(const char *name) +{ + /* + * This allocates and registers an IIO trigger plus other + * trigger type specific initialization. + */ +} + +static int iio_trig_hrtimer_remove(struct iio_sw_trigger *swt) +{ + /* + * This undoes the actions in iio_trig_sample_probe + */ +} + +static const struct iio_sw_trigger_ops iio_trig_sample_ops = { + .probe = iio_trig_sample_probe, + .remove = iio_trig_sample_remove, +}; + +static struct iio_sw_trigger_type iio_trig_sample = { + .name = "trig-sample", + .owner = THIS_MODULE, + .ops = &iio_trig_sample_ops, +}; + +module_iio_sw_trigger_driver(iio_trig_sample); + +Each trigger type has its own directory under /config/iio/triggers. Loading +iio-trig-sample module will create 'trig-sample' trigger type directory +/config/iio/triggers/trig-sample. + +We support the following interrupt sources (trigger types): + * hrtimer, uses high resolution timers as interrupt source + +3.1 Hrtimer triggers creation and destruction + +Loading iio-trig-hrtimer module will register hrtimer trigger types allowing +users to create hrtimer triggers under /config/iio/triggers/hrtimer. + +e.g: +Documentation/iio/iio_configfs.txt
Quoted 10 lines
Documentation/iio/iio_configfs.txt new file +9
-1+$ mkdir /config/triggers/hrtimer/instance1 +$ rmdir /config/triggers/hrtimer/instance1 + +Each trigger can have one or more attributes specific to the trigger type. + +3.2 "hrtimer" trigger types attributes + +"hrtimer" trigger type doesn't have any configurable attribute from /config dir. +It does introduce the sampling_frequency attribute to trigger directory. ----
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html