diff mbox series

[v2,2/2] docs: iio: ad7380: add SPI offload support

Message ID 20250304-wip-bl-spi-offload-ad7380-v2-2-0fef61f2650a@baylibre.com (mailing list archive)
State Changes Requested
Headers show
Series iio: ad7380: add SPI offload support | expand

Commit Message

Angelo Dureghello March 4, 2025, 9:37 a.m. UTC
Document SPI offload support for the ad7380 driver.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
---
 Documentation/iio/ad7380.rst | 54 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 11 deletions(-)

Comments

David Lechner March 4, 2025, 2:45 p.m. UTC | #1
On Tue, Mar 4, 2025 at 10:39 AM Angelo Dureghello
<adureghello@baylibre.com> wrote:
>
> Document SPI offload support for the ad7380 driver.
>
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> ---
>  Documentation/iio/ad7380.rst | 54 +++++++++++++++++++++++++++++++++++---------
>  1 file changed, 43 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/iio/ad7380.rst b/Documentation/iio/ad7380.rst
> index cff688bcc2d9601a9faf42d5e9c217486639ca66..e593ab6037b0da4cebfad148313f21cca7f00fd4 100644
> --- a/Documentation/iio/ad7380.rst
> +++ b/Documentation/iio/ad7380.rst
> @@ -142,21 +142,21 @@ Example for AD7386/7/8 (2 channels parts):
>  .. code-block::
>
>            IIO   | AD7386/7/8
> -                |         +----------------------------
> -                |         |     _____        ______
> -                |         |    |     |      |      |
> +                |         +----------------------------
> +                |         |     _____        ______
> +                |         |    |     |      |      |
>         voltage0 | AinA0 --|--->|     |      |      |
> -                |         |    | mux |----->| ADCA |---
> +                |         |    | mux |----->| ADCA |---
>         voltage2 | AinA1 --|--->|     |      |      |
> -                |         |    |_____|      |_____ |
> -                |         |     _____        ______
> -                |         |    |     |      |      |
> +                |         |    |_____|      |_____ |
> +                |         |     _____        ______
> +                |         |    |     |      |      |
>         voltage1 | AinB0 --|--->|     |      |      |
> -                |         |    | mux |----->| ADCB |---
> +                |         |    | mux |----->| ADCB |---
>         voltage3 | AinB1 --|--->|     |      |      |
> -                |         |    |_____|      |______|
> -                |         |
> -                |         +----------------------------
> +                |         |    |_____|      |______|
> +                |         |
> +                |         +----------------------------
>

It looks like this is just cleaning up whitespace, so should be in a
separate patch.

>
>  When enabling sequencer mode, the effective sampling rate is divided by two.
> @@ -169,6 +169,38 @@ gain is selectable from device tree using the ``adi,gain-milli`` property.
>  Refer to the typical connection diagrams section of the datasheet for pin
>  wiring.
>
> +
> +SPI offload support
> +-------------------
> +
> +To be able to achieve the maximum sample rate, the driver can be used with the
> +`AXI SPI Engine`_ to provide SPI offload support.
> +
> +.. _AXI SPI Engine: http://analogdevicesinc.github.io/hdl/projects/ad738x_fmc/index.html
> +
> +When SPI offload is being used, some attributes will be different.
> +
> +* ``in_voltage-voltage_sampling_frequency`` attribute is added for setting the
> +  sample rate.
> +* ``in_voltage-voltage_sampling_frequency_available`` attribute is added for
> +  querying the max sample rate.
> +* ``timestamp`` channel is removed.
> +* Buffer data format may be different compared to when offload is not used,
> +  e.g. the ``buffer0/in_voltage0-voltage1_type`` and the
> +  ``buffer0/in_voltage2-voltage3_type`` attributes.
> +
> +.. seealso:: `SPI offload support`_

This is referring to the same section, so doesn't make sense here.

