103 lines · plain
1===============================2Industrial IIO configfs support3===============================4 51. Overview6===========7 8Configfs is a filesystem-based manager of kernel objects. IIO uses some9objects that could be easily configured using configfs (e.g.: devices,10triggers).11 12See Documentation/filesystems/configfs.rst for more information13about how configfs works.14 152. Usage16========17 18In order to use configfs support in IIO we need to select it at compile19time via CONFIG_IIO_CONFIGFS config option.20 21Then, mount the configfs filesystem (usually under /config directory)::22 23 $ mkdir /config24 $ mount -t configfs none /config25 26At this point, all default IIO groups will be created and can be accessed27under /config/iio. Next chapters will describe available IIO configuration28objects.29 303. Software triggers31====================32 33One of the IIO default configfs groups is the "triggers" group. It is34automagically accessible when the configfs is mounted and can be found35under /config/iio/triggers.36 37IIO software triggers implementation offers support for creating multiple38trigger types. A new trigger type is usually implemented as a separate39kernel module following the interface in include/linux/iio/sw_trigger.h::40 41 /*42 * drivers/iio/trigger/iio-trig-sample.c43 * sample kernel module implementing a new trigger type44 */45 #include <linux/iio/sw_trigger.h>46 47 48 static struct iio_sw_trigger *iio_trig_sample_probe(const char *name)49 {50 /*51 * This allocates and registers an IIO trigger plus other52 * trigger type specific initialization.53 */54 }55 56 static int iio_trig_sample_remove(struct iio_sw_trigger *swt)57 {58 /*59 * This undoes the actions in iio_trig_sample_probe60 */61 }62 63 static const struct iio_sw_trigger_ops iio_trig_sample_ops = {64 .probe = iio_trig_sample_probe,65 .remove = iio_trig_sample_remove,66 };67 68 static struct iio_sw_trigger_type iio_trig_sample = {69 .name = "trig-sample",70 .owner = THIS_MODULE,71 .ops = &iio_trig_sample_ops,72 };73 74 module_iio_sw_trigger_driver(iio_trig_sample);75 76Each trigger type has its own directory under /config/iio/triggers. Loading77iio-trig-sample module will create 'trig-sample' trigger type directory78/config/iio/triggers/trig-sample.79 80We support the following interrupt sources (trigger types):81 82 * hrtimer, uses high resolution timers as interrupt source83 843.1 Hrtimer triggers creation and destruction85---------------------------------------------86 87Loading iio-trig-hrtimer module will register hrtimer trigger types allowing88users to create hrtimer triggers under /config/iio/triggers/hrtimer.89 90e.g::91 92 $ mkdir /config/iio/triggers/hrtimer/instance193 $ rmdir /config/iio/triggers/hrtimer/instance194 95Each trigger can have one or more attributes specific to the trigger type.96 973.2 "hrtimer" trigger types attributes98--------------------------------------99 100"hrtimer" trigger type doesn't have any configurable attribute from /config dir.101It does introduce the sampling_frequency attribute to trigger directory.102That attribute sets the polling frequency in Hz, with mHz precision.103