Commit 1bb866dc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-for-5.17a' of...

Merge tag 'iio-for-5.17a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, features and cleanup for 5.17

Includes some fixes that were either late breaking, low priority or
complex enough to not be good to rush in late in the cycle.

Tree rebased today to fix up some trivial issues + pull in a fix that
was previously on the fixes-togreg branch. Vast majority have been
in linux-next for some time now.

New device support
* adi,ad7293
  - New driver and bindings for this Power Amplifier drain current
    controller.  A complex device with various related monitoring functions.
* adi,ad75513R
  - New driver and bindings for this combined ADC and DAC device.
  - A few follow up fixes.
* adi,admv8818
  - New driver (and type) for this 2-18GHz filter device. Includes
    bindings and ABI documentation to allow clk_notifier based auto
    adjustment of the filters in appropriate applications.
* liteon,ltr501
  - Support for the ltr303.  ID and chip specific info table.
* xilinx,ams
  - New generic firmware function fwnode_iomap() as used in this driver.
  - New driver and bindings for this ADC and on-chip sensors as found
    in various Xilinx devices.

Core
* Introduced IIO_VAL_INT_64 which uses val and val2 in IIO callbacks to
  form a 64 bit integer when higher precision needed.
* Allow IIO_ENUM_AVAILABLE to be used with different shared values.
* Fix a long term issue with scheduling whilst atomic when iio_trig_poll()
  is called but no trigger consumers are actually enabled and hence the
  trigger may be reenabled from the interrupt handler.  Seen in the wild
  on the tsc2046.
* Mark iio_device_type const.
* buffer: Use a separate index variable to simplify code.
* buffer-dma: Clear out unused struct iio_buffer_block
* buffer-dmaengine: Switch to cheaper round_down() as power of 2 values.

Tests/tools
* format_value
  - Check against NULL returns from allocations in tests.
  - Add IIO_VAL_INT_64 test case.
* event_monitor
  - Flush the output after event to given more consistent latency
    when tool output piped to other programs.

Driver Features
* axp20x
  - Add support for NTC thermistor channel and document TS pin binding.
* arm,scmi
  - Add reading of raw channel values (using IIO_VAL_INT_64)
* liteon,ltr501
  - Add proximity-near-level support and dt-binding.

Tree wide cleanup
* Remove no-op trigger ops from multiple drivers.
* Stop using dev_get_drvdata() on the iio_dev->dev in various drivers
  and then stop assigning it to allow this to be used for other purposes.
  We can always get to the indio_dev using dev_to_iio_dev() which is
  a container_of() based approach. Also cleanup up some related unnecessary
  convoluted cases.
  - atmel,at91-sam5d2
  - nxp,imx7d
  - meas,ms5611
  - st,st_sensors
* Where available (or easy to introduce) use the scan_type.* values
  in place of a second copy for read_raw and similar paths.
  - adi,ad7266
  - bosch,bma220
  - fsl,mac3110
  - fsl,mma7455
  - fsl,mpl3115
  - kionix,kcjk-1013
  - sensortek,stk8ba50
  - sensortek,stk8312
  - ti,adc12138
  - ti,ads1015
  - vti,sca3000
  - xilinx,xadc-core
* Switch drives over to generic firmware properties including appropriate
  header changes to avoid including of.h
  - Various DACs had false CONFIG_OF dependencies.
  - dpot-dac
  - envelope-detector
  - adi,ad5755
  - adi,ad5758
  - capella,cm3605
  - maxim,max9611
  - microchip,mcp41010
  - microchip,mcp3911
  - ti,adc12138
* Trivial clang warning fixes for W=1 warnings.

Driver specific cleanup and minor fixes
* adi,ad7606
  - Comment fixes.
* ams,ad3935
  - Drop pointless cast to the same type.
* atmel,at91-sama5d2
  - Fix wrong cast of iio_dev->dev to platform_device that happened to
    be harmless.
* fsl,mma7660
  - Stop i2c remove() function returning an error code. Part of a rework
    to eventually stop returning anything from these.
* fsl,mma8452
  - Use correct type for local irqreturn_t.
* nxp,imx8mq
  - Maintainer email address update.
* nxp,lpc18xx_adc
  - Ensure clk_prepare_enable() called before clk_get_rate().
  - Switch of.h for mod_devicetable.h to reflect no of specific functions,
    just the id table.
