# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/avia-hx711.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: AVIA HX711 ADC chip for weight cells

maintainers:
  - Andreas Klinger <ak@it-klinger.de>

description: |
  The HX711 is a 24-bit ADC with selectable gain (32/64/128) and two
  differential input channels. Channel A supports gain 64 and 128;
  channel B supports gain 32.

properties:
  compatible:
    enum:
      - avia,hx711

  sck-gpios:
    description:
      GPIO for the clock output (PD_SCK in the datasheet).
    maxItems: 1

  dout-gpios:
    description:
      GPIO for the data output from the sensor (DOUT in the datasheet).
    maxItems: 1

  avdd-supply:
    description:
      Analog supply voltage (AVDD).

  vsup-supply:
    description:
      Supply voltage for the on-chip regulator (VSUP).

  dvdd-supply:
    description:
      Digital supply voltage (DVDD). On the HX711, DVDD is a
      board-supplied digital rail; it was missing from the original
      binding. On the HX710B, DVDD must be greater than or equal to
      AVDD; when DVDD is a battery rail and AVDD is a regulated supply,
      one channel monitors the DVDD-AVDD difference for battery level
      detection.

  rate-gpios:
    description:
      GPIO connected to the RATE pin. When driven low the output data
      rate is 10 SPS; when driven high it is 80 SPS. If omitted the
      RATE pin state is determined by the board wiring.
    maxItems: 1

  clock-frequency:
    description:
      Controls the SCK bit-bang timing. The value is used to derive the
      delay between SCK edges; keep the SCK high time below 60 us to
      avoid triggering chip power-down mode.
    minimum: 20000
    maximum: 2500000
    default: 400000

required:
  - compatible
  - sck-gpios
  - dout-gpios
  - avdd-supply

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    weight {
        compatible = "avia,hx711";
        sck-gpios = <&gpio3 10 GPIO_ACTIVE_HIGH>;
        dout-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
        rate-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
        avdd-supply = <&avdd>;
        clock-frequency = <100000>;
    };