code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/qcom,lpass-rx-macro.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LPASS(Low Power Audio Subsystem) RX Macro audio codec DT bindings

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - qcom,sc7280-lpass-rx-macro
      - qcom,sm8250-lpass-rx-macro
      - qcom,sm8450-lpass-rx-macro
      - qcom,sc8280xp-lpass-rx-macro

  reg:
    maxItems: 1

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

  '#clock-cells':
    const: 0

  clocks:
    maxItems: 5

  clock-names:
    oneOf:
      - items:   #for ADSP based platforms
          - const: mclk
          - const: npl
          - const: macro
          - const: dcodec
          - const: fsgen
      - items:   #for ADSP bypass based platforms
          - const: mclk
          - const: npl
          - const: fsgen

  clock-output-names:
    maxItems: 1

  power-domains:
    maxItems: 2

  power-domain-names:
    items:
      - const: macro
      - const: dcodec

required:
  - compatible
  - reg
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/sound/qcom,q6afe.h>
    codec@3200000 {
      compatible = "qcom,sm8250-lpass-rx-macro";
      reg = <0x3200000 0x1000>;
      #sound-dai-cells = <1>;
      #clock-cells = <0>;
      clocks = <&audiocc 0>,
               <&audiocc 1>,
               <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
               <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
               <&vamacro>;
      clock-names = "mclk", "npl", "macro", "dcodec", "fsgen";
      clock-output-names = "mclk";
    };


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/qcom,lpass-tx-macro.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LPASS(Low Power Audio Subsystem) TX Macro audio codec DT bindings

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - qcom,sc7280-lpass-tx-macro
      - qcom,sm8250-lpass-tx-macro
      - qcom,sm8450-lpass-tx-macro
      - qcom,sc8280xp-lpass-tx-macro

  reg:
    maxItems: 1

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

  '#clock-cells':
    const: 0

  clocks:
    maxItems: 5

  clock-names:
    oneOf:
      - items:   #for ADSP based platforms
          - const: mclk
          - const: npl
          - const: macro
          - const: dcodec
          - const: fsgen
      - items:   #for ADSP bypass based platforms
          - const: mclk
          - const: npl
          - const: fsgen

  clock-output-names:
    maxItems: 1

  power-domains:
    maxItems: 2

  power-domain-names:
    items:
      - const: macro
      - const: dcodec

  qcom,dmic-sample-rate:
    description: dmic sample rate
    $ref: /schemas/types.yaml#/definitions/uint32

required:
  - compatible
  - reg
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/sound/qcom,q6afe.h>
    codec@3220000 {
      compatible = "qcom,sm8250-lpass-tx-macro";
      reg = <0x3220000 0x1000>;
      #sound-dai-cells = <1>;
      #clock-cells = <0>;
      clocks = <&aoncc 0>,
               <&aoncc 1>,
               <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
               <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
               <&vamacro>;
      clock-names = "mclk", "npl", "macro", "dcodec", "fsgen";
      clock-output-names = "mclk";
      qcom,dmic-sample-rate = <600000>;
    };

repo_name: angery/linux


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/qcom,lpass-va-macro.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LPASS(Low Power Audio Subsystem) VA Macro audio codec DT bindings

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - qcom,sc7280-lpass-va-macro
      - qcom,sm8250-lpass-va-macro
      - qcom,sm8450-lpass-va-macro
      - qcom,sc8280xp-lpass-va-macro

  reg:
    maxItems: 1

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

  '#clock-cells':
    const: 0

  clocks:
    maxItems: 3

  clock-names:
    oneOf:
      - items:   #for ADSP based platforms
          - const: mclk
          - const: core
          - const: dcodec
      - items:   #for ADSP bypass based platforms
          - const: mclk

  clock-output-names:
    maxItems: 1

  power-domains:
    maxItems: 2

  power-domain-names:
    items:
      - const: macro
      - const: dcodec

  qcom,dmic-sample-rate:
    description: dmic sample rate
    $ref: /schemas/types.yaml#/definitions/uint32

  vdd-micb-supply:
    description: phandle to voltage regulator of MIC Bias

required:
  - compatible
  - reg
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/sound/qcom,q6afe.h>
    codec@3370000 {
      compatible = "qcom,sm8250-lpass-va-macro";
      reg = <0x3370000 0x1000>;
      #sound-dai-cells = <1>;
      #clock-cells = <0>;
      clocks = <&aoncc 0>,
               <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
               <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
      clock-names = "mclk", "core", "dcodec";
      clock-output-names = "fsgen";
      qcom,dmic-sample-rate = <600000>;
      vdd-micb-supply = <&vreg_s4a_1p8>;
    };


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/qcom,lpass-wsa-macro.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LPASS(Low Power Audio Subsystem) VA Macro audio codec DT bindings

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - qcom,sc7280-lpass-wsa-macro
      - qcom,sm8250-lpass-wsa-macro
      - qcom,sm8450-lpass-wsa-macro
      - qcom,sc8280xp-lpass-wsa-macro

  reg:
    maxItems: 1

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

  '#clock-cells':
    const: 0

  clocks:
    maxItems: 5

  clock-names:
    items:
      - const: mclk
      - const: npl
      - const: macro
      - const: dcodec
      - const: fsgen

  clock-output-names:
    maxItems: 1

  qcom,dmic-sample-rate:
    description: dmic sample rate
    $ref: /schemas/types.yaml#/definitions/uint32

  vdd-micb-supply:
    description: phandle to voltage regulator of MIC Bias

required:
  - compatible
  - reg
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/sound/qcom,q6afe.h>
    codec@3240000 {
      compatible = "qcom,sm8250-lpass-wsa-macro";
      reg = <0x3240000 0x1000>;
      #sound-dai-cells = <1>;
      #clock-cells = <0>;
      clocks = <&audiocc 1>,
               <&audiocc 0>,
               <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
               <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
               <&vamacro>;
      clock-names = "mclk", "npl", "macro", "dcodec", "fsgen";
      clock-output-names = "mclk";
    };


code:
msm8916 analog audio CODEC

Bindings for codec Analog IP which is integrated in pmic pm8916,

## Bindings for codec core on pmic:

Required properties
 - compatible = "qcom,pm8916-wcd-analog-codec";
 - reg: represents the slave base address provided to the peripheral.
 - interrupts: List of interrupts in given SPMI peripheral.
 - interrupt-names: Names specified to above list of interrupts in same
		    order. List of supported interrupt names are:
  "cdc_spk_cnp_int" - Speaker click and pop interrupt.
  "cdc_spk_clip_int" - Speaker clip interrupt.
  "cdc_spk_ocp_int" - Speaker over current protect interrupt.
  "mbhc_ins_rem_det1" - jack insert removal detect interrupt 1.
  "mbhc_but_rel_det" - button release interrupt.
  "mbhc_but_press_det" - button press event
  "mbhc_ins_rem_det" - jack insert removal detect interrupt.
  "mbhc_switch_int"	- multi button headset interrupt.
  "cdc_ear_ocp_int" - Earphone over current protect interrupt.
  "cdc_hphr_ocp_int" - Headphone R over current protect interrupt.
  "cdc_hphl_ocp_det" - Headphone L over current protect interrupt.
  "cdc_ear_cnp_int" - earphone cnp interrupt.
  "cdc_hphr_cnp_int" - hphr click and pop interrupt.
  "cdc_hphl_cnp_int" - hphl click and pop interrupt.

 - clocks: Handle to mclk.
 - clock-names: should be "mclk"
 - vdd-cdc-io-supply: phandle to VDD_CDC_IO regulator DT node.
 - vdd-cdc-tx-rx-cx-supply: phandle to VDD_CDC_TX/RX/CX regulator DT node.
 - vdd-micbias-supply: phandle of VDD_MICBIAS supply's regulator DT node.

Optional Properties:
 - qcom,mbhc-vthreshold-low: Array of 5 threshold voltages in mV for 5 buttons
			     detection on headset when the mbhc is powered up
			     by internal current source, this is a low power.
 - qcom,mbhc-vthreshold-high: Array of 5 thresold voltages in mV for 5 buttons
			      detection on headset when mbhc is powered up
			       from micbias.
- qcom,micbias-lvl:  Voltage (mV) for Mic Bias
- qcom,hphl-jack-type-normally-open: boolean, present if hphl pin on jack is a
				     NO (Normally Open). If not specified, then
				     its assumed that hphl pin on jack is NC
				     (Normally Closed).
- qcom,gnd-jack-type-normally-open: boolean, present if gnd pin on jack is
				    NO (Normally Open). If not specified, then
				    its assumed that gnd pin on jack is NC
				    (Normally Closed).
- qcom,micbias1-ext-cap: boolean, present if micbias1 has external capacitor
			 connected.
- qcom,micbias2-ext-cap: boolean, present if micbias2 has external capacitor
			 connected.

Example:

spmi_bus {
	...
	audio-codec@f000{
		compatible = "qcom,pm8916-wcd-analog-codec";
		reg = <0xf000 0x200>;
		reg-names = "pmic-codec-core";
		clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>;
		clock-names = "mclk";
		qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
		qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
		interrupt-parent = <&spmi_bus>;
		interrupts = <0x1 0xf0 0x0 IRQ_TYPE_NONE>,
			     <0x1 0xf0 0x1 IRQ_TYPE_NONE>,
			     <0x1 0xf0 0x2 IRQ_TYPE_NONE>,
			     <0x1 0xf0 0x3 IRQ_TYPE_NONE>,
			     <0x1 0xf0 0x4 IRQ_TYPE_NONE>,
			     <0x1 0xf0 0x5 IRQ_TYPE_NONE>,
			     <0x1 0xf0 0x6 IRQ_TYPE_NONE>,
			     <0x1 0xf0 0x7 IRQ_TYPE_NONE>,
			     <0x1 0xf1 0x0 IRQ_TYPE_NONE>,
			     <0x1 0xf1 0x1 IRQ_TYPE_NONE>,
			     <0x1 0xf1 0x2 IRQ_TYPE_NONE>,
			     <0x1 0xf1 0x3 IRQ_TYPE_NONE>,
			     <0x1 0xf1 0x4 IRQ_TYPE_NONE>,
			     <0x1 0xf1 0x5 IRQ_TYPE_NONE>;
		interrupt-names = "cdc_spk_cnp_int",
				  "cdc_spk_clip_int",
				  "cdc_spk_ocp_int",
				  "mbhc_ins_rem_det1",
				  "mbhc_but_rel_det",
				  "mbhc_but_press_det",
				  "mbhc_ins_rem_det",
				  "mbhc_switch_int",
				  "cdc_ear_ocp_int",
				  "cdc_hphr_ocp_int",
				  "cdc_hphl_ocp_det",
				  "cdc_ear_cnp_int",
				  "cdc_hphr_cnp_int",
				  "cdc_hphl_cnp_int";
	               vdd-cdc-io-supply = <&pm8916_l5>;
	               vdd-cdc-tx-rx-cx-supply = <&pm8916_l5>;
	               vdd-micbias-supply = <&pm8916_l13>;
	               #sound-dai-cells = <1>;
	};
};


code:
msm8916 digital audio CODEC

