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

title: Qualcomm Audio Stream Manager (Q6ASM)

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

description:
  Q6ASM is one of the APR audio services on Q6DSP. Each of its subnodes
  represent a dai with board specific configuration.

properties:
  compatible:
    enum:
      - qcom,q6asm-dais

  iommus:
    maxItems: 1

  "#sound-dai-cells":
    const: 1

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

patternProperties:
  "^dai@[0-9]+$":
    type: object
    description:
      Q6ASM Digital Audio Interface

    properties:
      reg:
        maxItems: 1

      direction:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1, 2]
        description: |
          The direction of the dai stream::
           - Q6ASM_DAI_TX_RX (0) for both tx and rx
           - Q6ASM_DAI_TX (1) for only tx (Capture/Encode)
           - Q6ASM_DAI_RX (2) for only rx (Playback/Decode)

      is-compress-dai:
        type: boolean
        description:
          Compress offload dai.

    dependencies:
      is-compress-dai: ["direction"]

    required:
      - reg

    additionalProperties: false

required:
  - compatible
  - "#sound-dai-cells"
  - "#address-cells"
  - "#size-cells"

additionalProperties: false

examples:
  - |
    #include <dt-bindings/soc/qcom,apr.h>
    #include <dt-bindings/sound/qcom,q6asm.h>

    apr {
        compatible = "qcom,apr-v2";
        qcom,domain = <APR_DOMAIN_ADSP>;
        #address-cells = <1>;
        #size-cells = <0>;

        service@7 {
            compatible = "qcom,q6asm";
            reg = <APR_SVC_ASM>;
            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";

            dais {
                compatible = "qcom,q6asm-dais";
                iommus = <&apps_smmu 0x1821 0x0>;
                #address-cells = <1>;
                #size-cells = <0>;
                #sound-dai-cells = <1>;

                dai@0 {
                    reg = <0>;
                };

                dai@1 {
                    reg = <1>;
                };

                dai@2 {
                    reg = <2>;
                    is-compress-dai;
                    direction = <1>;
                };
            };
        };
    };
