# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/dac/adi,ad5696.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices AD5696 and similar I2C multi-channel DACs

maintainers:
  - Michael Auchter <michael.auchter@ni.com>

description: |
  Binding for Analog Devices AD5696 and similar multi-channel DACs

properties:
  compatible:
    enum:
      - adi,ad5311r
      - adi,ad5316r
      - adi,ad5337r
      - adi,ad5338r
      - adi,ad5671r
      - adi,ad5673r
      - adi,ad5675
      - adi,ad5675r
      - adi,ad5677r
      - adi,ad5691r
      - adi,ad5692r
      - adi,ad5693
      - adi,ad5693r
      - adi,ad5694
      - adi,ad5694r
      - adi,ad5695r
      - adi,ad5696
      - adi,ad5696r
      - adi,ad5697r

  reg:
    maxItems: 1

  vdd-supply:
    description: Input power supply.

  vlogic-supply:
    description:
      Digital power supply. On some tiny package variants for single-channel
      devices, this supply is internally connected to vdd; in that case, specify
      this property with the same regulator as vdd.

  vref-supply:
    description:
      Reference voltage supply. If not supplied the internal reference is used.

  vcc-supply:
    deprecated: true
    description: Use vref-supply instead.

  reset-gpios:
    description: Active-low RESET pin to reset the device.
    maxItems: 1

  ldac-gpios:
    description:
      Active-low LDAC pin used to asynchronously update the DAC channels.
    maxItems: 1

  gain-gpios:
    description:
      GAIN pin that sets a multiplier for the DAC output voltage. When high,
      the DAC output voltage is multiplied by 2, otherwise it is unchanged.
    maxItems: 1

  adi,range-double:
    description:
      Sets the initial voltage output range from 0 to 2xVREF. On devices that
      have a GAIN pin and no gain-gpios property is set, this indicates the pin
      is hardwired high.
    type: boolean

required:
  - compatible
  - reg
  - vdd-supply
  - vlogic-supply

allOf:
  - if:
      properties:
        compatible:
          contains:
            enum:
              - adi,ad5675
              - adi,ad5693
              - adi,ad5694
              - adi,ad5696
    then:
      required:
        - vref-supply
  - if:
      properties:
        compatible:
          contains:
            enum:
              - adi,ad5311r
              - adi,ad5691r
              - adi,ad5692r
              - adi,ad5693
              - adi,ad5693r
    then:
      properties:
        gain-gpios: false

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;

      ad5696: dac@0 {
        compatible = "adi,ad5696";
        reg = <0>;
        vdd-supply = <&dac_vdd>;
        vlogic-supply = <&dac_vlogic>;
        vref-supply = <&dac_vref>;
        ldac-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
      };
    };
...