1 ======== 2 Triggers 3 ======== 4 5 * struct iio_trigger — industrial I/O trigge 6 * :c:func:`devm_iio_trigger_alloc` — Resourc 7 * :c:func:`devm_iio_trigger_register` — Reso 8 iio_trigger_unregister 9 * :c:func:`iio_trigger_validate_own_device` †10 device belong to the same device 11 12 In many situations it is useful for a driver t 13 on some external event (trigger) as opposed to 14 An IIO trigger can be provided by a device dri 15 based on hardware generated events (e.g. data 16 provided by a separate driver from an independ 17 line connected to some external system, timer 18 a specific file in sysfs). A trigger may initi 19 sensors and also it may be completely unrelate 20 21 IIO trigger sysfs interface 22 =========================== 23 24 There are two locations in sysfs related to tr 25 26 * :file:`/sys/bus/iio/devices/trigger{Y}/*`, t 27 IIO trigger is registered with the IIO core 28 with index Y. 29 Because triggers can be very different depen 30 standard attributes that we can describe her 31 32 * :file:`name`, trigger name that can be lat 33 device. 34 * :file:`sampling_frequency`, some timer bas 35 specify the frequency for trigger calls. 36 37 * :file:`/sys/bus/iio/devices/iio:device{X}/tr 38 created once the device supports a triggered 39 trigger with our device by writing the trigg 40 :file:`current_trigger` file. 41 42 IIO trigger setup 43 ================= 44 45 Let's see a simple example of how to setup a t 46 47 struct iio_trigger_ops trigger_ops = { 48 .set_trigger_state = sample_trigger_ 49 .validate_device = sample_validate_d 50 } 51 52 struct iio_trigger *trig; 53 54 /* first, allocate memory for our trigge 55 trig = iio_trigger_alloc(dev, "trig-%s-% 56 57 /* setup trigger operations field */ 58 trig->ops = &trigger_ops; 59 60 /* now register the trigger with the IIO 61 iio_trigger_register(trig); 62 63 IIO trigger ops 64 =============== 65 66 * struct iio_trigger_ops — operations struct 67 68 Notice that a trigger has a set of operations 69 70 * :file:`set_trigger_state`, switch the trigge 71 * :file:`validate_device`, function to validat 72 trigger gets changed. 73 74 More details 75 ============ 76 .. kernel-doc:: include/linux/iio/trigger.h 77 .. kernel-doc:: drivers/iio/industrialio-trigg 78 :export:
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.