> +
> +Effective sample rate for buffered reads
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Using SPI offload, the PWM generator drives the starting of the conversion by
> +executing the pre-recorded SPI transfer at each PWM cycle, asserting CS and
> +reading the previous available sample values for all channels.
> +Default sample rate is set to a quite low frequency, to allow oversampling x32,
> +user is then reponsible to adjust ``in_voltage-voltage_sampling_frequency`` for

s/reponsible/responsible/

> +the specific case.

Another important thing to mention here is that for single-ended chips
where we have 2 banks of simultaneous inputs, if at least one channel
from each bank is enabled in a buffered read, the effective sample
rate will be 1/2 of what ``in_voltage-voltage_sampling_frequency``
says because a separate conversion needs to be done for each bank.

> +
>  Unimplemented features
>  ----------------------
>
>
> --
> 2.48.1
>
diff mbox series

Patch

diff --git a/Documentation/iio/ad7380.rst b/Documentation/iio/ad7380.rst
index cff688bcc2d9601a9faf42d5e9c217486639ca66..e593ab6037b0da4cebfad148313f21cca7f00fd4 100644
--- a/Documentation/iio/ad7380.rst
+++ b/Documentation/iio/ad7380.rst
@@ -142,21 +142,21 @@  Example for AD7386/7/8 (2 channels parts):
 .. code-block::
 
 	   IIO   | AD7386/7/8
-	         |         +----------------------------
-	         |         |     _____        ______
-	         |         |    |     |      |      |
+		 |         +----------------------------
+		 |         |     _____        ______
+		 |         |    |     |      |      |
 	voltage0 | AinA0 --|--->|     |      |      |
-	         |         |    | mux |----->| ADCA |---
+		 |         |    | mux |----->| ADCA |---
 	voltage2 | AinA1 --|--->|     |      |      |
-	         |         |    |_____|      |_____ |
-	         |         |     _____        ______
-	         |         |    |     |      |      |
+		 |         |    |_____|      |_____ |
+		 |         |     _____        ______
+		 |         |    |     |      |      |
 	voltage1 | AinB0 --|--->|     |      |      |
-	         |         |    | mux |----->| ADCB |---
+		 |         |    | mux |----->| ADCB |---
 	voltage3 | AinB1 --|--->|     |      |      |
-	         |         |    |_____|      |______|
-	         |         |
-	         |         +----------------------------
+		 |         |    |_____|      |______|
+		 |         |
+		 |         +----------------------------
 
 
 When enabling sequencer mode, the effective sampling rate is divided by two.
@@ -169,6 +169,38 @@  gain is selectable from device tree using the ``adi,gain-milli`` property.
 Refer to the typical connection diagrams section of the datasheet for pin
 wiring.
 
+
+SPI offload support
+-------------------
+
+To be able to achieve the maximum sample rate, the driver can be used with the
+`AXI SPI Engine`_ to provide SPI offload support.
+
+.. _AXI SPI Engine: http://analogdevicesinc.github.io/hdl/projects/ad738x_fmc/index.html
+
+When SPI offload is being used, some attributes will be different.
+
+* ``in_voltage-voltage_sampling_frequency`` attribute is added for setting the
+  sample rate.
+* ``in_voltage-voltage_sampling_frequency_available`` attribute is added for
+  querying the max sample rate.
+* ``timestamp`` channel is removed.
+* Buffer data format may be different compared to when offload is not used,
+  e.g. the ``buffer0/in_voltage0-voltage1_type`` and the
+  ``buffer0/in_voltage2-voltage3_type`` attributes.
+
+.. seealso:: `SPI offload support`_
+
+Effective sample rate for buffered reads
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Using SPI offload, the PWM generator drives the starting of the conversion by
+executing the pre-recorded SPI transfer at each PWM cycle, asserting CS and
+reading the previous available sample values for all channels.
+Default sample rate is set to a quite low frequency, to allow oversampling x32,
+user is then reponsible to adjust ``in_voltage-voltage_sampling_frequency`` for
+the specific case.
+
 Unimplemented features
 ----------------------