# AD7944 driver

_Peios Kernel / Hardware and drivers / Industrial I/O_

> ADC driver for Analog Devices Inc. AD7944 and similar devices. The module name is ad7944.

<a id="rst-ad7944-driver"></a>

<!-- SPDX-License-Identifier: GPL-2.0-only -->

ADC driver for Analog Devices Inc. AD7944 and similar devices. The module name is `ad7944`.

<a id="rst-supported-devices"></a>

## Supported devices

The following chips are supported by this driver:

- [AD7944](<https://www.analog.com/AD7944>)<a id="rst-ad7944"></a>

- [AD7985](<https://www.analog.com/AD7985>)<a id="rst-ad7985"></a>

- [AD7986](<https://www.analog.com/AD7986>)<a id="rst-ad7986"></a>

<a id="rst-supported-features"></a>

## Supported features

<a id="rst-spi-wiring-modes"></a>

### SPI wiring modes

The driver currently supports three of the many possible SPI wiring configurations.

<a id="rst-cs-mode-3-wire-without-busy-indicator"></a>

#### CS mode, 3-wire, without busy indicator



```text
                                     +-------------+
                +--------------------| CS          |
                v                    |             |
VIO   +--------------------+         |     HOST    |
 |    |        CNV         |         |             |
 +--->| SDI   AD7944   SDO |-------->| SDI         |
      |        SCK         |         |             |
      +--------------------+         |             |
                ^                    |             |
                +--------------------| SCLK        |
                                     +-------------+
```

To select this mode in the device tree, set the `adi,spi-mode` property to `"single"` and omit the `cnv-gpios` property.

This is the only wiring configuration supported when using [SPI offload support](<#rst-spi-offload-support>).

<a id="rst-cs-mode-4-wire-without-busy-indicator"></a>

#### CS mode, 4-wire, without busy indicator



```text
                                    +-------------+
+-----------------------------------| CS          |
|                                   |             |
|              +--------------------| GPIO        |
|              v                    |             |
|    +--------------------+         |     HOST    |
|    |        CNV         |         |             |
+--->| SDI   AD7944   SDO |-------->| SDI         |
     |        SCK         |         |             |
     +--------------------+         |             |
               ^                    |             |
               +--------------------| SCLK        |
                                    +-------------+
```

To select this mode in the device tree, omit the `adi,spi-mode` property and provide the `cnv-gpios` property.

<a id="rst-chain-mode-without-busy-indicator"></a>

#### Chain mode, without busy indicator



```text
                                                               +-------------+
                +-------------------------+--------------------| CS          |
                v                         v                    |             |
      +--------------------+    +--------------------+         |     HOST    |
      |        CNV         |    |        CNV         |         |             |
 +--->| SDI   AD7944   SDO |--->| SDI   AD7944   SDO |-------->| SDI         |
 |    |        SCK         |    |        SCK         |         |             |
GND   +--------------------+    +--------------------+         |             |
                ^                         ^                    |             |
                +-------------------------+--------------------| SCLK        |
                                                               +-------------+
```

To select this mode in the device tree, set the `adi,spi-mode` property to `"chain"`, add the `spi-cs-high` flag, add the `#daisy-chained-devices` property, and omit the `cnv-gpios` property.

<a id="rst-reference-voltage"></a>

### Reference voltage

All 3 possible reference voltage sources are supported:

- Internal reference

- External 1.2V reference and internal buffer

- External reference

The source is determined by the device tree. If `ref-supply` is present, then the external reference is used. If `refin-supply` is present, then the internal buffer is used. If neither is present, then the internal reference is used.

<a id="rst-unimplemented-features"></a>

### Unimplemented features

- `BUSY` indication

<a id="rst-device-attributes"></a>

## Device attributes

There are two types of ADCs in this family, pseudo-differential and fully differential. The channel name is different depending on the type of ADC.

<a id="rst-pseudo-differential-adcs"></a>

### Pseudo-differential ADCs

AD7944 and AD7985 are pseudo-differential ADCs and have the following attributes:


<table>
<thead>
<tr>
<th>


Attribute

</th>
<th>


Description

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


`in_voltage0_raw`

</td>
<td>


Raw ADC voltage value (*IN+* referenced to ground sense).

</td>
</tr>
<tr>
<td>


`in_voltage0_scale`

</td>
<td>


Scale factor to convert raw value to mV.

</td>
</tr>
</tbody>
</table>

In "chain" mode, additional chips will appear as additional voltage input channels, e.g. `in_voltage1_raw`.

<a id="rst-fully-differential-adcs"></a>

### Fully-differential ADCs

AD7986 is a fully-differential ADC and has the following attributes:


<table>
<thead>
<tr>
<th>


Attribute

</th>
<th>


Description

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


`in_voltage0-voltage1_raw`

</td>
<td>


Raw ADC voltage value (*IN+* - *IN-*).

</td>
</tr>
<tr>
<td>


`in_voltage0-voltage1_scale`

</td>
<td>


Scale factor to convert raw value to mV.

</td>
</tr>
</tbody>
</table>

In "chain" mode, additional chips will appear as additional voltage input channels, e.g. `in_voltage2-voltage3_raw`.

<a id="rst-spi-offload-support"></a>

## SPI offload support

To be able to achieve the maximum sample rate, the driver can be used with the [AXI SPI Engine](<http://analogdevicesinc.github.io/hdl/projects/pulsar_adc/index.html>) to provide SPI offload support.

<a id="rst-axi-spi-engine"></a>



When SPI offload is being used, some attributes will be different.

- `trigger` directory is removed.

- `in_voltage0_sampling_frequency` attribute is added for setting the sample rate.

- `in_voltage0_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 `in_voltage0_type` attribute.

If the `turbo-gpios` property is present in the device tree, the driver will turn on TURBO during buffered reads and turn it off otherwise.

<a id="rst-device-buffers"></a>

## Device buffers

This driver supports IIO triggered buffers.

See [Industrial IIO device buffers](</kernel/hardware/iio/iio-devbuf.md>) for more information.