* renesas,rzg2l
  - Drop a dev_err() that just duplicates error printed in platform_get_irq()
* sgx,vz89x
  - Drop pointless cast.
* st,lsm6dsx
  - Make it possible to disable the sensorhub from DT to avoid a corner
    case where the address of a slave device many be accidentally modified.
* st,stm32-adc
  - Stop leaking an of_node in an error path.
* st,stmp2
   - Avoid wrong sized type for bit field which could result in
     over-reading (harmless). Precursor to enabling -Warray-bounds.
* ti,adc081c
  - Put back some ACPI support for non standards compliant ADC081C
    ID because it is known to be in the wild on some Aaeon boards.
* ti,ads8688
  - Cleanup redundant local ret variable assignment.
* ti,ina2xx-adc
  - Use helper macro kthread_run() to replace some boilerplate.
  - Avoid double reference counting.
  - Drop pointless cast.
* xilinx,xadc
  - Make the IRQ optional as not always wired to the host system.

* tag 'iio-for-5.17a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (103 commits)
  iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
  iio:addac:ad74413r: Fix uninitialized ret in a path that won't be hit.
  MAINTAINERS: Add maintainer for xilinx-ams
  dt-bindings: iio: adc: Add Xilinx AMS binding documentation
  iio: adc: Add Xilinx AMS driver
  device property: Add fwnode_iomap()
  iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.
  iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops.
  iio:dummy: Drop set but unused variable len.
  iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum conversion.
  iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum conversion.
  iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum conversion.
  iio:dac:mcp4725: Suppress clang W=1 warning about pointer to enum conversion.
  iio:amplifiers:hmc425a: Suppress clang W=1 warning about pointer to enum conversion.
  iio:adc:ti-ads1015: Suppress clang W=1 warning about pointer to enum conversion.
  iio:adc:rcar: Suppress clang W=1 warning about pointer to enum conversion.
  iio:adc:ina2xx-adc: Suppress clang W=1 warning about pointer to enum conversion.
  iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion.
  drivers:iio:dac: Add AD3552R driver support
  dt-bindings: iio: dac: Add adi,ad3552r.yaml
  ...
parents e233897b c9791a94
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
What:		/sys/bus/iio/devices/iio:deviceX/filter_mode_available
KernelVersion:
Contact:	linux-iio@vger.kernel.org
Description:
		Reading this returns the valid values that can be written to the
		on_altvoltage0_mode attribute:

		- auto -> Adjust bandpass filter to track changes in input clock rate.
		- manual -> disable/unregister the clock rate notifier / input clock tracking.

What:		/sys/bus/iio/devices/iio:deviceX/filter_mode
KernelVersion:
Contact:	linux-iio@vger.kernel.org
Description:
		This attribute configures the filter mode.
		Reading returns the actual mode.
+3 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ description: |
   8 | batt_v
   8 | batt_v
   9 | batt_chrg_i
   9 | batt_chrg_i
  10 | batt_dischrg_i
  10 | batt_dischrg_i
  11 | ts_v


  AXP22x
  AXP22x
  ------
  ------
@@ -34,6 +35,7 @@ description: |
   1 | batt_v
   1 | batt_v
   2 | batt_chrg_i
   2 | batt_chrg_i
   3 | batt_dischrg_i
   3 | batt_dischrg_i
   4 | ts_v


  AXP813
  AXP813
  ------
  ------
@@ -42,6 +44,7 @@ description: |
   2 | batt_v
   2 | batt_v
   3 | batt_chrg_i
   3 | batt_chrg_i
   4 | batt_dischrg_i
   4 | batt_dischrg_i
   5 | ts_v




properties:
properties:
+227 −0
Original line number Original line Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/xlnx,zynqmp-ams.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Xilinx Zynq Ultrascale AMS controller

maintainers:
  - Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>