## Bindings for codec core in lpass:

Required properties
 - compatible = "qcom,msm8916-wcd-digital-codec";
 - reg: address space for lpass codec.
 - clocks: Handle to mclk and ahbclk
 - clock-names: should be "mclk", "ahbix-clk".

Example:

audio-codec@771c000{
	compatible = "qcom,msm8916-wcd-digital-codec";
	reg = <0x0771c000 0x400>;
	clocks = <&gcc GCC_ULTAUDIO_AHBFABRIC_IXFABRIC_CLK>,
		 <&gcc GCC_CODEC_DIGCODEC_CLK>;
	clock-names = "ahbix-clk", "mclk";
	#sound-dai-cells = <1>;
};


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

title: Qualcomm Audio Device Manager (Q6ADM) routing

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

description:
  Qualcomm Audio Device Manager (Q6ADM) routing node represents routing
  specific configuration.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - qcom,q6adm-routing

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

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

unevaluatedProperties: false

examples:
  - |
    routing {
        compatible = "qcom,q6adm-routing";
        #sound-dai-cells = <0>;
    };


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

title: Qualcomm Audio Device Manager (Q6ADM)

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

allOf:
  - $ref: /schemas/soc/qcom/qcom,apr-services.yaml#

properties:
  compatible:
    enum:
      - qcom,q6adm

  routing:
    type: object
    $ref: /schemas/sound/qcom,q6adm-routing.yaml#
    unevaluatedProperties: false
    description: Qualcomm DSP LPASS audio routing

required:
  - compatible
  - routing

unevaluatedProperties: false

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

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

        service@8 {
            compatible = "qcom,q6adm";
            reg = <APR_SVC_ADM>;
            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";

            routing {
                compatible = "qcom,q6adm-routing";
                #sound-dai-cells = <0>;
            };
        };
    };


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

title: Qualcomm Audio FrontEnd (Q6AFE)

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

allOf:
  - $ref: /schemas/soc/qcom/qcom,apr-services.yaml#

properties:
  compatible:
    enum:
      - qcom,q6afe

  clock-controller:
    $ref: /schemas/sound/qcom,q6dsp-lpass-clocks.yaml#
    unevaluatedProperties: false
    description: Qualcomm DSP LPASS clock controller

  dais:
    type: object
    $ref: /schemas/sound/qcom,q6dsp-lpass-ports.yaml#
    unevaluatedProperties: false
    description: Qualcomm DSP audio ports

required:
  - compatible
  - dais

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/soc/qcom,apr.h>
    #include <dt-bindings/sound/qcom,q6afe.h>
    apr {
        #address-cells = <1>;
        #size-cells = <0>;

        service@4 {
            compatible = "qcom,q6afe";
            reg = <APR_SVC_AFE>;
            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";

            clock-controller {
                compatible = "qcom,q6afe-clocks";
                #clock-cells = <2>;
            };

            dais {
                compatible = "qcom,q6afe-dais";
                #address-cells = <1>;
                #size-cells = <0>;
                #sound-dai-cells = <1>;

                dai@22 {
                    reg = <QUATERNARY_MI2S_RX>;
                    qcom,sd-lines = <0 1 2 3>;
                };
            };
        };
    };


code:
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: "http://devicetree.org/schemas/sound/qcom,q6apm-dai.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"

title: Qualcomm Audio Process Manager Digital Audio Interfaces binding

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  This binding describes the Qualcomm APM DAIs in DSP

properties:
  compatible:
    const: qcom,q6apm-dais

  iommus:
    maxItems: 1

required:
  - compatible
  - iommus

additionalProperties: false

examples:
  - |
    dais {
        compatible = "qcom,q6apm-dais";
        iommus = <&apps_smmu 0x1801 0x0>;
    };


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

title: Qualcomm DSP LPASS (Low Power Audio SubSystem) Audio Ports

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

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - qcom,q6apm-lpass-dais

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

required:
  - compatible
  - '#sound-dai-cells'

unevaluatedProperties: false

examples:
  - |
    dais {
        compatible = "qcom,q6apm-lpass-dais";
        #sound-dai-cells = <1>;
    };


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

title: Qualcomm Audio Process Manager (Q6APM)

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

allOf:
  - $ref: dai-common.yaml#
  - $ref: /schemas/soc/qcom/qcom,apr-services.yaml#

properties:
  compatible:
    enum:
      - qcom,q6apm

  bedais:
    type: object
    $ref: /schemas/sound/qcom,q6apm-lpass-dais.yaml#
    unevaluatedProperties: false
    description: Qualcomm DSP audio ports

  dais:
    type: object
    $ref: /schemas/sound/qcom,q6apm-dai.yaml#
    unevaluatedProperties: false
    description: Qualcomm DSP audio ports

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - bedais
  - dais

unevaluatedProperties: false

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

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

        service@1 {
            reg = <GPR_APM_MODULE_IID>;
            compatible = "qcom,q6apm";
            #sound-dai-cells = <0>;
            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";

            dais {
                compatible = "qcom,q6apm-dais";
                iommus = <&apps_smmu 0x1801 0x0>;
            };

            bedais {
                compatible = "qcom,q6apm-lpass-dais";
                #sound-dai-cells = <1>;
            };
        };
    };


code:
# 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:
  - |
    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>;
        };
    };


code:
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/qcom,q6asm.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>

allOf:
  - $ref: /schemas/soc/qcom/qcom,apr-services.yaml#

properties:
  compatible:
    enum:
      - qcom,q6asm

  dais:
    type: object
    $ref: /schemas/sound/qcom,q6asm-dais.yaml#
    unevaluatedProperties: false
    description: Qualcomm DSP audio ports

required:
  - compatible
  - dais

unevaluatedProperties: false

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

    apr {
        #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>;
                };
            };
        };
    };


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

title: Qualcomm Audio Core (Q6Core)

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

allOf:
  - $ref: /schemas/soc/qcom/qcom,apr-services.yaml#

properties:
  compatible:
    enum:
      - qcom,q6core

required:
  - compatible

unevaluatedProperties: false

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

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

        service@3 {
            compatible = "qcom,q6core";
            reg = <APR_SVC_ADSP_CORE>;
            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";
        };
    };


code:
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: "http://devicetree.org/schemas/sound/qcom,q6dsp-lpass-clocks.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"

title: Qualcomm DSP LPASS Clock Controller binding

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  This binding describes the Qualcomm DSP Clock Controller

properties:
  compatible:
    enum:
      - qcom,q6afe-clocks
      - qcom,q6prm-lpass-clocks

  '#clock-cells':
    const: 2
    description:
      Clock Id is followed by clock coupling attributes.
        1 = for no coupled clock
        2 = for dividend of the coupled clock
        3 = for divisor of the coupled clock
        4 = for inverted and no couple clock

required:
  - compatible
  - "#clock-cells"

additionalProperties: false

examples:
  - |
    clock-controller {
        compatible = "qcom,q6afe-clocks";
        #clock-cells = <2>;
    };


code:
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: "http://devicetree.org/schemas/sound/qcom,q6dsp-lpass-ports.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"

title: Qualcomm DSP LPASS(Low Power Audio SubSystem) Audio Ports binding

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  This binding describes the Qualcomm DSP LPASS Audio ports

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

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

  '#address-cells':
    const: 1

  '#size-cells':
    const: 0

#Digital Audio Interfaces
patternProperties:
  '^dai@[0-9]+$':
    type: object
    description:
      Q6DSP Digital Audio Interfaces.

    properties:
      reg:
        description:
          Digital Audio Interface ID

      qcom,sd-lines:
        $ref: /schemas/types.yaml#/definitions/uint32-array
        description:
          List of serial data lines used by this dai.should be one or more of the 0-3 sd lines.
        minItems: 1
        maxItems: 4
        uniqueItems: true
        items:
          minimum: 0
          maximum: 3

      qcom,tdm-sync-mode:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1, 2]
        description:
          TDM Synchronization mode
            0 = Short sync bit mode
            1 = Long sync mode
            2 = Short sync slot mode

      qcom,tdm-sync-src:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1]
        description:
          TDM Synchronization source
            0 = External source
            1 = Internal source

      qcom,tdm-data-out:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1]
        description:
          TDM Data out signal to drive with other masters
            0 = Disable
            1 = Enable

      qcom,tdm-invert-sync:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1]
        description:
          TDM Invert the sync
            0 = Normal
            1 = Invert

      qcom,tdm-data-delay:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1, 2]
        description:
          TDM Number of bit clock to delay data
            0 = 0 bit clock cycle
            1 = 1 bit clock cycle
            2 = 2 bit clock cycle

      qcom,tdm-data-align:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1]
        description:
          Indicate how data is packed within the slot. For example, 32 slot
          width in case of sample bit width is 24TDM Invert the sync.
            0 = MSB
            1 = LSB

    required:
      - reg

    allOf:
      - if:
          properties:
            reg:
              contains:
                # TDM DAI ID range from PRIMARY_TDM_RX_0 - QUINARY_TDM_TX_7
                items:
                  minimum: 24
                  maximum: 103
        then:
          required:
            - qcom,tdm-sync-mode
            - qcom,tdm-sync-src
            - qcom,tdm-data-out
            - qcom,tdm-invert-sync
            - qcom,tdm-data-delay
            - qcom,tdm-data-align

      - if:
          properties:
            reg:
              contains:
                # MI2S DAI ID range PRIMARY_MI2S_RX - QUATERNARY_MI2S_TX and
                # QUINARY_MI2S_RX - QUINARY_MI2S_TX
                items:
                  oneOf:
                    - minimum: 16
                      maximum: 23
                    - minimum: 127
                      maximum: 128
        then:
          required:
            - qcom,sd-lines

    additionalProperties: false

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

additionalProperties: false

examples:
  - |
    #include <dt-bindings/sound/qcom,q6dsp-lpass-ports.h>

    dais {
        compatible = "qcom,q6afe-dais";
        #address-cells = <1>;
        #size-cells = <0>;
        #sound-dai-cells = <1>;

        dai@22 {
            reg = <QUATERNARY_MI2S_RX>;
            qcom,sd-lines = <0 1 2 3>;
        };
    };


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

title: Qualcomm Proxy Resource Manager (Q6PRM)

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

allOf:
  - $ref: /schemas/soc/qcom/qcom,apr-services.yaml#

properties:
  compatible:
    enum:
      - qcom,q6prm

  clock-controller:
    $ref: /schemas/sound/qcom,q6dsp-lpass-clocks.yaml#
    unevaluatedProperties: false
    description: Qualcomm DSP LPASS clock controller

required:
  - compatible
  - clock-controller

unevaluatedProperties: false

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

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

        service@2 {
            reg = <GPR_PRM_MODULE_IID>;
            compatible = "qcom,q6prm";
            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";

            clock-controller {
                compatible = "qcom,q6prm-lpass-clocks";
                #clock-cells = <2>;
            };
        };
    };


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

title: Qualcomm Technologies Inc. ASoC sound card drivers

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description:
  This bindings describes Qualcomm SoC based sound cards
  which uses LPASS internal codec for audio.

