Debian Codegraph @

Documentation/iio/ad4062.rst

raw
1 .. SPDX-License-Identifier: GPL-2.0-only
2
3 =============
4 AD4062 driver
5 =============
6
7 ADC driver for Analog Devices Inc. AD4060/AD4062 devices. The module name is
8 ``ad4062``.
9
10 Supported devices
11 =================
12
13 The following chips are supported by this driver:
14
15 * `AD4060 <https://www.analog.com/AD4060>`_
16 * `AD4062 <https://www.analog.com/AD4062>`_
17
18 Wiring modes
19 ============
20
21 The ADC is interfaced through an I3C bus, and contains two programmable GPIOs.
22
23 The ADC convert-start happens on the SDA rising edge of the I3C stop (P) bit
24 at the end of the read command.
25
26 The two programmable GPIOS are optional and have a role assigned if present in
27 the devicetree ``interrupt-names`` property:
28
29 - GP0: Is assigned the role of Threshold Either signal.
30 - GP1: Is assigned the role of Data Ready signal.
31
32 If the property ``gpio-controller`` is present in the devicetree, then the GPO
33 not present in the ``interrupt-names`` is exposed as a GPO.
34
35 Device attributes
36 =================
37
38 The ADC contains only one channel with following attributes:
39
40 .. list-table:: Channel attributes
41 :header-rows: 1
42
43 * - Attribute
44 - Description
45 * - ``in_voltage_calibscale``
46 - Sets the gain scaling factor that the hardware applies to the sample,
47 to compensate for system gain error.
48 * - ``in_voltage_oversampling_ratio``
49 - Sets device's burst averaging mode to over sample using the
50 internal sample rate. Value 1 disable the burst averaging mode.
51 * - ``in_voltage_oversampling_ratio_available``
52 - List of available oversampling values.
53 * - ``in_voltage_raw``
54 - Returns the raw ADC voltage value.
55 * - ``in_voltage_scale``
56 - Returns the channel scale in reference to the reference voltage
57 ``ref-supply`` or ``vdd-supply`` if the former not present.
58
59 Also contain the following device attributes:
60
61 .. list-table:: Device attributes
62 :header-rows: 1
63
64 * - Attribute
65 - Description
66 * - ``sampling_frequency``
67 - Sets the duration of a single scan, used in the burst averaging mode.
68 The duration is described by ``(n_avg - 1) / fosc + tconv``, where
69 ``n_avg`` is the oversampling ratio, ``fosc`` is the internal sample
70 rate and ``tconv`` is the ADC conversion time.
71 * - ``sampling_frequency_available``
72 - Lists the available sampling frequencies, computed on the current
73 oversampling ratio. If the ratio is 1, the frequency is ``1/tconv``.
74
75 Interrupts
76 ==========
77
78 The interrupts are mapped through the ``interrupt-names`` and ``interrupts``
79 properties.
80
81 The ``interrupt-names`` ``gp0`` entry sets the role of Threshold signal, and
82 entry ``gp1`` the role of Data Ready signal.
83
84 If each is not present, the driver fallback to enabling the same role as an
85 I3C IBI.
86
87 Low-power mode
88 ==============
89
90 The device enters low-power mode on idle to save power. Enabling an event puts
91 the device out of the low-power since the ADC autonomously samples to assert
92 the event condition.
93
94 IIO trigger support
95 ===================
96
97 An IIO trigger ``ad4062-devX`` is registered by the driver to be used by the
98 same device, to capture samples to a software buffer. It is required to attach
99 the trigger to the device by setting the ``current_trigger`` before enabling
100 and reading the buffer.
101
102 The acquisition is sequential and bounded by the protocol timings, software
103 latency and internal timings, the sample rate is not configurable. The burst
104 averaging mode does impact the effective sample rate, since it increases the
105 internal timing to output a single sample.
106
107 Threshold events
108 ================
109
110 The ADC supports a monitoring mode to raise threshold events. The driver
111 supports a single interrupt for both rising and falling readings.
112
113 The feature is enabled/disabled by setting ``thresh_either_en``. During monitor
114 mode, the device continuously operates in autonomous mode. Any register access
115 puts the device back in configuration mode, due to this, any access disables
116 monitor mode.
117
118 The following event attributes are available:
119
120 .. list-table:: Event attributes
121 :header-rows: 1
122
123 * - Attribute
124 - Description
125 * - ``sampling_frequency``
126 - Frequency used in the monitoring mode, sets the device internal sample
127 rate when the mode is activated.
128 * - ``sampling_frequency_available``
129 - List of available sample rates.
130 * - ``thresh_either_en``
131 - Enable monitoring mode.
132 * - ``thresh_falling_hysteresis``
133 - Set the hysteresis value for the minimum threshold.
134 * - ``thresh_falling_value``
135 - Set the minimum threshold value.
136 * - ``thresh_rising_hysteresis``
137 - Set the hysteresis value for the maximum threshold.
138 * - ``thresh_rising_value``
139 - Set the maximum threshold value.
140
141 GPO controller support
142 ======================
143
144 The device supports using GP0 and GP1 as GPOs. If the devicetree contains the
145 node ``gpio-controller```, the device is marked as a GPIO controller and the
146 GPs not listed in ``interrupt-names`` are exposed as a GPO. The GPIO index
147 matches the pin name, so if GP0 is not exposed but GP1 is, index 0 is masked
148 out and only index 1 can be set.