Add a section for alert support, explaining how user can use iio events attributes to enable alert and set thresholds, but also what kind of events will be generated. Signed-off-by: Julien Stephan <jstephan@xxxxxxxxxxxx> --- Documentation/iio/ad7380.rst | 56 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/Documentation/iio/ad7380.rst b/Documentation/iio/ad7380.rst index c46127700e14ca9ec3cac0bd5776b6702f2659e2..7cca4a9ad42ae8b3fda2e063ffd864ffa9dac2f1 100644 --- a/Documentation/iio/ad7380.rst +++ b/Documentation/iio/ad7380.rst @@ -92,6 +92,61 @@ must restart iiod using the following command: root:~# systemctl restart iiod +Alert +----- + +When configured in 1 SDO line mode (see `SPI wiring modes`_), the SDOB or the +SDOD line (respectively for the 2 or 4 channels variants) can act as an alert +pin. + +At the end of a conversion the low-active alert pin gets asserted if the +conversion result exceeds the alert high limit or falls below the alert low +limit. It is cleared, on a falling edge of CS. The alert pin is common to all +channels. + +User can enable alert using the regular iio events attribute: + +.. code-block:: bash + + events/thresh_either_en + +The high and low thresholds are common to all channels and can also be set using +regular iio events attributes: + +.. code-block:: bash + + events/in_thresh_falling_value + events/in_thresh_rising_value + +User space IIO events +~~~~~~~~~~~~~~~~~~~~~ + +If the ``interrupts`` property is set in the device tree, IIO events will be +generated for alerts. A register identifies the faulty channel, and direction, +but during buffered reads, registers are inaccessible, making it impossible to +know the exact channel triggering the alert. A generic event is sent for each +channel, resulting in 2 or 4 events per alert, depending on the number of +channels: + +.. code-block:: bash + + Event: time: 1733501917162945723, type: voltage, channel: 0-1, evtype: thresh, direction: either + Event: time: 1733501917162945723, type: voltage, channel: 2-3, evtype: thresh, direction: either + + +Alert Reset timeout (buffered read only) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In buffered reads, if input stays out of thresholds limit, an interrupt will be +generated for each sample read, because the alert pin is cleared when CS get +active (i.e when starting a new conversion). As a result, excessive event +generation can occur. User can set a reset timeout in milliseconds, during +which interrupt will be disabled: + +.. code-block:: bash + + events/thresh_either_reset_timeout + Channel selection and sequencer (single-end chips only) ------------------------------------------------------- @@ -144,7 +199,6 @@ Unimplemented features - Rolling average oversampling - Power down mode - CRC indication -- Alert Device buffers -- 2.47.1