properties:
  compatible:
    enum:
      - lenovo,yoga-c630-sndcard
      - qcom,apq8016-sbc-sndcard
      - qcom,db845c-sndcard
      - qcom,msm8916-qdsp6-sndcard
      - qcom,qrb5165-rb5-sndcard
      - qcom,sc8280xp-sndcard
      - qcom,sdm845-sndcard
      - qcom,sm8250-sndcard
      - qcom,sm8450-sndcard

  audio-routing:
    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
    description:
      A list of the connections between audio components. Each entry is a
      pair of strings, the first being the connection's sink, the second
      being the connection's source. Valid names could be power supplies,
      MicBias of codec and the jacks on the board.

  aux-devs:
    $ref: /schemas/types.yaml#/definitions/phandle-array
    description: |
      List of phandles pointing to auxiliary devices, such
      as amplifiers, to be added to the sound card.

  model:
    $ref: /schemas/types.yaml#/definitions/string
    description: User visible long sound card name

  pin-switches:
    description: List of widget names for which pin switches should be created.
    $ref: /schemas/types.yaml#/definitions/string-array

  widgets:
    description: User specified audio sound widgets.
    $ref: /schemas/types.yaml#/definitions/non-unique-string-array

  # Only valid for some compatibles (see allOf if below)
  reg: true
  reg-names: true

patternProperties:
  ".*-dai-link$":
    description:
      Each subnode represents a dai link. Subnodes of each dai links would be
      cpu/codec dais.

    type: object

    properties:
      link-name:
        description: Indicates dai-link name and PCM stream name.
        $ref: /schemas/types.yaml#/definitions/string
        maxItems: 1

      cpu:
        description: Holds subnode which indicates cpu dai.
        type: object
        additionalProperties: false

        properties:
          sound-dai:
            maxItems: 1

      platform:
        description: Holds subnode which indicates platform dai.
        type: object
        additionalProperties: false

        properties:
          sound-dai:
            maxItems: 1

      codec:
        description: Holds subnode which indicates codec dai.
        type: object
        additionalProperties: false

        properties:
          sound-dai:
            minItems: 1
            maxItems: 4

    required:
      - link-name
      - cpu

    additionalProperties: false

required:
  - compatible
  - model

allOf:
  - if:
      properties:
        compatible:
          contains:
            enum:
              - qcom,apq8016-sbc-sndcard
              - qcom,msm8916-qdsp6-sndcard
    then:
      properties:
        reg:
          items:
            - description: Microphone I/O mux register address
            - description: Speaker I/O mux register address
        reg-names:
          items:
            - const: mic-iomux
            - const: spkr-iomux
      required:
        - compatible
        - model
        - reg
        - reg-names
    else:
      properties:
        reg: false
        reg-names: false

additionalProperties: false

examples:

  - |
    #include <dt-bindings/sound/qcom,q6afe.h>
    #include <dt-bindings/sound/qcom,q6asm.h>
    sound {
        compatible = "qcom,qrb5165-rb5-sndcard";
        model = "Qualcomm-qrb5165-RB5-WSA8815-Speakers-DMIC0";
        audio-routing = "SpkrLeft IN", "WSA_SPK1 OUT",
                    "SpkrRight IN", "WSA_SPK2 OUT",
                    "VA DMIC0", "vdd-micb",
                    "VA DMIC1", "vdd-micb";

        mm1-dai-link {
            link-name = "MultiMedia0";
            cpu {
                sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA1>;
            };
        };

        mm2-dai-link {
            link-name = "MultiMedia2";
            cpu {
                sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA2>;
            };
        };

        mm3-dai-link {
            link-name = "MultiMedia3";
            cpu {
                sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA3>;
            };
        };

        hdmi-dai-link {
            link-name = "HDMI Playback";
            cpu {
                sound-dai = <&q6afedai TERTIARY_MI2S_RX>;
            };

            platform {
                sound-dai = <&q6routing>;
            };

            codec {
                sound-dai = <&lt9611_codec 0>;
            };
        };

        wsa-dai-link {
            link-name = "WSA Playback";
            cpu {
                sound-dai = <&q6afedai WSA_CODEC_DMA_RX_0>;
            };

            platform {
                sound-dai = <&q6routing>;
            };

            codec {
                sound-dai = <&left_spkr>, <&right_spkr>, <&swr0 0>, <&wsamacro>;
            };
        };

        va-dai-link {
            link-name = "VA Capture";
            cpu {
                sound-dai = <&q6afedai VA_CODEC_DMA_TX_0>;
            };

            platform {
                sound-dai = <&q6routing>;
            };

            codec {
                sound-dai = <&vamacro 0>;
            };
        };
    };

  - |
    #include <dt-bindings/sound/qcom,lpass.h>
    sound@7702000 {
        compatible = "qcom,apq8016-sbc-sndcard";
        reg = <0x07702000 0x4>, <0x07702004 0x4>;
        reg-names = "mic-iomux", "spkr-iomux";

        model = "DB410c";
        audio-routing =
            "AMIC2", "MIC BIAS Internal2",
            "AMIC3", "MIC BIAS External1";

        pinctrl-0 = <&cdc_pdm_lines_act &ext_sec_tlmm_lines_act &ext_mclk_tlmm_lines_act>;
        pinctrl-1 = <&cdc_pdm_lines_sus &ext_sec_tlmm_lines_sus &ext_mclk_tlmm_lines_sus>;
        pinctrl-names = "default", "sleep";

        quaternary-dai-link {
            link-name = "ADV7533";
            cpu {
                sound-dai = <&lpass MI2S_QUATERNARY>;
            };
            codec {
                sound-dai = <&adv_bridge 0>;
            };
        };

        primary-dai-link {
            link-name = "WCD";
            cpu {
                sound-dai = <&lpass MI2S_PRIMARY>;
            };
            codec {
                sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
            };
        };

        tertiary-dai-link {
            link-name = "WCD-Capture";
            cpu {
                sound-dai = <&lpass MI2S_TERTIARY>;
            };
            codec {
                sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
            };
        };
    };

  - |
    #include <dt-bindings/sound/qcom,q6afe.h>
    #include <dt-bindings/sound/qcom,q6asm.h>
    sound@7702000 {
        compatible = "qcom,msm8916-qdsp6-sndcard";
        reg = <0x07702000 0x4>, <0x07702004 0x4>;
        reg-names = "mic-iomux", "spkr-iomux";

        model = "msm8916";
        widgets =
            "Speaker", "Speaker",
            "Headphone", "Headphones";
        pin-switches = "Speaker";
        audio-routing =
            "Speaker", "Speaker Amp OUT",
            "Speaker Amp IN", "HPH_R",
            "Headphones", "HPH_L",
            "Headphones", "HPH_R",
            "AMIC1", "MIC BIAS Internal1",
            "AMIC2", "MIC BIAS Internal2",
            "AMIC3", "MIC BIAS Internal3";
        aux-devs = <&speaker_amp>;

        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&cdc_pdm_lines_act>;
        pinctrl-1 = <&cdc_pdm_lines_sus>;

        mm1-dai-link {
            link-name = "MultiMedia1";
            cpu {
                sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
            };
        };

        primary-dai-link {
            link-name = "Primary MI2S";
            cpu {
                sound-dai = <&q6afedai PRIMARY_MI2S_RX>;
            };
            platform {
                sound-dai = <&q6routing>;
            };
            codec {
                sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
            };
        };
    };


code:
QCOM WCD9335 Codec

Qualcomm WCD9335 Codec is a standalone Hi-Fi audio codec IC, supports
Qualcomm Technologies, Inc. (QTI) multimedia solutions, including
the MSM8996, MSM8976, and MSM8956 chipsets. It has in-built
Soundwire controller, interrupt mux. It supports both I2S/I2C and
SLIMbus audio interfaces.

Required properties with SLIMbus Interface:

- compatible:
	Usage: required
	Value type: <stringlist>
	Definition: For SLIMbus interface it should be "slimMID,PID",
		    textual representation of Manufacturer ID, Product Code,
		    shall be in lower case hexadecimal with leading zeroes
		    suppressed.  Refer to slimbus/bus.txt for details.
		    Should be:
		    "slim217,1a0" for MSM8996 and APQ8096 SoCs with SLIMbus.

- reg
	Usage: required
	Value type: <u32 u32>
	Definition: Should be ('Device index', 'Instance ID')

- interrupts
	Usage: required
	Value type: <prop-encoded-array>
	Definition: Interrupts via WCD INTR1 and INTR2 pins

- interrupt-names:
	Usage: required
	Value type: <String array>
	Definition: Interrupt names of WCD INTR1 and INTR2
	Should be: "intr1", "intr2"

- reset-gpios:
	Usage: required
	Value type: <String Array>
	Definition: Reset gpio line

- slim-ifc-dev:
	Usage: required
	Value type: <phandle>
	Definition: SLIM interface device

- clocks:
	Usage: required
	Value type: <prop-encoded-array>
	Definition: See clock-bindings.txt section "consumers". List of
                three clock specifiers for mclk, mclk2 and slimbus clock.

- clock-names:
	Usage: required
	Value type: <string>
	Definition: Must contain "mclk", "mclk2" and "slimbus" strings.

- vdd-buck-supply:
	Usage: required
	Value type: <phandle>
	Definition: Should contain a reference to the 1.8V buck supply

- vdd-buck-sido-supply:
	Usage: required
	Value type: <phandle>
	Definition: Should contain a reference to the 1.8V SIDO buck supply

- vdd-rx-supply:
	Usage: required
	Value type: <phandle>
	Definition: Should contain a reference to the 1.8V rx supply

- vdd-tx-supply:
	Usage: required
	Value type: <phandle>
	Definition: Should contain a reference to the 1.8V tx supply

- vdd-vbat-supply:
	Usage: Optional
	Value type: <phandle>
	Definition: Should contain a reference to the vbat supply

- vdd-micbias-supply:
	Usage: required
	Value type: <phandle>
	Definition: Should contain a reference to the micbias supply

- vdd-io-supply:
	Usage: required
	Value type: <phandle>
	Definition: Should contain a reference to the 1.8V io supply

- interrupt-controller:
	Usage: required
	Definition: Indicating that this is a interrupt controller

- #interrupt-cells:
	Usage: required
	Value type: <int>
	Definition: should be 1

#sound-dai-cells
	Usage: required
	Value type: <u32>
	Definition: Must be 1

audio-codec@1{
	compatible = "slim217,1a0";
	reg  = <1 0>;
	interrupts = <&msmgpio 54 IRQ_TYPE_LEVEL_HIGH>;
	interrupt-names = "intr2"
	reset-gpios = <&msmgpio 64 GPIO_ACTIVE_LOW>;
	slim-ifc-dev  = <&wc9335_ifd>;
	clock-names = "mclk", "native";
	clocks = <&rpmcc RPM_SMD_DIV_CLK1>,
		 <&rpmcc RPM_SMD_BB_CLK1>;
	vdd-buck-supply = <&pm8994_s4>;
	vdd-rx-supply = <&pm8994_s4>;
	vdd-buck-sido-supply = <&pm8994_s4>;
	vdd-tx-supply = <&pm8994_s4>;
	vdd-io-supply = <&pm8994_s4>;
	#sound-dai-cells = <1>;
}


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

