ad4030.rst 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. .. SPDX-License-Identifier: GPL-2.0-only
  2. =============
  3. AD4030 driver
  4. =============
  5. ADC driver for Analog Devices Inc. AD4030 and similar devices. The module name
  6. is ``ad4030``.
  7. Supported devices
  8. =================
  9. The following chips are supported by this driver:
  10. * `AD4030-24 <https://www.analog.com/AD4030-24>`_
  11. * `AD4032-24 <https://www.analog.com/AD4032-24>`_
  12. * `AD4630-16 <https://www.analog.com/AD4630-16>`_
  13. * `AD4630-24 <https://www.analog.com/AD4630-24>`_
  14. * `AD4632-16 <https://www.analog.com/AD4632-16>`_
  15. * `AD4632-24 <https://www.analog.com/AD4632-24>`_
  16. IIO channels
  17. ============
  18. Each "hardware" channel as described in the datasheet is split in 2 IIO
  19. channels:
  20. - One channel for the differential data
  21. - One channel for the common byte.
  22. The possible IIO channels depending on the numbers of "hardware" channel are:
  23. +------------------------------------+------------------------------------+
  24. | 1 channel ADC | 2 channels ADC |
  25. +====================================+====================================+
  26. | - voltage0-voltage1 (differential) | - voltage0-voltage1 (differential) |
  27. | - voltage2 (common-mode) | - voltage2-voltage3 (differential) |
  28. | | - voltage4 (common-mode) |
  29. | | - voltage5 (common-mode) |
  30. +------------------------------------+------------------------------------+
  31. Labels
  32. ------
  33. For ease of use, the IIO channels provide a label. For a differential channel,
  34. the label is ``differentialN`` where ``N`` is the "hardware" channel id. For a
  35. common-mode channel, the label is ``common-modeN`` where ``N`` is the
  36. "hardware" channel id.
  37. The possible labels are:
  38. +-----------------+-----------------+
  39. | 1 channel ADC | 2 channels ADC |
  40. +=================+=================+
  41. | - differential0 | - differential0 |
  42. | - common-mode0 | - differential1 |
  43. | | - common-mode0 |
  44. | | - common-mode1 |
  45. +-----------------+-----------------+
  46. Supported features
  47. ==================
  48. SPI wiring modes
  49. ----------------
  50. The driver currently supports the following SPI wiring configurations:
  51. One lane mode
  52. ^^^^^^^^^^^^^
  53. In this mode, each channel has its own SDO line to send the conversion results.
  54. At the moment this mode can only be used on AD4030 which has one channel so only
  55. one SDO line is used.
  56. .. code-block::
  57. +-------------+ +-------------+
  58. | ADC | | HOST |
  59. | | | |
  60. | CNV |<--------| CNV |
  61. | CS |<--------| CS |
  62. | SDI |<--------| SDO |
  63. | SDO0 |-------->| SDI |
  64. | SCLK |<--------| SCLK |
  65. +-------------+ +-------------+
  66. Interleaved mode
  67. ^^^^^^^^^^^^^^^^
  68. In this mode, both channels conversion results are bit interleaved one SDO line.
  69. As such the wiring is the same as `One lane mode`_.
  70. SPI Clock mode
  71. --------------
  72. Only the SPI clocking mode is supported.
  73. Output modes
  74. ------------
  75. There are more exposed IIO channels than channels as describe in the devices
  76. datasheet. This is due to the `Differential data + common-mode`_ encoding
  77. 2 types of information in one conversion result. As such a "device" channel
  78. provides 2 IIO channels, one for the differential data and one for the common
  79. byte.
  80. Differential data
  81. ^^^^^^^^^^^^^^^^^
  82. This mode is selected when:
  83. - Only differential channels are enabled in a buffered read
  84. - Oversampling attribute is set to 1
  85. Differential data + common-mode
  86. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  87. This mode is selected when:
  88. - Differential and common-mode channels are enabled in a buffered read
  89. - Oversampling attribute is set to 1
  90. For the 24-bits chips, this mode is also available with 16-bits differential
  91. data but is not selectable yet.
  92. Averaged differential data
  93. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  94. This mode is selected when:
  95. - Only differential channels are selected enabled in a buffered read
  96. - Oversampling attribute is greater than 1
  97. Digital Gain and Offset
  98. -----------------------
  99. Each differential data channel has a 16-bits unsigned configurable hardware
  100. gain applied to it. By default it's equal to 1. Note that applying gain can
  101. cause numerical saturation.
  102. Each differential data channel has a signed configurable hardware offset.
  103. For the ADCs ending in ``-24``, the gain is encoded on 24-bits.
  104. Likewise, the ADCs ending in ``-16`` have a gain encoded on 16-bits. Note that
  105. applying an offset can cause numerical saturation.
  106. The final differential data returned by the ADC is computed by first applying
  107. the gain, then the offset.
  108. The gain is controlled by the ``calibscale`` IIO attribute while the offset is
  109. controlled by the ``calibbias`` attribute.
  110. Reference voltage
  111. -----------------
  112. The chip supports an external reference voltage via the ``REF`` input or an
  113. internal buffered reference voltage via the ``REFIN`` input. The driver looks
  114. at the device tree to determine which is being used. If ``ref-supply`` is
  115. present, then the external reference voltage is used and the internal buffer is
  116. disabled. If ``refin-supply`` is present, then the internal buffered reference
  117. voltage is used.
  118. Reset
  119. -----
  120. Both hardware and software reset are supported. The driver looks first at the
  121. device tree to see if the ``reset-gpio`` is populated.
  122. If not present, the driver will fallback to a software reset by wiring to the
  123. device's registers.
  124. Unimplemented features
  125. ----------------------
  126. - ``BUSY`` indication
  127. - Additional wiring modes
  128. - Additional clock modes
  129. - Differential data 16-bits + common-mode for 24-bits chips
  130. - Overrange events
  131. - Test patterns