xref: /linux/Documentation/iio/ad7380.rst (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1.. SPDX-License-Identifier: GPL-2.0-only
2
3=============
4AD7380 driver
5=============
6
7ADC driver for Analog Devices Inc. AD7380 and similar devices. The module name
8is ``ad7380``.
9
10
11Supported devices
12=================
13
14The following chips are supported by this driver:
15
16* `AD7380 <https://www.analog.com/en/products/ad7380.html>`_
17* `AD7381 <https://www.analog.com/en/products/ad7381.html>`_
18* `AD7383 <https://www.analog.com/en/products/ad7383.html>`_
19* `AD7384 <https://www.analog.com/en/products/ad7384.html>`_
20* `AD7386 <https://www.analog.com/en/products/ad7386.html>`_
21* `AD7387 <https://www.analog.com/en/products/ad7387.html>`_
22* `AD7388 <https://www.analog.com/en/products/ad7388.html>`_
23* `AD7380-4 <https://www.analog.com/en/products/ad7380-4.html>`_
24* `AD7381-4 <https://www.analog.com/en/products/ad7381-4.html>`_
25* `AD7383-4 <https://www.analog.com/en/products/ad7383-4.html>`_
26* `AD7384-4 <https://www.analog.com/en/products/ad7384-4.html>`_
27* `AD7386-4 <https://www.analog.com/en/products/ad7386-4.html>`_
28* `AD7387-4 <https://www.analog.com/en/products/ad7387-4.html>`_
29* `AD7388-4 <https://www.analog.com/en/products/ad7388-4.html>`_
30* `ADAQ4370-4 <https://www.analog.com/en/products/adaq4370-4.html>`_
31* `ADAQ4380-4 <https://www.analog.com/en/products/adaq4380-4.html>`_
32
33
34Supported features
35==================
36
37SPI wiring modes
38----------------
39
40ad738x ADCs can output data on several SDO lines (1/2/4). The driver currently
41supports only 1 SDO line.
42
43Reference voltage
44-----------------
45
46ad7380-4
47~~~~~~~~
48
49ad7380-4 supports only an external reference voltage (2.5V to 3.3V). It must be
50declared in the device tree as ``refin-supply``.
51
52ADAQ devices
53~~~~~~~~~~~~
54
55adaq4370-4 and adaq4380-4 don't have an external reference, but use a 3.3V
56internal reference derived from one of its supplies (``refin-supply``)
57
58All other devices from ad738x family
59~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60
61All other devices from ad738x support 2 possible reference voltage sources:
62
63- Internal reference (2.5V)
64- External reference (2.5V to 3.3V)
65
66The source is determined by the device tree. If ``refio-supply`` is present,
67then it is used as external reference, else the internal reference is used.
68
69Oversampling and resolution boost
70---------------------------------
71
72This family supports 2 types of oversampling: normal average and rolling
73average. Only normal average is supported by the driver, as rolling average can
74be achieved by processing a captured data buffer. The following ratios are
75available: 1 (oversampling disabled)/2/4/8/16/32.
76
77When the on-chip oversampling function is enabled the performance of the ADC can
78exceed the default resolution. To accommodate the performance boost achievable,
79it is possible to enable an additional two bits of resolution. Because the
80resolution boost feature can only be enabled when oversampling is enabled and
81oversampling is not as useful without the resolution boost, the driver
82automatically enables the resolution boost if and only if oversampling is
83enabled.
84
85Since the resolution boost feature causes 16-bit chips to now have 18-bit data
86which means the storagebits has to change from 16 to 32 bits, we use the new
87ext_scan_type feature to allow changing the scan_type at runtime. Unfortunately
88libiio does not support it. So when enabling or disabling oversampling, user
89must restart iiod using the following command:
90
91.. code-block:: bash
92
93	root:~# systemctl restart iiod
94
95Channel selection and sequencer (single-end chips only)
96-------------------------------------------------------
97
98Single-ended chips of this family (ad7386/7/8(-4)) have a 2:1 multiplexer in
99front of each ADC. They also include additional configuration registers that
100allow for either manual selection or automatic switching (sequencer mode), of
101the multiplexer inputs.
102
103From an IIO point of view, all inputs are exported, i.e ad7386/7/8
104export 4 channels and ad7386-4/7-4/8-4 export 8 channels.
105
106Inputs ``AinX0`` of multiplexers correspond to the first half of IIO channels (i.e
1070-1 or 0-3) and inputs ``AinX1`` correspond to second half (i.e 2-3 or 4-7).
108Example for AD7386/7/8 (2 channels parts):
109
110.. code-block::
111
112	   IIO   | AD7386/7/8
113	         |         +----------------------------
114	         |         |     _____        ______
115	         |         |    |     |      |      |
116	voltage0 | AinA0 --|--->|     |      |      |
117	         |         |    | mux |----->| ADCA |---
118	voltage2 | AinA1 --|--->|     |      |      |
119	         |         |    |_____|      |_____ |
120	         |         |     _____        ______
121	         |         |    |     |      |      |
122	voltage1 | AinB0 --|--->|     |      |      |
123	         |         |    | mux |----->| ADCB |---
124	voltage3 | AinB1 --|--->|     |      |      |
125	         |         |    |_____|      |______|
126	         |         |
127	         |         +----------------------------
128
129
130When enabling sequencer mode, the effective sampling rate is divided by two.
131
132Gain (ADAQ devices only)
133~~~~~~~~~~~~~~~~~~~~~~~~
134
135ADAQ devices have a pin selectable gain in front of each ADC. The appropriate
136gain is selectable from device tree using the ``adi,gain-milli`` property.
137Refer to the typical connection diagrams section of the datasheet for pin
138wiring.
139
140Unimplemented features
141----------------------
142
143- 2/4 SDO lines
144- Rolling average oversampling
145- Power down mode
146- CRC indication
147- Alert
148
149
150Device buffers
151==============
152
153This driver supports IIO triggered buffers.
154
155See :doc:`iio_devbuf` for more information.
156