title: Bindings for Qualcomm WCD9340/WCD9341 Audio Codec

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  Qualcomm WCD9340/WCD9341 Codec is a standalone Hi-Fi audio codec IC.
  It has in-built Soundwire controller, pin controller, interrupt mux and
  supports both I2S/I2C and SLIMbus audio interfaces.

properties:
  compatible:
    const: slim217,250

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  reset-gpios:
    description: GPIO spec for reset line to use
    maxItems: 1

  slim-ifc-dev: true

  clocks:
    maxItems: 1

  clock-names:
    const: extclk

  vdd-buck-supply:
    description: A reference to the 1.8V buck supply

  vdd-buck-sido-supply:
    description: A reference to the 1.8V SIDO buck supply

  vdd-rx-supply:
    description: A reference to the 1.8V rx supply

  vdd-tx-supply:
    description: A reference to the 1.8V tx supply

  vdd-vbat-supply:
    description: A reference to the vbat supply

  vdd-io-supply:
    description: A reference to the 1.8V I/O supply

  vdd-micbias-supply:
    description: A reference to the micbias supply

  qcom,micbias1-microvolt:
    description: micbias1 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,micbias2-microvolt:
    description: micbias2 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,micbias3-microvolt:
    description: micbias3 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,micbias4-microvolt:
    description: micbias4 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,hphl-jack-type-normally-closed:
    description: Indicates that HPHL jack switch type is normally closed
    type: boolean

  qcom,ground-jack-type-normally-closed:
    description: Indicates that Headset Ground switch type is normally closed
    type: boolean

  qcom,mbhc-headset-vthreshold-microvolt:
    description: Voltage threshold value for headset detection
    minimum: 0
    maximum: 2850000

  qcom,mbhc-headphone-vthreshold-microvolt:
    description: Voltage threshold value for headphone detection
    minimum: 0
    maximum: 2850000

  qcom,mbhc-buttons-vthreshold-microvolt:
    description:
      Array of 8 Voltage threshold values corresponding to headset
      button0 - button7
    minItems: 8
    maxItems: 8

  clock-output-names:
    const: mclk

  clock-frequency:
    description: Clock frequency of output clk in Hz

  interrupt-controller: true

  '#interrupt-cells':
    const: 1

  '#clock-cells':
    const: 0

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

  "#address-cells":
    const: 1

  "#size-cells":
    const: 1

  gpio@42:
    type: object
    $ref: /schemas/gpio/qcom,wcd934x-gpio.yaml#

patternProperties:
  "^.*@[0-9a-f]+$":
    type: object
    description: |
      WCD934x subnode for each slave devices. Bindings of each subnodes
      depends on the specific driver providing the functionality and
      documented in their respective bindings.

    properties:
      reg:
        maxItems: 1

    required:
      - reg

required:
  - compatible
  - reg
  - reset-gpios
  - slim-ifc-dev
  - interrupts
  - interrupt-controller
  - clock-frequency
  - clock-output-names
  - qcom,micbias1-microvolt
  - qcom,micbias2-microvolt
  - qcom,micbias3-microvolt
  - qcom,micbias4-microvolt
  - "#interrupt-cells"
  - "#clock-cells"
  - "#sound-dai-cells"
  - "#address-cells"
  - "#size-cells"

additionalProperties: false

examples:
  - |
    codec@1,0{
        compatible = "slim217,250";
        reg  = <1 0>;
        reset-gpios = <&tlmm 64 0>;
        slim-ifc-dev  = <&wcd9340_ifd>;
        #sound-dai-cells = <1>;
        interrupt-parent = <&tlmm>;
        interrupts = <54 4>;
        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>;
        qcom,hphl-jack-type-normally-closed;
        qcom,ground-jack-type-normally-closed;
        qcom,mbhc-buttons-vthreshold-microvolt = <75000 150000 237000 500000 500000 500000 500000 500000>;
        qcom,mbhc-headset-vthreshold-microvolt = <1700000>;
        qcom,mbhc-headphone-vthreshold-microvolt = <50000>;
        clock-names = "extclk";
        clocks = <&rpmhcc 2>;

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

        gpio@42 {
            compatible = "qcom,wcd9340-gpio";
            reg = <0x42 0x2>;
            gpio-controller;
            #gpio-cells = <2>;
        };
    };

...


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/qcom,wcd938x-sdw.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Bindings for Qualcomm SoundWire Slave devices on WCD9380/WCD9385

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  Qualcomm WCD9380/WCD9385 Codec is a standalone Hi-Fi audio codec IC.
  It has RX and TX Soundwire slave devices. This bindings is for the
  slave devices.

properties:
  compatible:
    const: sdw20217010d00

  reg:
    maxItems: 1

  qcom,tx-port-mapping:
    description: |
      Specifies static port mapping between slave and master tx ports.
      In the order of slave port index.
    $ref: /schemas/types.yaml#/definitions/uint32-array
    minItems: 4
    maxItems: 4

  qcom,rx-port-mapping:
    description: |
      Specifies static port mapping between slave and master rx ports.
      In the order of slave port index.
    $ref: /schemas/types.yaml#/definitions/uint32-array
    minItems: 5
    maxItems: 5

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |
    soundwire@3210000 {
        #address-cells = <2>;
        #size-cells = <0>;
        reg = <0x03210000 0x2000>;
        wcd938x_rx: codec@0,4 {
            compatible = "sdw20217010d00";
            reg  = <0 4>;
            qcom,rx-port-mapping = <1 2 3 4 5>;
        };
    };

    soundwire@3230000 {
        #address-cells = <2>;
        #size-cells = <0>;
        reg = <0x03230000 0x2000>;
        wcd938x_tx: codec@0,3 {
            compatible = "sdw20217010d00";
            reg  = <0 3>;
            qcom,tx-port-mapping = <2 3 4 5>;
        };
    };

...


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

title: Bindings for Qualcomm WCD9380/WCD9385 Audio Codec

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  Qualcomm WCD9380/WCD9385 Codec is a standalone Hi-Fi audio codec IC.
  It has RX and TX Soundwire slave devices.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - qcom,wcd9380-codec
      - qcom,wcd9385-codec

  reset-gpios:
    description: GPIO spec for reset line to use
    maxItems: 1

  us-euro-gpios:
    description: GPIO spec for swapping gnd and mic segments
    maxItems: 1

  vdd-buck-supply:
    description: A reference to the 1.8V buck supply

  vdd-rxtx-supply:
    description: A reference to the 1.8V rx supply

  vdd-io-supply:
    description: A reference to the 1.8V I/O supply

  vdd-mic-bias-supply:
    description: A reference to the 3.8V mic bias supply

  qcom,tx-device:
    $ref: /schemas/types.yaml#/definitions/phandle-array
    description: A reference to Soundwire tx device phandle

  qcom,rx-device:
    $ref: /schemas/types.yaml#/definitions/phandle-array
    description: A reference to Soundwire rx device phandle

  qcom,micbias1-microvolt:
    description: micbias1 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,micbias2-microvolt:
    description: micbias2 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,micbias3-microvolt:
    description: micbias3 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,micbias4-microvolt:
    description: micbias4 voltage
    minimum: 1800000
    maximum: 2850000

  qcom,hphl-jack-type-normally-closed:
    description: Indicates that HPHL jack switch type is normally closed
    type: boolean

  qcom,ground-jack-type-normally-closed:
    description: Indicates that Headset Ground switch type is normally closed
    type: boolean

  qcom,mbhc-headset-vthreshold-microvolt:
    description: Voltage threshold value for headset detection
    minimum: 0
    maximum: 2850000

  qcom,mbhc-headphone-vthreshold-microvolt:
    description: Voltage threshold value for headphone detection
    minimum: 0
    maximum: 2850000

  qcom,mbhc-buttons-vthreshold-microvolt:
    description:
      Array of 8 Voltage threshold values corresponding to headset
      button0 - button7
    minItems: 8
    maxItems: 8

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

required:
  - compatible
  - reset-gpios
  - qcom,tx-device
  - qcom,rx-device
  - qcom,micbias1-microvolt
  - qcom,micbias2-microvolt
  - qcom,micbias3-microvolt
  - qcom,micbias4-microvolt
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    codec {
        compatible = "qcom,wcd9380-codec";
        reset-gpios = <&tlmm 32 0>;
        #sound-dai-cells = <1>;
        qcom,tx-device = <&wcd938x_tx>;
        qcom,rx-device = <&wcd938x_rx>;
        qcom,micbias1-microvolt = <1800000>;
        qcom,micbias2-microvolt = <1800000>;
        qcom,micbias3-microvolt = <1800000>;
        qcom,micbias4-microvolt = <1800000>;
        qcom,hphl-jack-type-normally-closed;
        qcom,ground-jack-type-normally-closed;
        qcom,mbhc-buttons-vthreshold-microvolt = <75000 150000 237000 500000 500000 500000 500000 500000>;
        qcom,mbhc-headphone-vthreshold-microvolt = <50000>;
    };

    /* ... */

    soundwire@3210000 {
        #address-cells = <2>;
        #size-cells = <0>;
        reg = <0x03210000 0x2000>;
        wcd938x_rx: codec@0,4 {
            compatible = "sdw20217010d00";
            reg  = <0 4>;
            qcom,rx-port-mapping = <1 2 3 4 5>;
        };
    };

    soundwire@3230000 {
        #address-cells = <2>;
        #size-cells = <0>;
        reg = <0x03230000 0x2000>;
        wcd938x_tx: codec@0,3 {
            compatible = "sdw20217010d00";
            reg  = <0 3>;
            qcom,tx-port-mapping = <2 3 4 5>;
        };
    };

...


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

title: Bindings for Qualcomm WSA8810/WSA8815 Class-D Smart Speaker Amplifier

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  WSA8810 is a class-D smart speaker amplifier and WSA8815
  is a high-output power class-D smart speaker amplifier.
  Their primary operating mode uses a SoundWire digital audio
  interface. This binding is for SoundWire interface.

properties:
  compatible:
    const: sdw10217201000

  reg:
    maxItems: 1

  powerdown-gpios:
    description: GPIO spec for Powerdown/Shutdown line to use
    maxItems: 1

  '#thermal-sensor-cells':
    const: 0

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - reg
  - powerdown-gpios
  - "#thermal-sensor-cells"
  - "#sound-dai-cells"

additionalProperties: false

examples:
  - |
    soundwire@c2d0000 {
        #address-cells = <2>;
        #size-cells = <0>;
        reg = <0x0c2d0000 0x2000>;

        speaker@0,1 {
            compatible = "sdw10217201000";
            reg = <0 1>;
            powerdown-gpios = <&wcdpinctrl 2 0>;
            #thermal-sensor-cells = <0>;
            #sound-dai-cells = <0>;
        };

        speaker@0,2 {
            compatible = "sdw10217201000";
            reg = <0 2>;
            powerdown-gpios = <&wcdpinctrl 2 0>;
            #thermal-sensor-cells = <0>;
            #sound-dai-cells = <0>;
        };
    };

...


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

