xref: /linux/Documentation/iio/ad4030.rst (revision 4f9786035f9e519db41375818e1d0b5f20da2f10)
1*b29050e8SEsteban Blanc.. SPDX-License-Identifier: GPL-2.0-only
2*b29050e8SEsteban Blanc
3*b29050e8SEsteban Blanc=============
4*b29050e8SEsteban BlancAD4030 driver
5*b29050e8SEsteban Blanc=============
6*b29050e8SEsteban Blanc
7*b29050e8SEsteban BlancADC driver for Analog Devices Inc. AD4030 and similar devices. The module name
8*b29050e8SEsteban Blancis ``ad4030``.
9*b29050e8SEsteban Blanc
10*b29050e8SEsteban Blanc
11*b29050e8SEsteban BlancSupported devices
12*b29050e8SEsteban Blanc=================
13*b29050e8SEsteban Blanc
14*b29050e8SEsteban BlancThe following chips are supported by this driver:
15*b29050e8SEsteban Blanc
16*b29050e8SEsteban Blanc* `AD4030-24 <https://www.analog.com/AD4030-24>`_
17*b29050e8SEsteban Blanc* `AD4032-24 <https://www.analog.com/AD4032-24>`_
18*b29050e8SEsteban Blanc* `AD4630-16 <https://www.analog.com/AD4630-16>`_
19*b29050e8SEsteban Blanc* `AD4630-24 <https://www.analog.com/AD4630-24>`_
20*b29050e8SEsteban Blanc* `AD4632-16 <https://www.analog.com/AD4632-16>`_
21*b29050e8SEsteban Blanc* `AD4632-24 <https://www.analog.com/AD4632-24>`_
22*b29050e8SEsteban Blanc
23*b29050e8SEsteban BlancIIO channels
24*b29050e8SEsteban Blanc============
25*b29050e8SEsteban Blanc
26*b29050e8SEsteban BlancEach "hardware" channel as described in the datasheet is split in 2 IIO
27*b29050e8SEsteban Blancchannels:
28*b29050e8SEsteban Blanc
29*b29050e8SEsteban Blanc- One channel for the differential data
30*b29050e8SEsteban Blanc- One channel for the common byte.
31*b29050e8SEsteban Blanc
32*b29050e8SEsteban BlancThe possible IIO channels depending on the numbers of "hardware" channel are:
33*b29050e8SEsteban Blanc
34*b29050e8SEsteban Blanc+------------------------------------+------------------------------------+
35*b29050e8SEsteban Blanc| 1 channel ADC                      | 2 channels ADC                     |
36*b29050e8SEsteban Blanc+====================================+====================================+
37*b29050e8SEsteban Blanc| - voltage0-voltage1 (differential) | - voltage0-voltage1 (differential) |
38*b29050e8SEsteban Blanc| - voltage2 (common-mode)           | - voltage2-voltage3 (differential) |
39*b29050e8SEsteban Blanc|                                    | - voltage4 (common-mode)           |
40*b29050e8SEsteban Blanc|                                    | - voltage5 (common-mode)           |
41*b29050e8SEsteban Blanc+------------------------------------+------------------------------------+
42*b29050e8SEsteban Blanc
43*b29050e8SEsteban BlancLabels
44*b29050e8SEsteban Blanc------
45*b29050e8SEsteban Blanc
46*b29050e8SEsteban BlancFor ease of use, the IIO channels provide a label. For a differential channel,
47*b29050e8SEsteban Blancthe label is ``differentialN`` where ``N`` is the "hardware" channel id. For a
48*b29050e8SEsteban Blanccommon-mode channel, the label is ``common-modeN`` where ``N`` is the
49*b29050e8SEsteban Blanc"hardware" channel id.
50*b29050e8SEsteban Blanc
51*b29050e8SEsteban BlancThe possible labels are:
52*b29050e8SEsteban Blanc
53*b29050e8SEsteban Blanc+-----------------+-----------------+
54*b29050e8SEsteban Blanc| 1 channel ADC   | 2 channels ADC  |
55*b29050e8SEsteban Blanc+=================+=================+
56*b29050e8SEsteban Blanc| - differential0 | - differential0 |
57*b29050e8SEsteban Blanc| - common-mode0  | - differential1 |
58*b29050e8SEsteban Blanc|                 | - common-mode0  |
59*b29050e8SEsteban Blanc|                 | - common-mode1  |
60*b29050e8SEsteban Blanc+-----------------+-----------------+
61*b29050e8SEsteban Blanc
62*b29050e8SEsteban BlancSupported features
63*b29050e8SEsteban Blanc==================
64*b29050e8SEsteban Blanc
65*b29050e8SEsteban BlancSPI wiring modes
66*b29050e8SEsteban Blanc----------------
67*b29050e8SEsteban Blanc
68*b29050e8SEsteban BlancThe driver currently supports the following SPI wiring configurations:
69*b29050e8SEsteban Blanc
70*b29050e8SEsteban BlancOne lane mode
71*b29050e8SEsteban Blanc^^^^^^^^^^^^^
72*b29050e8SEsteban Blanc
73*b29050e8SEsteban BlancIn this mode, each channel has its own SDO line to send the conversion results.
74*b29050e8SEsteban BlancAt the moment this mode can only be used on AD4030 which has one channel so only
75*b29050e8SEsteban Blancone SDO line is used.
76*b29050e8SEsteban Blanc
77*b29050e8SEsteban Blanc.. code-block::
78*b29050e8SEsteban Blanc
79*b29050e8SEsteban Blanc    +-------------+         +-------------+
80*b29050e8SEsteban Blanc    |     ADC     |         |     HOST    |
81*b29050e8SEsteban Blanc    |             |         |             |
82*b29050e8SEsteban Blanc    |         CNV |<--------| CNV         |
83*b29050e8SEsteban Blanc    |          CS |<--------| CS          |
84*b29050e8SEsteban Blanc    |         SDI |<--------| SDO         |
85*b29050e8SEsteban Blanc    |        SDO0 |-------->| SDI         |
86*b29050e8SEsteban Blanc    |        SCLK |<--------| SCLK        |
87*b29050e8SEsteban Blanc    +-------------+         +-------------+
88*b29050e8SEsteban Blanc
89*b29050e8SEsteban BlancInterleaved mode
90*b29050e8SEsteban Blanc^^^^^^^^^^^^^^^^
91*b29050e8SEsteban Blanc
92*b29050e8SEsteban BlancIn this mode, both channels conversion results are bit interleaved one SDO line.
93*b29050e8SEsteban BlancAs such the wiring is the same as `One lane mode`_.
94*b29050e8SEsteban Blanc
95*b29050e8SEsteban BlancSPI Clock mode
96*b29050e8SEsteban Blanc--------------
97*b29050e8SEsteban Blanc
98*b29050e8SEsteban BlancOnly the SPI clocking mode is supported.
99*b29050e8SEsteban Blanc
100*b29050e8SEsteban BlancOutput modes
101*b29050e8SEsteban Blanc------------
102*b29050e8SEsteban Blanc
103*b29050e8SEsteban BlancThere are more exposed IIO channels than channels as describe in the devices
104*b29050e8SEsteban Blancdatasheet. This is due to the `Differential data + common-mode`_ encoding
105*b29050e8SEsteban Blanc2 types of information in one conversion result. As such a "device" channel
106*b29050e8SEsteban Blancprovides 2 IIO channels, one for the differential data and one for the common
107*b29050e8SEsteban Blancbyte.
108*b29050e8SEsteban Blanc
109*b29050e8SEsteban BlancDifferential data
110*b29050e8SEsteban Blanc^^^^^^^^^^^^^^^^^
111*b29050e8SEsteban Blanc
112*b29050e8SEsteban BlancThis mode is selected when:
113*b29050e8SEsteban Blanc
114*b29050e8SEsteban Blanc- Only differential channels are enabled in a buffered read
115*b29050e8SEsteban Blanc- Oversampling attribute is set to 1
116*b29050e8SEsteban Blanc
117*b29050e8SEsteban BlancDifferential data + common-mode
118*b29050e8SEsteban Blanc^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119*b29050e8SEsteban Blanc
120*b29050e8SEsteban BlancThis mode is selected when:
121*b29050e8SEsteban Blanc
122*b29050e8SEsteban Blanc- Differential and common-mode channels are enabled in a buffered read
123*b29050e8SEsteban Blanc- Oversampling attribute is set to 1
124*b29050e8SEsteban Blanc
125*b29050e8SEsteban BlancFor the 24-bits chips, this mode is also available with 16-bits differential
126*b29050e8SEsteban Blancdata but is not selectable yet.
127*b29050e8SEsteban Blanc
128*b29050e8SEsteban BlancAveraged differential data
129*b29050e8SEsteban Blanc^^^^^^^^^^^^^^^^^^^^^^^^^^
130*b29050e8SEsteban Blanc
131*b29050e8SEsteban BlancThis mode is selected when:
132*b29050e8SEsteban Blanc
133*b29050e8SEsteban Blanc- Only differential channels are selected enabled in a buffered read
134*b29050e8SEsteban Blanc- Oversampling attribute is greater than 1
135*b29050e8SEsteban Blanc
136*b29050e8SEsteban BlancDigital Gain and Offset
137*b29050e8SEsteban Blanc-----------------------
138*b29050e8SEsteban Blanc
139*b29050e8SEsteban BlancEach differential data channel has a 16-bits unsigned configurable hardware
140*b29050e8SEsteban Blancgain applied to it. By default it's equal to 1. Note that applying gain can
141*b29050e8SEsteban Blanccause numerical saturation.
142*b29050e8SEsteban Blanc
143*b29050e8SEsteban BlancEach differential data channel has a signed configurable hardware offset.
144*b29050e8SEsteban BlancFor the ADCs ending in ``-24``, the gain is encoded on 24-bits.
145*b29050e8SEsteban BlancLikewise, the ADCs ending in ``-16`` have a gain encoded on 16-bits. Note that
146*b29050e8SEsteban Blancapplying an offset can cause numerical saturation.
147*b29050e8SEsteban Blanc
148*b29050e8SEsteban BlancThe final differential data returned by the ADC is computed by first applying
149*b29050e8SEsteban Blancthe gain, then the offset.
150*b29050e8SEsteban Blanc
151*b29050e8SEsteban BlancThe gain is controlled by the ``calibscale`` IIO attribute while the offset is
152*b29050e8SEsteban Blanccontrolled by the ``calibbias`` attribute.
153*b29050e8SEsteban Blanc
154*b29050e8SEsteban BlancReference voltage
155*b29050e8SEsteban Blanc-----------------
156*b29050e8SEsteban Blanc
157*b29050e8SEsteban BlancThe chip supports an external reference voltage via the ``REF`` input or an
158*b29050e8SEsteban Blancinternal buffered reference voltage via the ``REFIN`` input. The driver looks
159*b29050e8SEsteban Blancat the device tree to determine which is being used. If ``ref-supply`` is
160*b29050e8SEsteban Blancpresent, then the external reference voltage is used and the internal buffer is
161*b29050e8SEsteban Blancdisabled. If ``refin-supply`` is present, then the internal buffered reference
162*b29050e8SEsteban Blancvoltage is used.
163*b29050e8SEsteban Blanc
164*b29050e8SEsteban BlancReset
165*b29050e8SEsteban Blanc-----
166*b29050e8SEsteban Blanc
167*b29050e8SEsteban BlancBoth hardware and software reset are supported. The driver looks first at the
168*b29050e8SEsteban Blancdevice tree to see if the ``reset-gpio`` is populated.
169*b29050e8SEsteban BlancIf not present, the driver will fallback to a software reset by wiring to the
170*b29050e8SEsteban Blancdevice's registers.
171*b29050e8SEsteban Blanc
172*b29050e8SEsteban BlancUnimplemented features
173*b29050e8SEsteban Blanc----------------------
174*b29050e8SEsteban Blanc
175*b29050e8SEsteban Blanc- ``BUSY`` indication
176*b29050e8SEsteban Blanc- Additional wiring modes
177*b29050e8SEsteban Blanc- Additional clock modes
178*b29050e8SEsteban Blanc- Differential data 16-bits + common-mode for 24-bits chips
179*b29050e8SEsteban Blanc- Overrange events
180*b29050e8SEsteban Blanc- Test patterns
181