On Thu, Jul 11, 2024 at 1:16 PM David Lechner <dlechner@xxxxxxxxxxxx> wrote: > > Add device tree bindings for AD4695 and similar ADCs. > > Reviewed-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx> > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx> > --- > > Note, this may trigger a DT build warning "common-mode-channel: missing > type definition" if the builder doesn't include the recently added > common-mode-channel property [1]. This should be safe to ignore (passes > make dt_binding_check locally). > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=testing&id=d86deaec1c5b0fb60c3619e8d2ae7a1d722fd2ad > > v4 changes: > * Picked up Conor's reviewed-by tag. > > v3 changes: > * Change interrupts to be per pin instead of per signal. > * Drop diff-channels and single-channel properties. > * Odd numbered pins added to common-mode-channel property enum. > * REFGND and COM values changes to avoid confusion with pin numbers. > * Add inX-supply properties for odd numbed input pins. > > v2 changes: > * Drop *-wlcsp compatible strings > * Don't use fallback compatible strings > * Reword supply descriptions > * Use standard channel properties instead of adi,pin-pairing > * Fix unnecessary | character > * Fix missing blank line > * Add header file with common mode channel macros > --- > .../devicetree/bindings/iio/adc/adi,ad4695.yaml | 256 +++++++++++++++++++++ > MAINTAINERS | 10 + > include/dt-bindings/iio/adi,ad4695.h | 9 + > 3 files changed, 275 insertions(+) > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad4695.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad4695.yaml > new file mode 100644 > index 000000000000..a2e824e26691 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad4695.yaml > @@ -0,0 +1,256 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/adc/adi,ad4695.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Analog Devices Easy Drive Multiplexed SAR Analog to Digital Converters > + > +maintainers: > + - Michael Hennerich <Michael.Hennerich@xxxxxxxxxx> > + - Nuno Sá <nuno.sa@xxxxxxxxxx> > + > +description: | > + A family of similar multi-channel analog to digital converters with SPI bus. > + > + * https://www.analog.com/en/products/ad4695.html > + * https://www.analog.com/en/products/ad4696.html > + * https://www.analog.com/en/products/ad4697.html > + * https://www.analog.com/en/products/ad4698.html > + > +$ref: /schemas/spi/spi-peripheral-props.yaml# > + > +properties: > + compatible: > + enum: > + - adi,ad4695 > + - adi,ad4696 > + - adi,ad4697 > + - adi,ad4698 > + > + reg: > + maxItems: 1 > + > + spi-max-frequency: > + maximum: 80000000 > + > + spi-cpol: true > + spi-cpha: true > + > + spi-rx-bus-width: > + minimum: 1 > + maximum: 4 > + > + avdd-supply: > + description: Analog power supply. > + > + vio-supply: > + description: I/O pin power supply. > + > + ldo-in-supply: > + description: Internal LDO Input. Mutually exclusive with vdd-supply. > + > + vdd-supply: > + description: Core power supply. Mutually exclusive with ldo-in-supply. > + > + ref-supply: > + description: > + External reference voltage. Mutually exclusive with refin-supply. > + > + refin-supply: > + description: > + Internal reference buffer input. Mutually exclusive with ref-supply. > + > + com-supply: > + description: Common voltage supply for pseudo-differential analog inputs. > + > + adi,no-ref-current-limit: > + $ref: /schemas/types.yaml#/definitions/flag > + description: > + When this flag is present, the REF Overvoltage Reduced Current protection > + is disabled. > + > + adi,no-ref-high-z: > + $ref: /schemas/types.yaml#/definitions/flag > + description: > + Enable this flag if the ref-supply requires Reference Input High-Z Mode > + to be disabled for proper operation. > + > + cnv-gpios: > + description: The Convert Input (CNV). If omitted, CNV is tied to SPI CS. > + maxItems: 1 > + > + reset-gpios: > + description: The Reset Input (RESET). Should be configured GPIO_ACTIVE_LOW. > + maxItems: 1 > + > + interrupts: > + minItems: 1 > + items: > + - description: Signal coming from the BSY_ALT_GP0 pin (ALERT or BUSY). > + - description: Signal coming from the GP2 pin (ALERT). > + - description: Signal coming from the GP3 pin (BUSY). > + > + interrupt-names: > + minItems: 1 > + items: > + - const: gp0 > + - const: gp2 > + - const: gp3 > + > + gpio-controller: true > + > + "#gpio-cells": > + const: 2 > + description: | > + The first cell is the GPn number: 0 to 3. > + The second cell takes standard GPIO flags. > + > + "#address-cells": > + const: 1 > + > + "#size-cells": > + const: 0 > + > +patternProperties: > + "^in(?:[13579]|1[135])-supply$": > + description: > + Optional voltage supply for odd numbered channels when they are used as > + the negative input for a pseudo-differential channel. > + > + "^channel@[0-9a-f]$": > + type: object > + $ref: adc.yaml > + unevaluatedProperties: false > + description: > + Describes each individual channel. In addition the properties defined > + below, bipolar from adc.yaml is also supported. > + > + properties: > + reg: > + maximum: 15 > + > + common-mode-channel: > + description: > + Describes the common mode channel for single channels. 0xFF is REFGND > + and OxFE is COM. Macros are available for these values in > + dt-bindings/iio/adi,ad4695.h. Values 1 to 15 correspond to INx inputs. > + Only odd numbered INx inputs can be used as common mode channels. > + items: "items" is for arrays, but common-mode-channel is a uint32. Drop "items". Either Jonathan can fixup or you'll need to send a fix. It's now warning in linux-next (you need dtschema main branch): /builds/robherring/linux-dt/Documentation/devicetree/bindings/iio/adc/adi,ad4695.example.dtb: adc@0: channel@1:common-mode-channel: 254 is not of type 'array' from schema $id: http://devicetree.org/schemas/iio/adc/adi,ad4695.yaml# /builds/robherring/linux-dt/Documentation/devicetree/bindings/iio/adc/adi,ad4695.example.dtb: adc@0: channel@2:common-mode-channel: 3 is not of type 'array' from schema $id: http://devicetree.org/schemas/iio/adc/adi,ad4695.yaml# > + enum: [1, 3, 5, 7, 9, 11, 13, 15, 0xFE, 0xFF] > + default: 0xFF Rob