title: Bindings for The Qualcomm WSA8830/WSA8832/WSA8835
  smart speaker amplifier

maintainers:
  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
  WSA883X is the Qualcomm Aqstic smart speaker amplifier
  Their primary operating mode uses a SoundWire digital audio
  interface. This binding is for SoundWire interface.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    const: sdw10217020200

  reg:
    maxItems: 1

  powerdown-gpios:
    description: GPIO spec for Powerdown/Shutdown line to use (pin SD_N)
    maxItems: 1

  vdd-supply:
    description: VDD Supply for the Codec

  '#thermal-sensor-cells':
    const: 0

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - reg
  - vdd-supply
  - powerdown-gpios
  - "#thermal-sensor-cells"
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>

    soundwire-controller@3250000 {
        #address-cells = <2>;
        #size-cells = <0>;
        reg = <0x3250000 0x2000>;

        speaker@0,1 {
            compatible = "sdw10217020200";
            reg = <0 1>;
            powerdown-gpios = <&tlmm 1 GPIO_ACTIVE_LOW>;
            vdd-supply = <&vreg_s10b_1p8>;
            #thermal-sensor-cells = <0>;
            #sound-dai-cells = <0>;
            sound-name-prefix = "SpkrLeft";
        };

        speaker@0,2 {
            compatible = "sdw10217020200";
            reg = <0 2>;
            powerdown-gpios = <&tlmm 89 GPIO_ACTIVE_LOW>;
            vdd-supply = <&vreg_s10b_1p8>;
            #thermal-sensor-cells = <0>;
            #sound-dai-cells = <0>;
            sound-name-prefix = "SpkrRight";
        };
    };

...


code:
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/realtek,rt1015p.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Realtek rt1015p codec devicetree bindings

maintainers:
  - Tzung-Bi Shih <tzungbi@kernel.org>

description: |
  Rt1015p is a rt1015 variant which does not support I2C and
  only supports S24, 48kHz, 64FS.

properties:
  compatible:
    enum:
      - realtek,rt1015p
      - realtek,rt1019p

  sdb-gpios:
    description:
      GPIO used for shutdown control.
      0 means shut down; 1 means power on.
    maxItems: 1

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

required:
  - compatible

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>

    rt1015p: rt1015p {
        compatible = "realtek,rt1015p";
        sdb-gpios = <&pio 175 GPIO_ACTIVE_HIGH>;
    };


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/realtek,rt5682s.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Realtek rt5682s codec devicetree bindings

maintainers:
  - Derek Fang <derek.fang@realtek.com>

description: |
  Rt5682s(ALC5682I-VS) is a rt5682i variant which supports I2C only.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    const: realtek,rt5682s

  reg:
    maxItems: 1
    description: I2C address of the device.

  interrupts:
    maxItems: 1
    description: The CODEC's interrupt output.

  realtek,dmic1-data-pin:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum:
      - 0 # dmic1 data is not used
      - 1 # using GPIO2 pin as dmic1 data pin
      - 2 # using GPIO5 pin as dmic1 data pin
    description: |
      Specify which GPIO pin be used as DMIC1 data pin.

  realtek,dmic1-clk-pin:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum:
      - 0 # dmic1 clk is not used
      - 1 # using GPIO1 pin as dmic1 clock pin
      - 2 # using GPIO3 pin as dmic1 clock pin
    description: |
      Specify which GPIO pin be used as DMIC1 clk pin.

  realtek,jd-src:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum:
      - 0 # No JD is used
      - 1 # using JD1 as JD source
    description: |
      Specify which JD source be used.

  realtek,ldo1-en-gpios:
    description: |
      The GPIO that controls the CODEC's LDO1_EN pin.

  realtek,dmic-clk-rate-hz:
    description: |
      Set the clock rate (hz) for the requirement of the particular DMIC.

  realtek,dmic-delay-ms:
    description: |
      Set the delay time (ms) for the requirement of the particular DMIC.

  realtek,amic-delay-ms:
    description: |
      Set the delay time (ms) for the requirement of the particular platform or AMIC.

  realtek,dmic-clk-driving-high:
    type: boolean
    description: |
      Set the high driving of the DMIC clock out.

  clocks:
    items:
      - description: phandle and clock specifier for codec MCLK.

  clock-names:
    items:
      - const: mclk

  "#clock-cells":
    const: 1

  clock-output-names:
    minItems: 2
    maxItems: 2
    description: Name given for DAI word clock and bit clock outputs.

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

  AVDD-supply:
    description: Regulator supplying analog power through the AVDD pin.

  MICVDD-supply:
    description: Regulator supplying power for the microphone bias through the
      MICVDD pin.

  DBVDD-supply:
    description: Regulator supplying I/O power through the DBVDD pin.

  LDO1-IN-supply:
    description: Regulator supplying power to the digital core and charge pump
      through the LDO1_IN pin.

unevaluatedProperties: false

required:
  - compatible
  - reg
  - AVDD-supply
  - MICVDD-supply
  - DBVDD-supply
  - LDO1-IN-supply

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

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

        codec@1a {
            compatible = "realtek,rt5682s";
            reg = <0x1a>;
            interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
            realtek,ldo1-en-gpios =
                <&gpio 2 GPIO_ACTIVE_HIGH>;
            realtek,dmic1-data-pin = <1>;
            realtek,dmic1-clk-pin = <1>;
            realtek,jd-src = <1>;

            #clock-cells = <1>;
            clock-output-names = "rt5682-dai-wclk", "rt5682-dai-bclk";

            clocks = <&osc>;
            clock-names = "mclk";

            AVDD-supply = <&avdd_reg>;
            MICVDD-supply = <&micvdd_reg>;
            DBVDD-supply = <&dbvdd_reg>;
            LDO1-IN-supply = <&ldo1_in_reg>;
        };
    };


code:
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/renesas,fsi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Renesas FIFO-buffered Serial Interface (FSI)

maintainers:
  - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

allOf:
  - $ref: dai-common.yaml#

properties:
  $nodename:
    pattern: "^sound@.*"

  compatible:
    oneOf:
      # for FSI2 SoC
      - items:
          - enum:
              - renesas,fsi2-sh73a0  # SH-Mobile AG5
              - renesas,fsi2-r8a7740 # R-Mobile A1
          - enum:
              - renesas,sh_fsi2
      # for Generic
      - items:
          - enum:
              - renesas,sh_fsi
              - renesas,sh_fsi2

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  clocks:
    maxItems: 1

  power-domains:
    maxItems: 1

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

patternProperties:
  "^fsi(a|b),spdif-connection$":
    $ref: /schemas/types.yaml#/definitions/flag
    description: FSI is connected by S/PDIF

  "^fsi(a|b),stream-mode-support$":
    $ref: /schemas/types.yaml#/definitions/flag
    description: FSI supports 16bit stream mode

  "^fsi(a|b),use-internal-clock$":
    $ref: /schemas/types.yaml#/definitions/flag
    description: FSI uses internal clock when master mode

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - power-domains
  - '#sound-dai-cells'

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/clock/r8a7740-clock.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    sh_fsi2: sound@fe1f0000 {
            compatible = "renesas,fsi2-r8a7740", "renesas,sh_fsi2";
            reg = <0xfe1f0000 0x400>;
            interrupts = <GIC_SPI 9 0x4>;
            clocks = <&mstp3_clks R8A7740_CLK_FSI>;
            power-domains = <&pd_a4mp>;

            #sound-dai-cells = <1>;
            fsia,spdif-connection;
            fsia,stream-mode-support;
            fsia,use-internal-clock;
    };


code:
Renesas R-Car sound

=============================================
* Modules
=============================================

Renesas R-Car and RZ/G sound is constructed from below modules
(for Gen2 or later)

 SCU		: Sampling Rate Converter Unit
  - SRC		: Sampling Rate Converter
  - CMD
   - CTU	: Channel Transfer Unit
   - MIX	: Mixer
   - DVC	: Digital Volume and Mute Function
 SSIU		: Serial Sound Interface Unit
 SSI		: Serial Sound Interface

See detail of each module's channels, connection, limitation on datasheet

=============================================
* Multi channel
=============================================

Multi channel is supported by Multi-SSI, or TDM-SSI.

 Multi-SSI	: 6ch case, you can use stereo x 3 SSI
 TDM-SSI	: 6ch case, you can use TDM

=============================================
* Enable/Disable each modules
=============================================

See datasheet to check SRC/CTU/MIX/DVC connect-limitation.
DT controls enabling/disabling module.
${LINUX}/arch/arm/boot/dts/r8a7790-lager.dts can be good example.
This is example of

Playback: [MEM] -> [SRC2] -> [DVC0] -> [SSIU0/SSI0] -> [codec]
Capture:  [MEM] <- [DVC1] <- [SRC3] <- [SSIU1/SSI1] <- [codec]

see "Example: simple sound card"

You can use below.
${LINUX}/arch/arm/boot/dts/r8a7790.dts can be good example.

	&src0	&ctu00	&mix0	&dvc0	&ssi0
	&src1	&ctu01	&mix1	&dvc1	&ssi1
	&src2	&ctu02			&ssi2
	&src3	&ctu03			&ssi3
	&src4				&ssi4
	&src5	&ctu10			&ssi5
	&src6	&ctu11			&ssi6
	&src7	&ctu12			&ssi7
	&src8	&ctu13			&ssi8
	&src9				&ssi9

=============================================
* SRC (Sampling Rate Converter)
=============================================

 [xx]Hz        [yy]Hz
 ------> [SRC] ------>

SRC can convert [xx]Hz to [yy]Hz. Then, it has below 2 modes

 Asynchronous mode:	input data / output data are based on different clocks.
			you can use this mode on Playback / Capture
 Synchronous mode:	input data / output data are based on same clocks.
			This mode will be used if system doesn't have its input clock,
			for example digital TV case.
			you can use this mode on Playback

------------------
**     Asynchronous mode
------------------

You need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.
see "Example: simple sound card for Asynchronous mode"

------------------
**     Synchronous mode
------------------

	> amixer set "SRC Out Rate" on
	> aplay xxxx.wav
	> amixer set "SRC Out Rate" 48000
	> amixer set "SRC Out Rate" 44100

=============================================
* CTU (Channel Transfer Unit)
=============================================

 [xx]ch        [yy]ch
 ------> [CTU] -------->

CTU can convert [xx]ch to [yy]ch, or exchange outputed channel.
CTU conversion needs matrix settings.
For more detail information, see below

	Renesas R-Car datasheet
	 - Sampling Rate Converter Unit (SCU)
	  - SCU Operation
	   - CMD Block
	    - Functional Blocks in CMD

	Renesas R-Car datasheet
	 - Sampling Rate Converter Unit (SCU)
	  - Register Description
	   - CTUn Scale Value exx Register (CTUn_SVxxR)

	${LINUX}/sound/soc/sh/rcar/ctu.c
	 - comment of header

You need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.
see "Example: simple sound card for channel convert"