description: |
  The AMS (Analog Monitoring System) includes an ADC as well as on-chip sensors
  that can be used to sample external voltages and monitor on-die operating
  conditions, such as temperature and supply voltage levels.
  The AMS has two SYSMON blocks which are PL (Programmable Logic) SYSMON and
  PS (Processing System) SYSMON.
  All designs should have AMS registers, but PS and PL are optional. The
  AMS controller can work with only PS, only PL and both PS and PL
  configurations. Please specify registers according to your design. Devicetree
  should always have AMS module property. Providing PS & PL module is optional.

  AMS Channel Details
  ```````````````````
  Sysmon Block  |Channel|                       Details                                 |Measurement
                |Number |                                                               |Type
  ---------------------------------------------------------------------------------------------------------
  AMS CTRL      |0      |System PLLs voltage measurement, VCC_PSPLL.                    |Voltage
                |1      |Battery voltage measurement, VCC_PSBATT.                       |Voltage
                |2      |PL Internal voltage measurement, VCCINT.                       |Voltage
                |3      |Block RAM voltage measurement, VCCBRAM.                        |Voltage
                |4      |PL Aux voltage measurement, VCCAUX.                            |Voltage
                |5      |Voltage measurement for six DDR I/O PLLs, VCC_PSDDR_PLL.       |Voltage
                |6      |VCC_PSINTFP_DDR voltage measurement.                           |Voltage
  ---------------------------------------------------------------------------------------------------------
  PS Sysmon     |7      |LPD temperature measurement.                                   |Temperature
                |8      |FPD temperature measurement (REMOTE).                          |Temperature
                |9      |VCC PS LPD voltage measurement (supply1).                      |Voltage
                |10     |VCC PS FPD voltage measurement (supply2).                      |Voltage
                |11     |PS Aux voltage reference (supply3).                            |Voltage
                |12     |DDR I/O VCC voltage measurement.                               |Voltage
                |13     |PS IO Bank 503 voltage measurement (supply5).                  |Voltage
                |14     |PS IO Bank 500 voltage measurement (supply6).                  |Voltage
                |15     |VCCO_PSIO1 voltage measurement.                                |Voltage
                |16     |VCCO_PSIO2 voltage measurement.                                |Voltage
                |17     |VCC_PS_GTR voltage measurement (VPS_MGTRAVCC).                 |Voltage
                |18     |VTT_PS_GTR voltage measurement (VPS_MGTRAVTT).                 |Voltage
                |19     |VCC_PSADC voltage measurement.                                 |Voltage
  ---------------------------------------------------------------------------------------------------------
  PL Sysmon     |20     |PL temperature measurement.                                    |Temperature
                |21     |PL Internal voltage measurement, VCCINT.                       |Voltage
                |22     |PL Auxiliary voltage measurement, VCCAUX.                      |Voltage
                |23     |ADC Reference P+ voltage measurement.                          |Voltage
                |24     |ADC Reference N- voltage measurement.                          |Voltage
                |25     |PL Block RAM voltage measurement, VCCBRAM.                     |Voltage
                |26     |LPD Internal voltage measurement, VCC_PSINTLP (supply4).       |Voltage
                |27     |FPD Internal voltage measurement, VCC_PSINTFP (supply5).       |Voltage
                |28     |PS Auxiliary voltage measurement (supply6).                    |Voltage
                |29     |PL VCCADC voltage measurement (vccams).                        |Voltage
                |30     |Differential analog input signal voltage measurment.           |Voltage
                |31     |VUser0 voltage measurement (supply7).                          |Voltage
                |32     |VUser1 voltage measurement (supply8).                          |Voltage
                |33     |VUser2 voltage measurement (supply9).                          |Voltage
                |34     |VUser3 voltage measurement (supply10).                         |Voltage
                |35     |Auxiliary ch 0 voltage measurement (VAux0).                    |Voltage
                |36     |Auxiliary ch 1 voltage measurement (VAux1).                    |Voltage
                |37     |Auxiliary ch 2 voltage measurement (VAux2).                    |Voltage
                |38     |Auxiliary ch 3 voltage measurement (VAux3).                    |Voltage
                |39     |Auxiliary ch 4 voltage measurement (VAux4).                    |Voltage
                |40     |Auxiliary ch 5 voltage measurement (VAux5).                    |Voltage
                |41     |Auxiliary ch 6 voltage measurement (VAux6).                    |Voltage
                |42     |Auxiliary ch 7 voltage measurement (VAux7).                    |Voltage
                |43     |Auxiliary ch 8 voltage measurement (VAux8).                    |Voltage
                |44     |Auxiliary ch 9 voltage measurement (VAux9).                    |Voltage
                |45     |Auxiliary ch 10 voltage measurement (VAux10).                  |Voltage
                |46     |Auxiliary ch 11 voltage measurement (VAux11).                  |Voltage
                |47     |Auxiliary ch 12 voltage measurement (VAux12).                  |Voltage
                |48     |Auxiliary ch 13 voltage measurement (VAux13).                  |Voltage
                |49     |Auxiliary ch 14 voltage measurement (VAux14).                  |Voltage
                |50     |Auxiliary ch 15 voltage measurement (VAux15).                  |Voltage
  --------------------------------------------------------------------------------------------------------

properties:
  compatible:
    enum:
      - xlnx,zynqmp-ams

  interrupts:
    maxItems: 1

  reg:
    description: AMS Controller register space
    maxItems: 1

  ranges:
    description:
      Maps the child address space for PS and/or PL.
    maxItems: 1

  '#address-cells':
    const: 1

  '#size-cells':
    const: 1

  '#io-channel-cells':
    const: 1

  ams-ps@0:
    type: object
    description: |
      PS (Processing System) SYSMON is memory mapped to PS. This block has
      built-in alarm generation logic that is used to interrupt the processor
      based on condition set.

    properties:
      compatible:
        enum:
          - xlnx,zynqmp-ams-ps

      reg:
        description: Register Space for PS-SYSMON
        maxItems: 1

    required:
      - compatible
      - reg

    additionalProperties: false

  ams-pl@400:
    type: object
    description:
      PL-SYSMON is capable of monitoring off chip voltage and temperature.
      PL-SYSMON block has DRP, JTAG and I2C interface to enable monitoring
      from external master. Out of this interface currently only DRP is
      supported. This block has alarm generation logic that is used to
      interrupt the processor based on condition set.

    properties:
      compatible:
        items:
          - enum:
              - xlnx,zynqmp-ams-pl

      reg:
        description: Register Space for PL-SYSMON.
        maxItems: 1

      '#address-cells':
        const: 1

      '#size-cells':
        const: 0

    patternProperties:
      "^channel@([2-4][0-9]|50)$":
        type: object
        description:
          Describes the external channels connected.

        properties:
          reg:
            description:
              Pair of pins the channel is connected to. This value is
              same as Channel Number for a particular channel.
            minimum: 20
            maximum: 50

          xlnx,bipolar:
            $ref: /schemas/types.yaml#/definitions/flag
            type: boolean
            description:
              If the set channel is used in bipolar mode.

        required:
          - reg

        additionalProperties: false

required:
  - compatible
  - reg
  - ranges

additionalProperties: false

examples:
  - |
    bus {
        #address-cells = <2>;
        #size-cells = <2>;

        xilinx_ams: ams@ffa50000 {
            compatible = "xlnx,zynqmp-ams";
            interrupt-parent = <&gic>;
            interrupts = <0 56 4>;
            reg = <0x0 0xffa50000 0x0 0x800>;
            #address-cells = <1>;
            #size-cells = <1>;
            #io-channel-cells = <1>;
            ranges = <0 0 0xffa50800 0x800>;

            ams_ps: ams-ps@0 {
                compatible = "xlnx,zynqmp-ams-ps";
                reg = <0 0x400>;
            };

            ams_pl: ams-pl@400 {
                compatible = "xlnx,zynqmp-ams-pl";
                reg = <0x400 0x400>;
                #address-cells = <1>;
                #size-cells = <0>;
                channel@30 {
                    reg = <30>;
                    xlnx,bipolar;
                };
                channel@31 {
                    reg = <31>;
                };
                channel@38 {
                    reg = <38>;
                    xlnx,bipolar;
                };
            };
        };
    };
+158 −0
Original line number Original line Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/addac/adi,ad74413r.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices AD74412R/AD74413R device

maintainers:
  - Cosmin Tanislav <cosmin.tanislav@analog.com>

description: |
  The AD74412R and AD74413R are quad-channel software configurable input/output
  solutions for building and process control applications. They contain
  functionality for analog output, analog input, digital input, resistance
  temperature detector, and thermocouple measurements integrated
  into a single chip solution with an SPI interface.
  The devices feature a 16-bit ADC and four configurable 13-bit DACs to provide
  four configurable input/output channels and a suite of diagnostic functions.
  The AD74413R differentiates itself from the AD74412R by being HART-compatible.
    https://www.analog.com/en/products/ad74412r.html
    https://www.analog.com/en/products/ad74413r.html

properties:
  compatible:
    enum:
      - adi,ad74412r
      - adi,ad74413r

  reg:
    maxItems: 1

  '#address-cells':
    const: 1

  '#size-cells':
    const: 0

  spi-max-frequency:
    maximum: 1000000

  spi-cpol: true

  interrupts:
    maxItems: 1

  refin-supply: true

  shunt-resistor-micro-ohms:
    description:
      Shunt (sense) resistor value in micro-Ohms.
    default: 100000000

required:
  - compatible
  - reg
  - spi-max-frequency
  - spi-cpol
  - refin-supply

additionalProperties: false

patternProperties:
  "^channel@[0-3]$":
    type: object
    description: Represents the external channels which are connected to the device.

    properties:
      reg:
        description: |
          The channel number. It can have up to 4 channels numbered from 0 to 3.
        minimum: 0
        maximum: 3

      adi,ch-func:
        $ref: /schemas/types.yaml#/definitions/uint32
        description: |
          Channel function.
          HART functions are not supported on AD74412R.
          0 - CH_FUNC_HIGH_IMPEDANCE
          1 - CH_FUNC_VOLTAGE_OUTPUT
          2 - CH_FUNC_CURRENT_OUTPUT
          3 - CH_FUNC_VOLTAGE_INPUT
          4 - CH_FUNC_CURRENT_INPUT_EXT_POWER
          5 - CH_FUNC_CURRENT_INPUT_LOOP_POWER
          6 - CH_FUNC_RESISTANCE_INPUT
          7 - CH_FUNC_DIGITAL_INPUT_LOGIC
          8 - CH_FUNC_DIGITAL_INPUT_LOOP_POWER
          9 - CH_FUNC_CURRENT_INPUT_EXT_POWER_HART
          10 - CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART
        minimum: 0
        maximum: 10
        default: 0

      adi,gpo-comparator:
        type: boolean
        description: |
          Whether to configure GPO as a comparator or not.
          When not configured as a comparator, the GPO will be treated as an
          output-only GPIO.

    required:
      - reg

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/iio/addac/adi,ad74413r.h>

    spi {
      #address-cells = <1>;
      #size-cells = <0>;

      cs-gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
      status = "okay";

      ad74413r@0 {
        compatible = "adi,ad74413r";
        reg = <0>;
        spi-max-frequency = <1000000>;
        spi-cpol;

        #address-cells = <1>;
        #size-cells = <0>;

        interrupt-parent = <&gpio>;
        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;

        refin-supply = <&ad74413r_refin>;

        channel@0 {
          reg = <0>;

          adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
        };

        channel@1 {
          reg = <1>;

          adi,ch-func = <CH_FUNC_CURRENT_OUTPUT>;
        };

        channel@2 {
          reg = <2>;

          adi,ch-func = <CH_FUNC_DIGITAL_INPUT_LOGIC>;
          adi,gpo-comparator;
        };

        channel@3 {
          reg = <3>;

          adi,ch-func = <CH_FUNC_CURRENT_INPUT_EXT_POWER>;
        };
      };
    };
...
+217 −0
Original line number Original line Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
# Copyright 2020 Analog Devices Inc.
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/dac/adi,ad3552r.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices AD2552R DAC device driver

maintainers:
  - Mihail Chindris <mihail.chindris@analog.com>

description: |
  Bindings for the Analog Devices AD3552R DAC device and similar.
  Datasheet can be found here:
    https://www.analog.com/media/en/technical-documentation/data-sheets/ad3542r.pdf
    https://www.analog.com/media/en/technical-documentation/data-sheets/ad3552r.pdf

properties:
  compatible:
    enum:
      - adi,ad3542r
      - adi,ad3552r

  reg:
    maxItems: 1

  spi-max-frequency:
    maximum: 30000000

  reset-gpios:
    maxItems: 1

  ldac-gpios:
    description: |
      LDAC pin to be used as a hardware trigger to update the DAC channels.
    maxItems: 1

  vref-supply:
    description:
      The regulator to use as an external reference. If it does not exists the
      internal reference will be used. External reference must be 2.5V

  adi,vref-out-en:
    description: Vref I/O driven by internal vref to 2.5V. If not set, Vref pin
      will be floating.
    type: boolean

  adi,sdo-drive-strength:
    description: |
      Configure SDIO0 and SDIO1 strength levels:
        - 0: low SDO drive strength.
        - 1: medium low SDO drive strength.
        - 2: medium high SDO drive strength.
        - 3: high SDO drive strength
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [0, 1, 2, 3]

  '#address-cells':
    const: 1

  '#size-cells':
    const: 0

patternProperties:
  "^channel@([0-1])$":
    type: object
    description: Configurations of the DAC Channels

    additionalProperties: false

    properties:
      reg:
        description: Channel number
        enum: [0, 1]

      adi,output-range-microvolt: true

      custom-output-range-config:
        type: object
        description: Configuration of custom range when
          adi,output-range-microvolt is not present.
          The formulas for calculation the output voltages are
            Vout_fs = 2.5 + [(GainN + Offset/1024) * 2.5 * Rfbx * 1.03]
            Vout_zs = 2.5 - [(GainP + Offset/1024) * 2.5 * Rfbx * 1.03]

        properties:
          adi,gain-offset:
            description: Gain offset used in the above formula
            $ref: /schemas/types.yaml#/definitions/int32
            maximum: 511
            minimum: -511

          adi,gain-scaling-p-inv-log2:
            description: GainP = 1 / ( 2 ^ adi,gain-scaling-p-inv-log2)
            $ref: /schemas/types.yaml#/definitions/uint32
            enum: [0, 1, 2, 3]

          adi,gain-scaling-n-inv-log2:
            description: GainN = 1 / ( 2 ^ adi,gain-scaling-n-inv-log2)
            $ref: /schemas/types.yaml#/definitions/uint32
            enum: [0, 1, 2, 3]

          adi,rfb-ohms:
            description: Feedback Resistor

        required:
          - adi,gain-offset
          - adi,gain-scaling-p-inv-log2
          - adi,gain-scaling-n-inv-log2
          - adi,rfb-ohms

    required:
      - reg

    oneOf:
      # If adi,output-range-microvolt is missing,
      # custom-output-range-config must be used
      - required:
          - adi,output-range-microvolt

      - required:
          - custom-output-range-config

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: adi,ad3542r
    then:
      patternProperties:
        "^channel@([0-1])$":
          type: object
          properties:
            adi,output-range-microvolt:
              description: |
                Voltage output range of the channel as <minimum, maximum>
                Required connections:
                  Rfb1x for: 0 to 2.5 V; 0 to 3V; 0 to 5 V;
                  Rfb2x for: 0 to 10 V; 2.5 to 7.5V; -5 to 5 V;
              oneOf:
                - items:
                    - const: 0
                    - enum: [2500000, 3000000, 5000000, 10000000]
                - items:
                    - const: -2500000
                    - const: 7500000
                - items:
                    - const: -5000000
                    - const: 5000000

          required:
            - adi,output-range-microvolt

  - if:
      properties:
        compatible:
          contains:
            const: adi,ad3552r
    then:
      patternProperties:
        "^channel@([0-1])$":
          type: object
          properties:
            adi,output-range-microvolt:
              description: |
                Voltage output range of the channel as <minimum, maximum>
                Required connections:
                  Rfb1x for: 0 to 2.5 V; 0 to 5 V;
                  Rfb2x for: 0 to 10 V; -5 to 5 V;
                  Rfb4x for: -10 to 10V
              oneOf:
                - items:
                    - const: 0
                    - enum: [2500000, 5000000, 10000000]
                - items:
                    - const: -5000000
                    - const: 5000000
                - items:
                    - const: -10000000
                    - const: 10000000

required:
  - compatible
  - reg
  - spi-max-frequency

additionalProperties: false

examples:
  - |
    spi {
      #address-cells = <1>;
      #size-cells = <0>;
      ad3552r@0 {
              compatible = "adi,ad3552r";
              reg = <0>;
              spi-max-frequency = <20000000>;
              #address-cells = <1>;
              #size-cells = <0>;
              channel@0 {
                      reg = <0>;
                      adi,output-range-microvolt = <0 10000000>;
              };
              channel@1 {
                      reg = <1>;
                      custom-output-range-config {
                              adi,gain-offset = <5>;
                              adi,gain-scaling-p-inv-log2 = <1>;
                              adi,gain-scaling-n-inv-log2 = <2>;
                              adi,rfb-ohms = <1>;
                      };
            };
        };
    };
...
Loading