# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/slimbus/qcom,slim-ngd.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm SoC SLIMBus Non Generic Device (NGD) Controller

maintainers:
  - Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description:
  SLIMBus NGD controller is a light-weight driver responsible for communicating
  with SLIMBus slaves directly over the bus using messaging interface and
  communicating with master component residing on ADSP for bandwidth and
  data-channel management

properties:
  compatible:
    enum:
      - qcom,slim-ngd-v1.5.0        # for MSM8996
      - qcom,slim-ngd-v2.1.0        # for SDM845

  reg:
    maxItems: 1

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

  dmas:
    maxItems: 2

  dma-names:
    items:
      - const: rx
      - const: tx

  interrupts:
    maxItems: 1

  iommus:
    maxItems: 1

patternProperties:
  "^slim@[0-9a-f]+$":
    type: object
    $ref: slimbus.yaml#
    description:
      Each subnode represents an instance of NGD

    properties:
      reg:
        maxItems: 1

    unevaluatedProperties: false

required:
  - compatible
  - reg
  - "#address-cells"
  - "#size-cells"
  - dmas
  - dma-names
  - interrupts

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>

    slim-ngd@171c0000 {
        compatible = "qcom,slim-ngd-v2.1.0";
        reg = <0x171c0000 0x2c000>;
        interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>;

        dmas = <&slimbam 3>, <&slimbam 4>;
        dma-names = "rx", "tx";
        iommus = <&apps_smmu 0x1806 0x0>;
        #address-cells = <1>;
        #size-cells = <0>;

        slim@1 {
            reg = <1>;
            #address-cells = <2>;
            #size-cells = <0>;

            codec@1,0 {
                compatible = "slim217,250";
                reg = <1 0>;
                slim-ifc-dev = <&wcd9340_ifd>;

                #sound-dai-cells = <1>;

                interrupts-extended = <&tlmm 54 IRQ_TYPE_LEVEL_HIGH>;
                interrupt-controller;
                #interrupt-cells = <1>;

                #clock-cells = <0>;
                clock-frequency = <9600000>;
                clock-output-names = "mclk";
                qcom,micbias1-microvolt = <1800000>;
                qcom,micbias2-microvolt = <1800000>;
                qcom,micbias3-microvolt = <1800000>;
                qcom,micbias4-microvolt = <1800000>;

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

                reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;

                /* Rest of the WCD9340 codec */
            };
        };
    };