Ex) Exchange output channel
 Input -> Output
  1ch  ->  0ch
  0ch  ->  1ch

  example of using matrix
	output 0ch = (input 0ch x 0) + (input 1ch x 1)
	output 1ch = (input 0ch x 1) + (input 1ch x 0)

	amixer set "CTU Reset" on
	amixer set "CTU Pass" 9,10
	amixer set "CTU SV0" 0,4194304
	amixer set "CTU SV1" 4194304,0

 example of changing connection
	amixer set "CTU Reset" on
	amixer set "CTU Pass" 2,1

=============================================
* MIX (Mixer)
=============================================

MIX merges 2 sounds path. You can see 2 sound interface on system,
and these sounds will be merged by MIX.

	aplay -D plughw:0,0 xxxx.wav &
	aplay -D plughw:0,1 yyyy.wav

You need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.
Ex)
	[MEM] -> [SRC1] -> [CTU02] -+-> [MIX0] -> [DVC0] -> [SSI0]
	                            |
	[MEM] -> [SRC2] -> [CTU03] -+

see "Example: simple sound card for MIXer"

=============================================
* DVC (Digital Volume and Mute Function)
=============================================

DVC controls Playback/Capture volume.

Playback Volume
	amixer set "DVC Out" 100%

Capture Volume
	amixer set "DVC In" 100%

Playback Mute
	amixer set "DVC Out Mute" on

Capture Mute
	amixer set "DVC In Mute" on

Volume Ramp
	amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
	amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
	amixer set "DVC Out Ramp" on
	aplay xxx.wav &
	amixer set "DVC Out"  80%  // Volume Down
	amixer set "DVC Out" 100%  // Volume Up

=============================================
* SSIU (Serial Sound Interface Unit)
=============================================

SSIU can avoid some under/over run error, because it has some buffer.
But you can't use it if SSI was PIO mode.
In DMA mode, you can select not to use SSIU by using "no-busif" via SSI.

SSIU handles BUSIF which will be used for TDM Split mode.
This driver is assuming that audio-graph card will be used.

TDM Split mode merges 4 sounds. You can see 4 sound interface on system,
and these sounds will be merged SSIU/SSI.

	aplay -D plughw:0,0 xxxx.wav &
	aplay -D plughw:0,1 xxxx.wav &
	aplay -D plughw:0,2 xxxx.wav &
	aplay -D plughw:0,3 xxxx.wav

	          2ch                     8ch
	[MEM] -> [SSIU 30] -+-> [SSIU 3] --> [Codec]
	          2ch       |
	[MEM] -> [SSIU 31] -+
	          2ch       |
	[MEM] -> [SSIU 32] -+
	          2ch       |
	[MEM] -> [SSIU 33] -+

see "Example: simple sound card for TDM Split"

=============================================
* SSI (Serial Sound Interface)
=============================================

**  PIO mode

You can use PIO mode which is for connection check by using.
Note: The system will drop non-SSI modules in PIO mode
even though if DT is selecting other modules.

	&ssi0 {
		pio-transfer
	};

** DMA mode without SSIU

You can use DMA without SSIU.
Note: under/over run, or noise are likely to occur

	&ssi0 {
		no-busif;
	};

** PIN sharing

Each SSI can share WS pin. It is based on platform.
This is example if SSI1 want to share WS pin with SSI0

	&ssi1 {
		shared-pin;
	};

** Multi-SSI

You can use Multi-SSI.
This is example of SSI0/SSI1/SSI2 (= for 6ch)

see "Example: simple sound card for Multi channel"

** TDM-SSI

You can use TDM with SSI.
This is example of TDM 6ch.
Driver can automatically switches TDM <-> stereo mode in this case.

see "Example: simple sound card for TDM"


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/renesas,rsnd.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Renesas R-Car Sound Driver

maintainers:
  - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

properties:

  compatible:
    oneOf:
      # for Gen1 SoC
      - items:
          - enum:
              - renesas,rcar_sound-r8a7778   # R-Car M1A
              - renesas,rcar_sound-r8a7779   # R-Car H1
          - enum:
              - renesas,rcar_sound-gen1
      # for Gen2 SoC
      - items:
          - enum:
              - renesas,rcar_sound-r8a7742   # RZ/G1H
              - renesas,rcar_sound-r8a7743   # RZ/G1M
              - renesas,rcar_sound-r8a7744   # RZ/G1N
              - renesas,rcar_sound-r8a7745   # RZ/G1E
              - renesas,rcar_sound-r8a77470  # RZ/G1C
              - renesas,rcar_sound-r8a7790   # R-Car H2
              - renesas,rcar_sound-r8a7791   # R-Car M2-W
              - renesas,rcar_sound-r8a7793   # R-Car M2-N
              - renesas,rcar_sound-r8a7794   # R-Car E2
          - enum:
              - renesas,rcar_sound-gen2
      # for Gen3 SoC
      - items:
          - enum:
              - renesas,rcar_sound-r8a774a1  # RZ/G2M
              - renesas,rcar_sound-r8a774b1  # RZ/G2N
              - renesas,rcar_sound-r8a774c0  # RZ/G2E
              - renesas,rcar_sound-r8a774e1  # RZ/G2H
              - renesas,rcar_sound-r8a7795   # R-Car H3
              - renesas,rcar_sound-r8a7796   # R-Car M3-W
              - renesas,rcar_sound-r8a77961  # R-Car M3-W+
              - renesas,rcar_sound-r8a77965  # R-Car M3-N
              - renesas,rcar_sound-r8a77990  # R-Car E3
              - renesas,rcar_sound-r8a77995  # R-Car D3
          - enum:
              - renesas,rcar_sound-gen3
      # for Generic
      - items:
          - enum:
              - renesas,rcar_sound-gen1
              - renesas,rcar_sound-gen2
              - renesas,rcar_sound-gen3

  reg:
    minItems: 1
    maxItems: 5

  reg-names:
    minItems: 1
    maxItems: 5

  "#sound-dai-cells":
    description: |
      it must be 0 if your system is using single DAI
      it must be 1 if your system is using multi  DAIs
    enum: [0, 1]

  "#clock-cells":
    description: |
      it must be 0 if your system has audio_clkout
      it must be 1 if your system has audio_clkout0/1/2/3
    enum: [0, 1]

  clock-frequency:
    description: for audio_clkout0/1/2/3

  clkout-lr-asynchronous:
    description: audio_clkoutn is asynchronizes with lr-clock.
    $ref: /schemas/types.yaml#/definitions/flag

  power-domains: true

  resets:
    minItems: 1
    maxItems: 11

  reset-names:
    minItems: 1
    maxItems: 11

  clocks:
    description: References to SSI/SRC/MIX/CTU/DVC/AUDIO_CLK clocks.
    minItems: 1
    maxItems: 31

  clock-names:
    description: List of necessary clock names.
    minItems: 1
    maxItems: 31
    items:
      oneOf:
        - const: ssi-all
        - pattern: '^ssi\.[0-9]$'
        - pattern: '^src\.[0-9]$'
        - pattern: '^mix\.[0-1]$'
        - pattern: '^ctu\.[0-1]$'
        - pattern: '^dvc\.[0-1]$'
        - pattern: '^clk_(a|b|c|i)$'

  ports:
    $ref: /schemas/graph.yaml#/properties/ports
    patternProperties:
      '^port(@[0-9a-f]+)?$':
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false

  port:
    $ref: audio-graph-port.yaml#
    unevaluatedProperties: false

  rcar_sound,dvc:
    description: DVC subnode.
    type: object
    patternProperties:
      "^dvc-[0-1]$":
        type: object
        additionalProperties: false

        properties:
          dmas:
            maxItems: 1
          dma-names:
            const: "tx"
        required:
          - dmas
          - dma-names
    additionalProperties: false

  rcar_sound,mix:
    description: MIX subnode.
    type: object
    patternProperties:
      "^mix-[0-1]$":
        type: object
        additionalProperties: false
    additionalProperties: false

  rcar_sound,ctu:
    description: CTU subnode.
    type: object
    patternProperties:
      "^ctu-[0-7]$":
        type: object
        additionalProperties: false
    additionalProperties: false

  rcar_sound,src:
    description: SRC subnode.
    type: object
    patternProperties:
      "^src-[0-9]$":
        type: object
        additionalProperties: false

        properties:
          interrupts:
            maxItems: 1
          dmas:
            maxItems: 2
          dma-names:
            allOf:
              - items:
                  enum:
                    - tx
                    - rx
        required:
          - interrupts
          - dmas
          - dma-names
    additionalProperties: false

  rcar_sound,ssiu:
    description: SSIU subnode.
    type: object
    patternProperties:
      "^ssiu-[0-9]+$":
        type: object
        additionalProperties: false

        properties:
          dmas:
            maxItems: 2
          dma-names:
            allOf:
              - items:
                  enum:
                    - tx
                    - rx
        required:
          - dmas
          - dma-names
    additionalProperties: false

  rcar_sound,ssi:
    description: SSI subnode.
    type: object
    patternProperties:
      "^ssi-[0-9]$":
        type: object
        additionalProperties: false

        properties:
          interrupts:
            maxItems: 1
          dmas:
            minItems: 2
            maxItems: 4
          dma-names:
            allOf:
              - items:
                  enum:
                    - tx
                    - rx
                    - txu # if no ssiu node
                    - rxu # if no ssiu node

          shared-pin:
            description: shared clock pin
            $ref: /schemas/types.yaml#/definitions/flag
          pio-transfer:
            description: PIO transfer mode
            $ref: /schemas/types.yaml#/definitions/flag
          no-busif:
            description: BUSIF is not used when [mem -> SSI] via DMA case
            $ref: /schemas/types.yaml#/definitions/flag
        required:
          - interrupts
          - dmas
          - dma-names
    additionalProperties: false

  # For DAI base
  rcar_sound,dai:
    description: DAI subnode.
    type: object
    patternProperties:
      "^dai([0-9]+)?$":
        type: object
        additionalProperties: false

        properties:
          playback:
            $ref: /schemas/types.yaml#/definitions/phandle-array
          capture:
            $ref: /schemas/types.yaml#/definitions/phandle-array
        anyOf:
          - required:
              - playback
          - required:
              - capture
    additionalProperties: false

required:
  - compatible
  - reg
  - reg-names
  - clocks
  - clock-names
  - "#sound-dai-cells"

allOf:
  - $ref: dai-common.yaml#
  - if:
      properties:
        compatible:
          contains:
            const: renesas,rcar_sound-gen1
    then:
      properties:
        reg:
          maxItems: 3
        reg-names:
          maxItems: 3
          items:
            enum:
              - scu
              - ssi
              - adg
    else:
      properties:
        reg:
          maxItems: 5
        reg-names:
          maxItems: 5
          items:
            enum:
              - scu
              - adg
              - ssiu
              - ssi
              - audmapp

unevaluatedProperties: false

