~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/driver-api/iio/triggers.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/driver-api/iio/triggers.rst (Version linux-6.12-rc7) and /Documentation/driver-api/iio/triggers.rst (Version linux-5.2.21)


  1 ========                                            1 ========
  2 Triggers                                            2 Triggers
  3 ========                                            3 ========
  4                                                     4 
  5 * struct iio_trigger — industrial I/O trigge !!   5 * struct :c:type:`iio_trigger` — industrial I/O trigger device
  6 * :c:func:`devm_iio_trigger_alloc` — Resourc      6 * :c:func:`devm_iio_trigger_alloc` — Resource-managed iio_trigger_alloc
                                                   >>   7 * :c:func:`devm_iio_trigger_free` — Resource-managed iio_trigger_free
  7 * :c:func:`devm_iio_trigger_register` — Reso      8 * :c:func:`devm_iio_trigger_register` — Resource-managed iio_trigger_register
                                                   >>   9 * :c:func:`devm_iio_trigger_unregister` — Resource-managed
  8   iio_trigger_unregister                           10   iio_trigger_unregister
  9 * :c:func:`iio_trigger_validate_own_device` †    11 * :c:func:`iio_trigger_validate_own_device` — Check if a trigger and IIO
 10   device belong to the same device                 12   device belong to the same device
 11                                                    13 
 12 In many situations it is useful for a driver t     14 In many situations it is useful for a driver to be able to capture data based
 13 on some external event (trigger) as opposed to     15 on some external event (trigger) as opposed to periodically polling for data.
 14 An IIO trigger can be provided by a device dri     16 An IIO trigger can be provided by a device driver that also has an IIO device
 15 based on hardware generated events (e.g. data      17 based on hardware generated events (e.g. data ready or threshold exceeded) or
 16 provided by a separate driver from an independ     18 provided by a separate driver from an independent interrupt source (e.g. GPIO
 17 line connected to some external system, timer      19 line connected to some external system, timer interrupt or user space writing
 18 a specific file in sysfs). A trigger may initi     20 a specific file in sysfs). A trigger may initiate data capture for a number of
 19 sensors and also it may be completely unrelate     21 sensors and also it may be completely unrelated to the sensor itself.
 20                                                    22 
 21 IIO trigger sysfs interface                        23 IIO trigger sysfs interface
 22 ===========================                        24 ===========================
 23                                                    25 
 24 There are two locations in sysfs related to tr     26 There are two locations in sysfs related to triggers:
 25                                                    27 
 26 * :file:`/sys/bus/iio/devices/trigger{Y}/*`, t     28 * :file:`/sys/bus/iio/devices/trigger{Y}/*`, this file is created once an
 27   IIO trigger is registered with the IIO core      29   IIO trigger is registered with the IIO core and corresponds to trigger
 28   with index Y.                                    30   with index Y.
 29   Because triggers can be very different depen     31   Because triggers can be very different depending on type there are few
 30   standard attributes that we can describe her     32   standard attributes that we can describe here:
 31                                                    33 
 32   * :file:`name`, trigger name that can be lat     34   * :file:`name`, trigger name that can be later used for association with a
 33     device.                                        35     device.
 34   * :file:`sampling_frequency`, some timer bas     36   * :file:`sampling_frequency`, some timer based triggers use this attribute to
 35     specify the frequency for trigger calls.       37     specify the frequency for trigger calls.
 36                                                    38 
 37 * :file:`/sys/bus/iio/devices/iio:device{X}/tr     39 * :file:`/sys/bus/iio/devices/iio:device{X}/trigger/*`, this directory is
 38   created once the device supports a triggered     40   created once the device supports a triggered buffer. We can associate a
 39   trigger with our device by writing the trigg     41   trigger with our device by writing the trigger's name in the
 40   :file:`current_trigger` file.                    42   :file:`current_trigger` file.
 41                                                    43 
 42 IIO trigger setup                                  44 IIO trigger setup
 43 =================                                  45 =================
 44                                                    46 
 45 Let's see a simple example of how to setup a t     47 Let's see a simple example of how to setup a trigger to be used by a driver::
 46                                                    48 
 47       struct iio_trigger_ops trigger_ops = {       49       struct iio_trigger_ops trigger_ops = {
 48           .set_trigger_state = sample_trigger_     50           .set_trigger_state = sample_trigger_state,
 49           .validate_device = sample_validate_d     51           .validate_device = sample_validate_device,
 50       }                                            52       }
 51                                                    53 
 52       struct iio_trigger *trig;                    54       struct iio_trigger *trig;
 53                                                    55 
 54       /* first, allocate memory for our trigge     56       /* first, allocate memory for our trigger */
 55       trig = iio_trigger_alloc(dev, "trig-%s-%     57       trig = iio_trigger_alloc(dev, "trig-%s-%d", name, idx);
 56                                                    58 
 57       /* setup trigger operations field */         59       /* setup trigger operations field */
 58       trig->ops = &trigger_ops;                    60       trig->ops = &trigger_ops;
 59                                                    61 
 60       /* now register the trigger with the IIO     62       /* now register the trigger with the IIO core */
 61       iio_trigger_register(trig);                  63       iio_trigger_register(trig);
 62                                                    64 
 63 IIO trigger ops                                    65 IIO trigger ops
 64 ===============                                    66 ===============
 65                                                    67 
 66 * struct iio_trigger_ops — operations struct !!  68 * struct :c:type:`iio_trigger_ops` — operations structure for an iio_trigger.
 67                                                    69 
 68 Notice that a trigger has a set of operations      70 Notice that a trigger has a set of operations attached:
 69                                                    71 
 70 * :file:`set_trigger_state`, switch the trigge     72 * :file:`set_trigger_state`, switch the trigger on/off on demand.
 71 * :file:`validate_device`, function to validat     73 * :file:`validate_device`, function to validate the device when the current
 72   trigger gets changed.                            74   trigger gets changed.
 73                                                    75 
 74 More details                                       76 More details
 75 ============                                       77 ============
 76 .. kernel-doc:: include/linux/iio/trigger.h        78 .. kernel-doc:: include/linux/iio/trigger.h
 77 .. kernel-doc:: drivers/iio/industrialio-trigg     79 .. kernel-doc:: drivers/iio/industrialio-trigger.c
 78    :export:                                        80    :export:
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php