sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget/translations/zh_CN/iio/iio_adcmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/zh_TW/iio/iio_adcmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/it_IT/iio/iio_adcmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ja_JP/iio/iio_adcmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ko_KR/iio/iio_adcmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/sp_SP/iio/iio_adcmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h%SPDX-License-Identifier: GPL-2.0-onlyh]h%SPDX-License-Identifier: GPL-2.0-only}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh9/var/lib/git/docbuild/linux/Documentation/iio/iio_adc.rsthKubhsection)}(hhh](htitle)}(hIIO Abstractions for ADCsh]hIIO Abstractions for ADCs}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h 1. Overviewh]h 1. Overview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXThe IIO subsystem supports many Analog to Digital Converters (ADCs). Some ADCs have features and characteristics that are supported in specific ways by IIO device drivers. This documentation describes common ADC features and explains how they are supported by the IIO subsystem.h]hXThe IIO subsystem supports many Analog to Digital Converters (ADCs). Some ADCs have features and characteristics that are supported in specific ways by IIO device drivers. This documentation describes common ADC features and explains how they are supported by the IIO subsystem.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubeh}(h]overviewah ]h"] 1. overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h1. ADC Channel Typesh]h1. ADC Channel Types}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hXADCs can have distinct types of inputs, each of them measuring analog voltages in a slightly different way. An ADC digitizes the analog input voltage over a span that is often given by the provided voltage reference, the input type, and the input polarity. The input range allowed to an ADC channel is needed to determine the scale factor and offset needed to obtain the measured value in real-world units (millivolts for voltage measurement, milliamps for current measurement, etc.).h]hXADCs can have distinct types of inputs, each of them measuring analog voltages in a slightly different way. An ADC digitizes the analog input voltage over a span that is often given by the provided voltage reference, the input type, and the input polarity. The input range allowed to an ADC channel is needed to determine the scale factor and offset needed to obtain the measured value in real-world units (millivolts for voltage measurement, milliamps for current measurement, etc.).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXTElaborate designs may have nonlinear characteristics or integrated components (such as amplifiers and reference buffers) that might also have to be considered to derive the allowed input range for an ADC. For clarity, the sections below assume the input range only depends on the provided voltage references, input type, and input polarity.h]hXTElaborate designs may have nonlinear characteristics or integrated components (such as amplifiers and reference buffers) that might also have to be considered to derive the allowed input range for an ADC. For clarity, the sections below assume the input range only depends on the provided voltage references, input type, and input polarity.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXThere are three general types of ADC inputs (single-ended, differential, pseudo-differential) and two possible polarities (unipolar, bipolar). The input type (single-ended, differential, pseudo-differential) is one channel characteristic, and is completely independent of the polarity (unipolar, bipolar) aspect. A comprehensive article about ADC input types (on which this doc is heavily based on) can be found at https://www.analog.com/en/resources/technical-articles/sar-adc-input-types.html.h](hXThere are three general types of ADC inputs (single-ended, differential, pseudo-differential) and two possible polarities (unipolar, bipolar). The input type (single-ended, differential, pseudo-differential) is one channel characteristic, and is completely independent of the polarity (unipolar, bipolar) aspect. A comprehensive article about ADC input types (on which this doc is heavily based on) can be found at }(hjhhhNhNubh reference)}(hOhttps://www.analog.com/en/resources/technical-articles/sar-adc-input-types.htmlh]hOhttps://www.analog.com/en/resources/technical-articles/sar-adc-input-types.html}(hj)hhhNhNubah}(h]h ]h"]h$]h&]refurij+uh1j'hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(h1.1 Single-ended channelsh]h1.1 Single-ended channels}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjBhhhhhK)ubh)}(hqSingle-ended channels digitize the analog input voltage relative to ground and can be either unipolar or bipolar.h]hqSingle-ended channels digitize the analog input voltage relative to ground and can be either unipolar or bipolar.}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjBhhubh)}(hhh](h)}(h$1.1.1 Single-ended Unipolar Channelsh]h$1.1.1 Single-ended Unipolar Channels}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjahhhhhK/ubh literal_block)}(hX---------- VREF ------------- ´ ` ´ ` _____________ / \ / \ / | / \ / \ --- < IN ADC | \ / \ / \ | `-´ `-´ \ VREF | -------- GND (0V) ----------- +-----------+ ^ | External VREFh]hX---------- VREF ------------- ´ ` ´ ` _____________ / \ / \ / | / \ / \ --- < IN ADC | \ / \ / \ | `-´ `-´ \ VREF | -------- GND (0V) ----------- +-----------+ ^ | External VREF}hjtsbah}(h]h ]h"]h$]h&]hhuh1jrhhhK3hjahhubh)}(hXThe input voltage to a **single-ended unipolar** channel is allowed to swing from GND to VREF (where VREF is a voltage reference with electrical potential higher than system ground). The maximum input voltage is also called VFS (Voltage input Full-Scale), with VFS being determined by VREF. The voltage reference may be provided from an external supply or derived from the chip power source.h](hThe input voltage to a }(hjhhhNhNubhstrong)}(h**single-ended unipolar**h]hsingle-ended unipolar}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhXW channel is allowed to swing from GND to VREF (where VREF is a voltage reference with electrical potential higher than system ground). The maximum input voltage is also called VFS (Voltage input Full-Scale), with VFS being determined by VREF. The voltage reference may be provided from an external supply or derived from the chip power source.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK>hjahhubh)}(h^A single-ended unipolar channel could be described in device tree like the following example::h]h]A single-ended unipolar channel could be described in device tree like the following example:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKEhjahhubjs)}(hnadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; }; };h]hnadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; }; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jrhhhKHhjahhubh)}(hOne is always allowed to include ADC channel nodes in the device tree. Though, if the device has a uniform set of inputs (e.g. all inputs are single-ended), then declaring the channel nodes is optional.h]hOne is always allowed to include ADC channel nodes in the device tree. Though, if the device has a uniform set of inputs (e.g. all inputs are single-ended), then declaring the channel nodes is optional.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjahhubh)}(hOne caveat for devices that support mixed single-ended and differential channels is that single-ended channel nodes also need to provide a ``single-channel`` property when ``reg`` is an arbitrary number that doesn't match the input pin number.h](hOne caveat for devices that support mixed single-ended and differential channels is that single-ended channel nodes also need to provide a }(hjhhhNhNubhliteral)}(h``single-channel``h]hsingle-channel}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh property when }(hjhhhNhNubj)}(h``reg``h]hreg}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhB is an arbitrary number that doesn’t match the input pin number.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKVhjahhubh)}(hSee ``Documentation/devicetree/bindings/iio/adc/adc.yaml`` for the complete documentation of ADC specific device tree properties.h](hSee }(hjhhhNhNubj)}(h6``Documentation/devicetree/bindings/iio/adc/adc.yaml``h]h2Documentation/devicetree/bindings/iio/adc/adc.yaml}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhG for the complete documentation of ADC specific device tree properties.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK[hjahhubeh}(h]single-ended-unipolar-channelsah ]h"]$1.1.1 single-ended unipolar channelsah$]h&]uh1hhjBhhhhhK/ubh)}(hhh](h)}(h#1.1.2 Single-ended Bipolar Channelsh]h#1.1.2 Single-ended Bipolar Channels}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhK`ubjs)}(hXJ---------- +VREF ------------ ´ ` ´ ` _____________________ / \ / \ / | / \ / \ --- < IN ADC | \ / \ / \ | `-´ `-´ \ +VREF -VREF | ---------- -VREF ------------ +-------------------+ ^ ^ | | External +VREF ------+ External -VREFh]hXJ---------- +VREF ------------ ´ ` ´ ` _____________________ / \ / \ / | / \ / \ --- < IN ADC | \ / \ / \ | `-´ `-´ \ +VREF -VREF | ---------- -VREF ------------ +-------------------+ ^ ^ | | External +VREF ------+ External -VREF}hj;sbah}(h]h ]h"]h$]h&]hhuh1jrhhhKdhj*hhubh)}(hXwFor a **single-ended bipolar** channel, the analog voltage input can go from -VREF to +VREF (where -VREF is the voltage reference that has the lower electrical potential while +VREF is the reference with the higher one). Some ADC chips derive the lower reference from +VREF, others get it from a separate input. Often, +VREF and -VREF are symmetric but they don't need to be so. When -VREF is lower than system ground, these inputs are also called single-ended true bipolar. Also, while there is a relevant difference between bipolar and true bipolar from the electrical perspective, IIO makes no explicit distinction between them.h](hFor a }(hjIhhhNhNubj)}(h**single-ended bipolar**h]hsingle-ended bipolar}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjIubhX[ channel, the analog voltage input can go from -VREF to +VREF (where -VREF is the voltage reference that has the lower electrical potential while +VREF is the reference with the higher one). Some ADC chips derive the lower reference from +VREF, others get it from a separate input. Often, +VREF and -VREF are symmetric but they don’t need to be so. When -VREF is lower than system ground, these inputs are also called single-ended true bipolar. Also, while there is a relevant difference between bipolar and true bipolar from the electrical perspective, IIO makes no explicit distinction between them.}(hjIhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKohj*hhubh)}(hMHere's an example device tree description of a single-ended bipolar channel::h]hNHere’s an example device tree description of a single-ended bipolar channel:}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKyhj*hhubjs)}(hadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; bipolar; }; };h]hadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; bipolar; }; };}hjwsbah}(h]h ]h"]h$]h&]hhuh1jrhhhK{hj*hhubeh}(h]single-ended-bipolar-channelsah ]h"]#1.1.2 single-ended bipolar channelsah$]h&]uh1hhjBhhhhhK`ubeh}(h]single-ended-channelsah ]h"]1.1 single-ended channelsah$]h&]uh1hhhhhhhhK)ubh)}(hhh](h)}(h1.2 Differential channelsh]h1.2 Differential channels}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hX,A differential voltage measurement digitizes the voltage level at the positive input (IN+) relative to the negative input (IN-) over the -VREF to +VREF span. In other words, a differential channel measures the potential difference between IN+ and IN-, which is often denoted by the IN+ - IN- formula.h]hX,A differential voltage measurement digitizes the voltage level at the positive input (IN+) relative to the negative input (IN-) over the -VREF to +VREF span. In other words, a differential channel measures the potential difference between IN+ and IN-, which is often denoted by the IN+ - IN- formula.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(h#1.2.1 Differential Bipolar Channelsh]h#1.2.1 Differential Bipolar Channels}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjs)}(hX-------- +VREF ------ +-------------------+ ´ ` ´ ` / | / \ / \ / --- < IN+ | `-´ `-´ | | -------- -VREF ------ | | | ADC | -------- +VREF ------ | | ´ ` ´ ` | | \ / \ / \ --- < IN- | `-´ `-´ \ +VREF -VREF | -------- -VREF ------ +-------------------+ ^ ^ | +---- External -VREF External +VREFh]hX-------- +VREF ------ +-------------------+ ´ ` ´ ` / | / \ / \ / --- < IN+ | `-´ `-´ | | -------- -VREF ------ | | | ADC | -------- +VREF ------ | | ´ ` ´ ` | | \ / \ / \ --- < IN- | `-´ `-´ \ +VREF -VREF | -------- -VREF ------ +-------------------+ ^ ^ | +---- External -VREF External +VREF}hjsbah}(h]h ]h"]h$]h&]hhuh1jrhhhKhjhhubh)}(hX1The analog signals to **differential bipolar** inputs are also allowed to swing from -VREF to +VREF. The bipolar part of the name means that the resulting value of the difference (IN+ - IN-) can be positive or negative. If -VREF is below system GND, these are also called differential true bipolar inputs.h](hThe analog signals to }(hjhhhNhNubj)}(h**differential bipolar**h]hdifferential bipolar}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX inputs are also allowed to swing from -VREF to +VREF. The bipolar part of the name means that the resulting value of the difference (IN+ - IN-) can be positive or negative. If -VREF is below system GND, these are also called differential true bipolar inputs.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h7Device tree example of a differential bipolar channel::h]h6Device tree example of a differential bipolar channel:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubjs)}(hadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; bipolar; diff-channels = <0 1>; }; };h]hadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; bipolar; diff-channels = <0 1>; }; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jrhhhKhjhhubh)}(hXVIn the ADC driver, ``differential = 1`` is set into ``struct iio_chan_spec`` for the channel. Even though, there are three general input types, ``differential`` is only used to distinguish between differential and non-differential (either single-ended or pseudo-differential) input types. See ``include/linux/iio/iio.h`` for more information.h](hIn the ADC driver, }(hjhhhNhNubj)}(h``differential = 1``h]hdifferential = 1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is set into }(hjhhhNhNubj)}(h``struct iio_chan_spec``h]hstruct iio_chan_spec}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhD for the channel. Even though, there are three general input types, }(hjhhhNhNubj)}(h``differential``h]h differential}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is only used to distinguish between differential and non-differential (either single-ended or pseudo-differential) input types. See }(hjhhhNhNubj)}(h``include/linux/iio/iio.h``h]hinclude/linux/iio/iio.h}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh for more information.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]differential-bipolar-channelsah ]h"]#1.2.1 differential bipolar channelsah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h$1.2.2 Differential Unipolar Channelsh]h$1.2.2 Differential Unipolar Channels}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhjmhhhhhKubh)}(hXFor **differential unipolar** channels, the analog voltage at the positive input must also be higher than the voltage at the negative input. Thus, the actual input range allowed to a differential unipolar channel is IN- to +VREF. Because IN+ is allowed to swing with the measured analog signal and the input setup must guarantee IN+ will not go below IN- (nor IN- will raise above IN+), most differential unipolar channel setups have IN- fixed to a known voltage that does not fall within the voltage range expected for the measured signal. That leads to a setup that is equivalent to a pseudo-differential channel. Thus, differential unipolar setups can often be supported as pseudo-differential unipolar channels.h](hFor }(hj~hhhNhNubj)}(h**differential unipolar**h]hdifferential unipolar}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj~ubhX channels, the analog voltage at the positive input must also be higher than the voltage at the negative input. Thus, the actual input range allowed to a differential unipolar channel is IN- to +VREF. Because IN+ is allowed to swing with the measured analog signal and the input setup must guarantee IN+ will not go below IN- (nor IN- will raise above IN+), most differential unipolar channel setups have IN- fixed to a known voltage that does not fall within the voltage range expected for the measured signal. That leads to a setup that is equivalent to a pseudo-differential channel. Thus, differential unipolar setups can often be supported as pseudo-differential unipolar channels.}(hj~hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjmhhubeh}(h]differential-unipolar-channelsah ]h"]$1.2.2 differential unipolar channelsah$]h&]uh1hhjhhhhhKubeh}(h]differential-channelsah ]h"]1.2 differential channelsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h 1.3 Pseudo-differential Channelsh]h 1.3 Pseudo-differential Channels}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXThere is a third ADC input type which is called pseudo-differential or single-ended to differential configuration. A pseudo-differential channel is similar to a differential channel in that it also measures IN+ relative to IN-. However, unlike bipolar differential channels, the negative input is limited to a narrow voltage range (taken as a constant voltage) while only IN+ is allowed to swing. A pseudo-differential channel can be made out from a differential pair of inputs by restricting the negative input to a known voltage while allowing only the positive input to swing. Sometimes, the input provided to IN- is called common-mode voltage. Besides, some parts have a COM pin that allows single-ended inputs to be referenced to a common-mode voltage, making them pseudo-differential channels. Often, the common mode input voltage can be described in the device tree as a voltage regulator (e.g. ``com-supply``) since it is basically a constant voltage source.h](hXThere is a third ADC input type which is called pseudo-differential or single-ended to differential configuration. A pseudo-differential channel is similar to a differential channel in that it also measures IN+ relative to IN-. However, unlike bipolar differential channels, the negative input is limited to a narrow voltage range (taken as a constant voltage) while only IN+ is allowed to swing. A pseudo-differential channel can be made out from a differential pair of inputs by restricting the negative input to a known voltage while allowing only the positive input to swing. Sometimes, the input provided to IN- is called common-mode voltage. Besides, some parts have a COM pin that allows single-ended inputs to be referenced to a common-mode voltage, making them pseudo-differential channels. Often, the common mode input voltage can be described in the device tree as a voltage regulator (e.g. }(hjhhhNhNubj)}(h``com-supply``h]h com-supply}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh2) since it is basically a constant voltage source.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(h+1.3.1 Pseudo-differential Unipolar Channelsh]h+1.3.1 Pseudo-differential Unipolar Channels}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjs)}(hX-------- +VREF ------ +-------------------+ ´ ` ´ ` / | / \ / \ / --- < IN+ | `-´ `-´ | | --------- IN- ------- | ADC | | | Common-mode voltage --> --- < IN- | \ +VREF -VREF | +-------------------+ ^ ^ | +---- External -VREF External +VREFh]hX-------- +VREF ------ +-------------------+ ´ ` ´ ` / | / \ / \ / --- < IN+ | `-´ `-´ | | --------- IN- ------- | ADC | | | Common-mode voltage --> --- < IN- | \ +VREF -VREF | +-------------------+ ^ ^ | +---- External -VREF External +VREF}hjsbah}(h]h ]h"]h$]h&]hhuh1jrhhhKhjhhubh)}(hXoA **pseudo-differential unipolar** input has the limitations a differential unipolar channel would have, meaning the analog voltage to the positive input IN+ must stay within IN- to +VREF. The fixed voltage to IN- is often called common-mode voltage and it must be within -VREF to +VREF as would be expected from the signal to any differential channel negative input.h](hA }(hjhhhNhNubj)}(h **pseudo-differential unipolar**h]hpseudo-differential unipolar}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhXM input has the limitations a differential unipolar channel would have, meaning the analog voltage to the positive input IN+ must stay within IN- to +VREF. The fixed voltage to IN- is often called common-mode voltage and it must be within -VREF to +VREF as would be expected from the signal to any differential channel negative input.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXThe voltage measured from IN+ is relative to IN- but, unlike differential channels, pseudo-differential setups are intended to gauge single-ended input signals. To enable applications to calculate IN+ voltage with respect to system ground, the IIO channel may provide an ``_offset`` sysfs attribute to be added to ADC output when converting raw data to voltage units. In many setups, the common-mode voltage input is at GND level and the ``_offset`` attribute is omitted due to being always zero.h](hXThe voltage measured from IN+ is relative to IN- but, unlike differential channels, pseudo-differential setups are intended to gauge single-ended input signals. To enable applications to calculate IN+ voltage with respect to system ground, the IIO channel may provide an }(hjhhhNhNubj)}(h ``_offset``h]h_offset}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh sysfs attribute to be added to ADC output when converting raw data to voltage units. In many setups, the common-mode voltage input is at GND level and the }(hjhhhNhNubj)}(h ``_offset``h]h_offset}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/ attribute is omitted due to being always zero.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h>Device tree example for pseudo-differential unipolar channel::h]h=Device tree example for pseudo-differential unipolar channel:}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubjs)}(hadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; single-channel = <0>; common-mode-channel = <1>; }; };h]hadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; single-channel = <0>; common-mode-channel = <1>; }; };}hj^sbah}(h]h ]h"]h$]h&]hhuh1jrhhhKhjhhubh)}(hdDo not set ``differential`` in the channel ``iio_chan_spec`` struct of pseudo-differential channels.h](h Do not set }(hjlhhhNhNubj)}(h``differential``h]h differential}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1jhjlubh in the channel }(hjlhhhNhNubj)}(h``iio_chan_spec``h]h iio_chan_spec}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjlubh( struct of pseudo-differential channels.}(hjlhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]%pseudo-differential-unipolar-channelsah ]h"]+1.3.1 pseudo-differential unipolar channelsah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h*1.3.2 Pseudo-differential Bipolar Channelsh]h*1.3.2 Pseudo-differential Bipolar Channels}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM ubjs)}(hX-------- +VREF ------ +-------------------+ ´ ` ´ ` / | / \ / \ / --- < IN+ | `-´ `-´ | | -------- -VREF ------ | ADC | | | Common-mode voltage --> --- < IN- | \ +VREF -VREF | +-------------------+ ^ ^ | +---- External -VREF External +VREFh]hX-------- +VREF ------ +-------------------+ ´ ` ´ ` / | / \ / \ / --- < IN+ | `-´ `-´ | | -------- -VREF ------ | ADC | | | Common-mode voltage --> --- < IN- | \ +VREF -VREF | +-------------------+ ^ ^ | +---- External -VREF External +VREF}hjsbah}(h]h ]h"]h$]h&]hhuh1jrhhhMhjhhubh)}(hXA **pseudo-differential bipolar** input is not limited by the level at IN- but it will be limited to -VREF or to GND on the lower end of the input range depending on the particular ADC. Similar to their unipolar counter parts, pseudo-differential bipolar channels ought to declare an ``_offset`` attribute to enable the conversion of raw ADC data to voltage units. For the setup with IN- connected to GND, ``_offset`` is often omitted.h](hA }(hjhhhNhNubj)}(h**pseudo-differential bipolar**h]hpseudo-differential bipolar}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh input is not limited by the level at IN- but it will be limited to -VREF or to GND on the lower end of the input range depending on the particular ADC. Similar to their unipolar counter parts, pseudo-differential bipolar channels ought to declare an }(hjhhhNhNubj)}(h ``_offset``h]h_offset}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubho attribute to enable the conversion of raw ADC data to voltage units. For the setup with IN- connected to GND, }(hjhhhNhNubj)}(h ``_offset``h]h_offset}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is often omitted.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h=Device tree example for pseudo-differential bipolar channel::h]h; #size-cells = <0>; channel@0 { reg = <0>; bipolar; single-channel = <0>; common-mode-channel = <1>; }; };h]hadc@0 { ... #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; bipolar; single-channel = <0>; common-mode-channel = <1>; }; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jrhhhM&hjhhubeh}(h]$pseudo-differential-bipolar-channelsah ]h"]*1.3.2 pseudo-differential bipolar channelsah$]h&]uh1hhjhhhhhM ubeh}(h]pseudo-differential-channelsah ]h"] 1.3 pseudo-differential channelsah$]h&]uh1hhhhhhhhKubeh}(h]adc-channel-typesah ]h"]1. adc channel typesah$]h&]uh1hhhhhhhhKubeh}(h]iio-abstractions-for-adcsah ]h"]iio abstractions for adcsah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjherror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jBj?hhj:j7jjj'j$jjjjjjjgjjj2j/jjj*j'u nametypes}(jBhj:jj'jjjjjj2jj*uh}(j?hhhj7hjjBj$jajj*jjjgjjjmj/jjjj'ju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.