examples:
  - |
    rcar_sound: sound@ec500000 {
        #sound-dai-cells = <1>;
        compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2";
        reg = <0xec500000 0x1000>, /* SCU  */
              <0xec5a0000 0x100>,  /* ADG  */
              <0xec540000 0x1000>, /* SSIU */
              <0xec541000 0x1280>, /* SSI  */
              <0xec740000 0x200>;  /* Audio DMAC peri peri*/
        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";

        clocks = <&mstp10_clks 1005>,                      /* SSI-ALL    */
                 <&mstp10_clks 1006>, <&mstp10_clks 1007>, /* SSI9, SSI8 */
                 <&mstp10_clks 1008>, <&mstp10_clks 1009>, /* SSI7, SSI6 */
                 <&mstp10_clks 1010>, <&mstp10_clks 1011>, /* SSI5, SSI4 */
                 <&mstp10_clks 1012>, <&mstp10_clks 1013>, /* SSI3, SSI2 */
                 <&mstp10_clks 1014>, <&mstp10_clks 1015>, /* SSI1, SSI0 */
                 <&mstp10_clks 1022>, <&mstp10_clks 1023>, /* SRC9, SRC8 */
                 <&mstp10_clks 1024>, <&mstp10_clks 1025>, /* SRC7, SRC6 */
                 <&mstp10_clks 1026>, <&mstp10_clks 1027>, /* SRC5, SRC4 */
                 <&mstp10_clks 1028>, <&mstp10_clks 1029>, /* SRC3, SRC2 */
                 <&mstp10_clks 1030>, <&mstp10_clks 1031>, /* SRC1, SRC0 */
                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* MIX1, MIX0 */
                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* CTU1, CTU0 */
                 <&mstp10_clks 1019>, <&mstp10_clks 1018>, /* DVC0, DVC1 */
                 <&audio_clk_a>, <&audio_clk_b>,           /* CLKA, CLKB */
                 <&audio_clk_c>, <&audio_clk_i>;           /* CLKC, CLKI */

        clock-names = "ssi-all",
                      "ssi.9", "ssi.8",
                      "ssi.7", "ssi.6",
                      "ssi.5", "ssi.4",
                      "ssi.3", "ssi.2",
                      "ssi.1", "ssi.0",
                      "src.9", "src.8",
                      "src.7", "src.6",
                      "src.5", "src.4",
                      "src.3", "src.2",
                      "src.1", "src.0",
                      "mix.1", "mix.0",
                      "ctu.1", "ctu.0",
                      "dvc.0", "dvc.1",
                      "clk_a", "clk_b",
                      "clk_c", "clk_i";

        rcar_sound,dvc {
               dvc0: dvc-0 {
                    dmas = <&audma0 0xbc>;
                    dma-names = "tx";
               };
               dvc1: dvc-1 {
                    dmas = <&audma0 0xbe>;
                    dma-names = "tx";
               };
        };

        rcar_sound,mix {
            mix0: mix-0 { };
            mix1: mix-1 { };
        };

        rcar_sound,ctu {
            ctu00: ctu-0 { };
            ctu01: ctu-1 { };
            ctu02: ctu-2 { };
            ctu03: ctu-3 { };
            ctu10: ctu-4 { };
            ctu11: ctu-5 { };
            ctu12: ctu-6 { };
            ctu13: ctu-7 { };
        };

        rcar_sound,src {
            src0: src-0 {
                status = "disabled";
            };
            src1: src-1 {
                interrupts = <0 353 0>;
                dmas = <&audma0 0x87>, <&audma1 0x9c>;
                dma-names = "rx", "tx";
            };
            /* skip after src-2 */
        };

        rcar_sound,ssiu {
            ssiu00: ssiu-0 {
                dmas = <&audma0 0x15>, <&audma1 0x16>;
                dma-names = "rx", "tx";
            };
            ssiu01: ssiu-1 {
                dmas = <&audma0 0x35>, <&audma1 0x36>;
                dma-names = "rx", "tx";
            };
            /* skip after ssiu-2 */
        };

        rcar_sound,ssi {
            ssi0: ssi-0 {
                interrupts = <0 370 1>;
                dmas = <&audma0 0x01>, <&audma1 0x02>;
                dma-names = "rx", "tx";
            };
            ssi1: ssi-1 {
                interrupts = <0 371 1>;
                dmas = <&audma0 0x03>, <&audma1 0x04>;
                dma-names = "rx", "tx";
            };
            /* skip other ssi-2 */
        };

        /* DAI base */
        rcar_sound,dai {
            dai0 {
                playback = <&ssi5>, <&src5>;
                capture  = <&ssi6>;
            };
            dai1 {
                playback = <&ssi3>;
            };
            dai2 {
                capture  = <&ssi4>;
            };
            dai3 {
                playback = <&ssi7>;
            };
            dai4 {
                capture  = <&ssi8>;
            };
        };

        /* assume audio-graph */
        port {
            rsnd_endpoint: endpoint {
                remote-endpoint = <&codec_endpoint>;

                dai-format = "left_j";
                bitclock-master = <&rsnd_endpoint0>;
                frame-master = <&rsnd_endpoint0>;

                playback = <&ssi0>, <&src0>, <&dvc0>;
                capture  = <&ssi1>, <&src1>, <&dvc1>;
            };
        };
    };

    /* assume audio-graph */
    codec {
        port {
            codec_endpoint: endpoint {
                remote-endpoint = <&rsnd_endpoint>;
            };
        };
    };


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/renesas,rz-ssi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Renesas RZ/{G2L,V2L} ASoC Sound Serial Interface (SSIF-2)

maintainers:
  - Biju Das <biju.das.jz@bp.renesas.com>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    items:
      - enum:
          - renesas,r9a07g043-ssi  # RZ/G2UL
          - renesas,r9a07g044-ssi  # RZ/G2{L,LC}
          - renesas,r9a07g054-ssi  # RZ/V2L
      - const: renesas,rz-ssi

  reg:
    maxItems: 1

  interrupts:
    maxItems: 4

  interrupt-names:
    items:
      - const: int_req
      - const: dma_rx
      - const: dma_tx
      - const: dma_rt

  clocks:
    maxItems: 4

  clock-names:
    items:
      - const: ssi
      - const: ssi_sfr
      - const: audio_clk1
      - const: audio_clk2

  power-domains:
    maxItems: 1

  resets:
    maxItems: 1

  dmas:
    minItems: 1
    maxItems: 2
    description:
      The first cell represents a phandle to dmac.
      The second cell specifies the encoded MID/RID values of the SSI port
      connected to the DMA client and the slave channel configuration
      parameters.
      bits[0:9]   - Specifies MID/RID value of a SSI channel as below
                    MID/RID value of SSI rx0 = 0x256
                    MID/RID value of SSI tx0 = 0x255
                    MID/RID value of SSI rx1 = 0x25a
                    MID/RID value of SSI tx1 = 0x259
                    MID/RID value of SSI rt2 = 0x25f
                    MID/RID value of SSI rx3 = 0x262
                    MID/RID value of SSI tx3 = 0x261
      bit[10]     - HIEN = 1, Detects a request in response to the rising edge
                    of the signal
      bit[11]     - LVL = 0, Detects based on the edge
      bits[12:14] - AM = 2, Bus cycle mode
      bit[15]     - TM = 0, Single transfer mode

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

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - reg
  - interrupts
  - interrupt-names
  - clocks
  - clock-names
  - resets
  - '#sound-dai-cells'

unevaluatedProperties: false

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

    ssi0: ssi@10049c00 {
        compatible = "renesas,r9a07g044-ssi",
                     "renesas,rz-ssi";
            reg = <0x10049c00 0x400>;
            interrupts = <GIC_SPI 326 IRQ_TYPE_LEVEL_HIGH>,
                         <GIC_SPI 327 IRQ_TYPE_EDGE_RISING>,
                         <GIC_SPI 328 IRQ_TYPE_EDGE_RISING>,
                         <GIC_SPI 329 IRQ_TYPE_EDGE_RISING>;
            interrupt-names = "int_req", "dma_rx", "dma_tx", "dma_rt";
            clocks = <&cpg CPG_MOD R9A07G044_SSI0_PCLK2>,
                     <&cpg CPG_MOD R9A07G044_SSI0_PCLK_SFR>,
                     <&audio_clk1>,
                     <&audio_clk2>;
            clock-names = "ssi", "ssi_sfr", "audio_clk1", "audio_clk2";
            power-domains = <&cpg>;
            resets = <&cpg R9A07G044_SSI0_RST_M2_REG>;
            dmas = <&dmac 0x2655>,
                   <&dmac 0x2656>;
            dma-names = "tx", "rx";
            #sound-dai-cells = <0>;
    };


code:
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/richtek,rt9120.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Richtek RT9120 Class-D audio amplifier

maintainers:
  - ChiYuan Huang <cy_huang@richtek.com>

description: |
  The RT9120 is a high efficiency, I2S-input, stereo audio power amplifier
  delivering 2*20W into 8 Ohm BTL speaker loads. It supports the wide input
  voltage  range from 4.5V to 26.4V to meet the need on most common
  applications like as TV, monitors. home entertainment, electronic music
  equipment.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - richtek,rt9120

  reg:
    description: I2C device address
    maxItems: 1

  pwdnn-gpios:
    description: GPIO used for power down, low active
    maxItems: 1

  dvdd-supply:
    description: |
      Supply for the default on DVDD power, voltage domain must be 3P3V or 1P8V

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - reg
  - dvdd-supply
  - '#sound-dai-cells'

unevaluatedProperties: false

examples:
  - |
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;
      rt9120@1a {
        compatible = "richtek,rt9120";
        reg = <0x1a>;
        pwdnn-gpios = <&gpio26 2 0>;
        dvdd-supply = <&vdd_io_reg>;
        #sound-dai-cells = <0>;
      };
    };


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/rockchip,i2s-tdm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip I2S/TDM Controller

description:
  The Rockchip I2S/TDM Controller is a Time Division Multiplexed
  audio interface found in various Rockchip SoCs, allowing up
  to 8 channels of audio over a serial interface.

maintainers:
  - Nicolas Frattaroli <frattaroli.nicolas@gmail.com>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - rockchip,px30-i2s-tdm
      - rockchip,rk1808-i2s-tdm
      - rockchip,rk3308-i2s-tdm
      - rockchip,rk3568-i2s-tdm
      - rockchip,rk3588-i2s-tdm
      - rockchip,rv1126-i2s-tdm

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  dmas:
    minItems: 1
    maxItems: 2

  dma-names:
    minItems: 1
    maxItems: 2
    items:
      enum:
        - rx
        - tx

  clocks:
    minItems: 3
    items:
      - description: clock for TX
      - description: clock for RX
      - description: AHB clock driving the interface
      - description:
          Parent clock for mclk_tx (only required when using mclk-calibrate)
      - description:
          Parent clock for mclk_rx (only required when using mclk-calibrate)
      - description:
          Clock for sample rates that are an integer multiple of 8000
          (only required when using mclk-calibrate)
      - description:
          Clock for sample rates that are an integer multiple of 11025
          (only required when using mclk-calibrate)

  clock-names:
    minItems: 3
    items:
      - const: mclk_tx
      - const: mclk_rx
      - const: hclk
      - const: mclk_tx_src
      - const: mclk_rx_src
      - const: mclk_root0
      - const: mclk_root1

  resets:
    minItems: 1
    maxItems: 2
    description: resets for the tx and rx directions

  reset-names:
    minItems: 1
    maxItems: 2
    items:
      enum:
        - tx-m
        - rx-m

  rockchip,grf:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      The phandle of the syscon node for the GRF register.

  rockchip,trcm-sync-tx-only:
    type: boolean
    description: Use TX BCLK/LRCK for both TX and RX.

  rockchip,trcm-sync-rx-only:
    type: boolean
    description: Use RX BCLK/LRCK for both TX and RX.

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

  rockchip,i2s-rx-route:
    $ref: /schemas/types.yaml#/definitions/uint32-array
    description:
      Defines the mapping of I2S RX sdis to I2S data bus lines.
      By default, they are mapped one-to-one.
      rockchip,i2s-rx-route = <3> would mean sdi3 is receiving from data0.
    maxItems: 4
    items:
      enum: [0, 1, 2, 3]

  rockchip,i2s-tx-route:
    $ref: /schemas/types.yaml#/definitions/uint32-array
    description:
      Defines the mapping of I2S TX sdos to I2S data bus lines.
      By default, they are mapped one-to-one.
      rockchip,i2s-tx-route = <3> would mean sdo3 is sending to data0.
    maxItems: 4
    items:
      enum: [0, 1, 2, 3]

  rockchip,io-multiplex:
    description:
      Specify that the GPIO lines on the I2S bus are multiplexed such that
      the direction (input/output) needs to be dynamically adjusted.
    type: boolean

required:
  - compatible
  - reg
  - interrupts
  - dmas
  - dma-names
  - clocks
  - clock-names
  - resets
  - reset-names
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/clock/rk3568-cru.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/pinctrl/rockchip.h>

    bus {
        #address-cells = <2>;
        #size-cells = <2>;
        i2s@fe410000 {
            compatible = "rockchip,rk3568-i2s-tdm";
            reg = <0x0 0xfe410000 0x0 0x1000>;
            interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
            clocks = <&cru MCLK_I2S1_8CH_TX>, <&cru MCLK_I2S1_8CH_RX>,
                     <&cru HCLK_I2S1_8CH>;
            clock-names = "mclk_tx", "mclk_rx", "hclk";
            dmas = <&dmac1 3>, <&dmac1 2>;
            dma-names = "rx", "tx";
            resets = <&cru SRST_M_I2S1_8CH_TX>, <&cru SRST_M_I2S1_8CH_RX>;
            reset-names = "tx-m", "rx-m";
            rockchip,trcm-sync-tx-only;
            rockchip,grf = <&grf>;
            #sound-dai-cells = <0>;
            pinctrl-names = "default";
            pinctrl-0 =
                <&i2s1m0_sclktx
                &i2s1m0_sclkrx
                &i2s1m0_lrcktx
                &i2s1m0_lrckrx
                &i2s1m0_sdi0
                &i2s1m0_sdi1
                &i2s1m0_sdi2
                &i2s1m0_sdi3
                &i2s1m0_sdo0
                &i2s1m0_sdo1
                &i2s1m0_sdo2
                &i2s1m0_sdo3>;
        };
    };


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/rockchip,pdm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip PDM controller

description:
  The Pulse Density Modulation Interface Controller (PDMC) is
  a PDM interface controller and decoder that support PDM format.
  It integrates a clock generator driving the PDM microphone
  and embeds filters which decimate the incoming bit stream to
  obtain most common audio rates.

maintainers:
  - Heiko Stuebner <heiko@sntech.de>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - rockchip,pdm
      - rockchip,px30-pdm
      - rockchip,rk1808-pdm
      - rockchip,rk3308-pdm
      - rockchip,rk3568-pdm
      - rockchip,rv1126-pdm

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  clocks:
    items:
      - description: clock for PDM controller
      - description: clock for PDM BUS

  clock-names:
    items:
      - const: pdm_clk
      - const: pdm_hclk

  dmas:
    maxItems: 1

  dma-names:
    items:
      - const: rx

  power-domains:
    maxItems: 1

  resets:
    items:
      - description: reset for PDM controller

  reset-names:
    items:
      - const: pdm-m

  rockchip,path-map:
    $ref: /schemas/types.yaml#/definitions/uint32-array
    description:
      Defines the mapping of PDM SDIx to PDM PATHx.
      By default, they are mapped one-to-one.
    maxItems: 4
    uniqueItems: true
    items:
      enum: [ 0, 1, 2, 3 ]

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

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - dmas
  - dma-names
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/clock/rk3328-cru.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/pinctrl/rockchip.h>

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

        pdm@ff040000 {
            compatible = "rockchip,pdm";
            reg = <0x0 0xff040000 0x0 0x1000>;
            interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
            clocks = <&cru SCLK_PDM>, <&cru HCLK_PDM>;
            clock-names = "pdm_clk", "pdm_hclk";
            dmas = <&dmac 16>;
            dma-names = "rx";
            #sound-dai-cells = <0>;
            pinctrl-names = "default", "sleep";
            pinctrl-0 = <&pdmm0_clk
                         &pdmm0_sdi0
                         &pdmm0_sdi1
                         &pdmm0_sdi2
                         &pdmm0_sdi3>;
            pinctrl-1 = <&pdmm0_clk_sleep
                         &pdmm0_sdi0_sleep
                         &pdmm0_sdi1_sleep
                         &pdmm0_sdi2_sleep
                         &pdmm0_sdi3_sleep>;
        };
    };


code:
ROCKCHIP RK3288 with HDMI and analog audio

Required properties:
- compatible: "rockchip,rk3288-hdmi-analog"
- rockchip,model: The user-visible name of this sound complex
- rockchip,i2s-controller: The phandle of the Rockchip I2S controller that's
  connected to the CODEC
- rockchip,audio-codec: The phandle of the analog audio codec.
- rockchip,routing: A list of the connections between audio components.
		    Each entry is a pair of strings, the first being the
		    connection's sink, the second being the connection's
		    source. For this driver the first string should always be
		    "Analog".

Optionnal properties:
- rockchip,hp-en-gpios = The phandle of the GPIO that power up/down the
  headphone (when the analog output is an headphone).
- rockchip,hp-det-gpios = The phandle of the GPIO that detects the headphone
  (when the analog output is an headphone).
- pinctrl-names, pinctrl-0: Please refer to pinctrl-bindings.txt

Example:

sound {
	compatible = "rockchip,rk3288-hdmi-analog";
	rockchip,model = "Analog audio output";
	rockchip,i2s-controller = <&i2s>;
	rockchip,audio-codec = <&es8388>;
	rockchip,routing = "Analog", "LOUT2",
			   "Analog", "ROUT2";
	rockchip,hp-en-gpios = <&gpio8 0 GPIO_ACTIVE_HIGH>;
	rockchip,hp-det-gpios = <&gpio7 7 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default";
	pinctrl-0 = <&headphone>;
};


code:
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/rockchip,rk3328-codec.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip rk3328 internal codec

maintainers:
  - Heiko Stuebner <heiko@sntech.de>
allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    const: rockchip,rk3328-codec

  reg:
    maxItems: 1

  clocks:
    items:
      - description: clock for audio codec
      - description: clock for I2S master clock

  clock-names:
    items:
      - const: pclk
      - const: mclk

  rockchip,grf:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      The phandle of the syscon node for the GRF register.

  spk-depop-time-ms:
    default: 200
    description:
      Speaker depop time in msec.

  mute-gpios:
    maxItems: 1
    description:
      GPIO specifier for external line driver control (typically the
      dedicated GPIO_MUTE pin)

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

required:
  - compatible
  - reg
  - clocks
  - clock-names
  - rockchip,grf
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/clock/rk3328-cru.h>
    codec: codec@ff410000 {
      compatible = "rockchip,rk3328-codec";
      reg = <0xff410000 0x1000>;
      clocks = <&cru PCLK_ACODECPHY>, <&cru SCLK_I2S1>;
      clock-names = "pclk", "mclk";
      rockchip,grf = <&grf>;
      mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>;
      spk-depop-time-ms = <100>;
      #sound-dai-cells = <0>;
    };


code:
ROCKCHIP with MAX98357A/RT5514/DA7219 codecs on GRU boards

Required properties:
- compatible: "rockchip,rk3399-gru-sound"
- rockchip,cpu: The phandle of the Rockchip I2S controller that's
  connected to the codecs
- rockchip,codec: The phandle of the audio codecs

Optional properties:
- dmic-wakeup-delay-ms : specify delay time (ms) for DMIC ready.
  If this option is specified, which means it's required dmic need
  delay for DMIC to ready so that rt5514 can avoid recording before
  DMIC send valid data

Example:

sound {
	compatible = "rockchip,rk3399-gru-sound";
	rockchip,cpu = <&i2s0>;
	rockchip,codec = <&max98357a &rt5514 &da7219>;
	dmic-wakeup-delay-ms = <20>;
};


code:
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/rockchip-i2s.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip I2S controller

description:
  The I2S bus (Inter-IC sound bus) is a serial link for digital
  audio data transfer between devices in the system.

maintainers:
  - Heiko Stuebner <heiko@sntech.de>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    oneOf:
      - const: rockchip,rk3066-i2s
      - items:
          - enum:
              - rockchip,px30-i2s
              - rockchip,rk1808-i2s
              - rockchip,rk3036-i2s
              - rockchip,rk3128-i2s
              - rockchip,rk3188-i2s
              - rockchip,rk3228-i2s
              - rockchip,rk3288-i2s
              - rockchip,rk3308-i2s
              - rockchip,rk3328-i2s
              - rockchip,rk3366-i2s
              - rockchip,rk3368-i2s
              - rockchip,rk3399-i2s
              - rockchip,rv1126-i2s
          - const: rockchip,rk3066-i2s

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  clocks:
    items:
      - description: clock for I2S controller
      - description: clock for I2S BUS

  clock-names:
    items:
      - const: i2s_clk
      - const: i2s_hclk

  dmas:
    minItems: 1
    maxItems: 2

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

  pinctrl-names:
    oneOf:
      - const: default
      - items:
          - const: bclk_on
          - const: bclk_off

  power-domains:
    maxItems: 1

  reset-names:
    items:
      - const: reset-m
      - const: reset-h

  resets:
    maxItems: 2

  rockchip,capture-channels:
    $ref: /schemas/types.yaml#/definitions/uint32
    default: 2
    description:
      Max capture channels, if not set, 2 channels default.

  rockchip,playback-channels:
    $ref: /schemas/types.yaml#/definitions/uint32
    default: 8
    description:
      Max playback channels, if not set, 8 channels default.

  rockchip,grf:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      The phandle of the syscon node for the GRF register.
      Required property for controllers which support multi channel
      playback/capture.

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

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - dmas
  - dma-names
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/clock/rk3288-cru.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    i2s@ff890000 {
      compatible = "rockchip,rk3288-i2s", "rockchip,rk3066-i2s";
      reg = <0xff890000 0x10000>;
      interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
      clocks = <&cru SCLK_I2S0>, <&cru HCLK_I2S0>;
      clock-names = "i2s_clk", "i2s_hclk";
      dmas = <&pdma1 0>, <&pdma1 1>;
      dma-names = "tx", "rx";
      rockchip,capture-channels = <2>;
      rockchip,playback-channels = <8>;
      #sound-dai-cells = <0>;
    };