diff mbox series

[v2,09/14] ASoC: dt-bindings:: qcom,q6asm: convert to dtschema

Message ID 20220907101556.37394-10-krzysztof.kozlowski@linaro.org (mailing list archive)
State Superseded
Headers show
Series ASoC/qcom/arm64: Qualcomm ADSP DTS and binding fixes | expand

Commit Message

Krzysztof Kozlowski Sept. 7, 2022, 10:15 a.m. UTC
Convert Qualcomm Audio Stream Manager (Q6ASM) bindings to DT schema.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Expected warning because the qcom,apr.yaml is being fixed in next commit:

  Documentation/devicetree/bindings/sound/qcom,q6asm.example.dtb: apr: service@7: 'dais' does not match any of the regexes: '^.*@[0-9a-f]+$', 'pinctrl-[0-9]+'
    From schema: /home/krzk/dev/linux/linux/Documentation/devicetree/bindings/soc/qcom/qcom,apr.yaml

Changes since v1:
1. New patch.
---
 .../devicetree/bindings/sound/qcom,q6asm.txt  |  70 -----------
 .../devicetree/bindings/sound/qcom,q6asm.yaml | 112 ++++++++++++++++++
 2 files changed, 112 insertions(+), 70 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/qcom,q6asm.txt
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6asm.yaml

Comments

Rob Herring (Arm) Sept. 7, 2022, 5:57 p.m. UTC | #1
On Wed, Sep 07, 2022 at 12:15:51PM +0200, Krzysztof Kozlowski wrote:
> Convert Qualcomm Audio Stream Manager (Q6ASM) bindings to DT schema.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Expected warning because the qcom,apr.yaml is being fixed in next commit:
> 
>   Documentation/devicetree/bindings/sound/qcom,q6asm.example.dtb: apr: service@7: 'dais' does not match any of the regexes: '^.*@[0-9a-f]+$', 'pinctrl-[0-9]+'
>     From schema: /home/krzk/dev/linux/linux/Documentation/devicetree/bindings/soc/qcom/qcom,apr.yaml
> 
> Changes since v1:
> 1. New patch.
> ---
>  .../devicetree/bindings/sound/qcom,q6asm.txt  |  70 -----------
>  .../devicetree/bindings/sound/qcom,q6asm.yaml | 112 ++++++++++++++++++
>  2 files changed, 112 insertions(+), 70 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/sound/qcom,q6asm.txt
>  create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6asm.yaml

Should be qcom,q6asm-dais.yaml or you need to add qcom,q6asm compatible?

> 
> diff --git a/Documentation/devicetree/bindings/sound/qcom,q6asm.txt b/Documentation/devicetree/bindings/sound/qcom,q6asm.txt
> deleted file mode 100644
> index 0d0075125243..000000000000
> --- a/Documentation/devicetree/bindings/sound/qcom,q6asm.txt
> +++ /dev/null
> @@ -1,70 +0,0 @@
> -Qualcomm Audio Stream Manager (Q6ASM) binding
> -
> -Q6ASM is one of the APR audio service on Q6DSP.
> -Please refer to qcom,apr.txt for details of the common apr service bindings
> -used by the apr service device.
> -
> -- but must contain the following property:
> -
> -- compatible:
> -	Usage: required
> -	Value type: <stringlist>
> -	Definition: must be "qcom,q6asm-v<MAJOR-NUMBER>.<MINOR-NUMBER>".
> -		    Or "qcom,q6asm" where the version number can be queried
> -		    from DSP.
> -		    example "qcom,q6asm-v2.0"

Where is this compatible handled now? 

> -
> -= ASM DAIs (Digital Audio Interface)
> -"dais" subnode of the ASM node represents dai specific configuration
> -
> -- compatible:
> -	Usage: required
> -	Value type: <stringlist>
> -	Definition: must be "qcom,q6asm-dais".
> -
> -- #sound-dai-cells
> -	Usage: required
> -	Value type: <u32>
> -	Definition: Must be 1
> -
> -== ASM DAI is subnode of "dais" and represent a dai, it includes board specific
> -configuration of each dai. Must contain the following properties.
> -
> -- reg
> -	Usage: required
> -	Value type: <u32>
> -	Definition: Must be dai id
> -
> -- direction:
> -	Usage: Required for Compress offload dais
> -	Value type: <u32>
> -	Definition: Specifies 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:
> -	Usage: Required for Compress offload dais
> -	Value type: <boolean>
> -	Definition: present for Compress offload dais
> -
> -
> -= EXAMPLE
> -#include <dt-bindings/sound/qcom,q6asm.h>
> -
> -apr-service@7 {
> -	compatible = "qcom,q6asm";
> -	reg = <APR_SVC_ASM>;
> -	q6asmdai: dais {
> -		compatible = "qcom,q6asm-dais";
> -		#address-cells = <1>;
> -		#size-cells = <0>;
> -		#sound-dai-cells = <1>;
> -
> -		dai@0 {
> -			reg = <0>;
> -			direction = <Q6ASM_DAI_RX>;
> -			is-compress-dai;
> -		};
> -	};
> -};
> diff --git a/Documentation/devicetree/bindings/sound/qcom,q6asm.yaml b/Documentation/devicetree/bindings/sound/qcom,q6asm.yaml
> new file mode 100644
> index 000000000000..505bd64a0717
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/qcom,q6asm.yaml
> @@ -0,0 +1,112 @@
> +# 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>
> +
> +description:
> +  Q6ASM is one of the APR audio services on Q6DSP. Each of its subnodes
> +  represent a dai with board specific configuration.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,q6asm-dais
> +
> +  iommus:
> +    maxItems: 1
> +
> +  '#sound-dai-cells':
> +    const: 1
> +
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
> +patternProperties:
> +  '^dai@[0-9]+$':
> +    type: object
> +    description:
> +      Q6ASM Digital Audio Interface
> +
> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +      direction:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        enum: [0, 1, 2]
> +        description: |
> +          The direction of the dai stream::
> +           - Q6ASM_DAI_TX_RX (0) for both tx and rx
> +           - Q6ASM_DAI_TX (1) for only tx (Capture/Encode)
> +           - Q6ASM_DAI_RX (2) for only rx (Playback/Decode)
> +
> +      is-compress-dai:
> +        type: boolean
> +        description:
> +          Compress offload dai.
> +
> +    dependencies:
> +      is-compress-dai: ['direction']
> +
> +    required:
> +      - reg
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - "#sound-dai-cells"
> +  - "#address-cells"
> +  - "#size-cells"
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/soc/qcom,apr.h>
> +    #include <dt-bindings/sound/qcom,q6asm.h>
> +
> +    apr {
> +        compatible = "qcom,apr-v2";
> +        qcom,domain = <APR_DOMAIN_ADSP>;
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        service@7 {
> +            compatible = "qcom,q6asm";
> +            reg = <APR_SVC_ASM>;
> +            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";
> +
> +            dais {
> +                compatible = "qcom,q6asm-dais";
> +                iommus = <&apps_smmu 0x1821 0x0>;
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +                #sound-dai-cells = <1>;
> +
> +                dai@0 {
> +                    reg = <0>;
> +                };
> +
> +                dai@1 {
> +                    reg = <1>;
> +                };
> +
> +                dai@2 {
> +                    reg = <2>;
> +                    is-compress-dai;
> +                    direction = <1>;
> +                };
> +            };
> +        };
> +    };
> -- 
> 2.34.1
> 
>
Krzysztof Kozlowski Sept. 8, 2022, 9:05 a.m. UTC | #2
On 07/09/2022 19:57, Rob Herring wrote:
> On Wed, Sep 07, 2022 at 12:15:51PM +0200, Krzysztof Kozlowski wrote:
>> Convert Qualcomm Audio Stream Manager (Q6ASM) bindings to DT schema.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
>>
>> Expected warning because the qcom,apr.yaml is being fixed in next commit:
>>
>>   Documentation/devicetree/bindings/sound/qcom,q6asm.example.dtb: apr: service@7: 'dais' does not match any of the regexes: '^.*@[0-9a-f]+$', 'pinctrl-[0-9]+'
>>     From schema: /home/krzk/dev/linux/linux/Documentation/devicetree/bindings/soc/qcom/qcom,apr.yaml
>>
>> Changes since v1:
>> 1. New patch.
>> ---
>>  .../devicetree/bindings/sound/qcom,q6asm.txt  |  70 -----------
>>  .../devicetree/bindings/sound/qcom,q6asm.yaml | 112 ++++++++++++++++++
>>  2 files changed, 112 insertions(+), 70 deletions(-)
>>  delete mode 100644 Documentation/devicetree/bindings/sound/qcom,q6asm.txt
>>  create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6asm.yaml
> 
> Should be qcom,q6asm-dais.yaml or you need to add qcom,q6asm compatible?

Right, it should be -dais.

> 
>>
>> diff --git a/Documentation/devicetree/bindings/sound/qcom,q6asm.txt b/Documentation/devicetree/bindings/sound/qcom,q6asm.txt
>> deleted file mode 100644
>> index 0d0075125243..000000000000
>> --- a/Documentation/devicetree/bindings/sound/qcom,q6asm.txt
>> +++ /dev/null
>> @@ -1,70 +0,0 @@
>> -Qualcomm Audio Stream Manager (Q6ASM) binding
>> -
>> -Q6ASM is one of the APR audio service on Q6DSP.
>> -Please refer to qcom,apr.txt for details of the common apr service bindings
>> -used by the apr service device.
>> -
>> -- but must contain the following property:
>> -
>> -- compatible:
>> -	Usage: required
>> -	Value type: <stringlist>
>> -	Definition: must be "qcom,q6asm-v<MAJOR-NUMBER>.<MINOR-NUMBER>".
>> -		    Or "qcom,q6asm" where the version number can be queried
>> -		    from DSP.
>> -		    example "qcom,q6asm-v2.0"
> 
> Where is this compatible handled now? 

The "qcom,q6asm" is handled in:
Documentation/devicetree/bindings/soc/qcom/qcom,apr.yaml

The "qcom,q6asm-v<MAJOR-NUMBER>.<MINOR-NUMBER>" is not handled because
it seems it is not used anywhere. I did not find such usage also in
downstream sources, so it seems version can be always auto-detected (I
did not confirm it with datasheet, though).

I'll explain this in commit msg.



Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/qcom,q6asm.txt b/Documentation/devicetree/bindings/sound/qcom,q6asm.txt
deleted file mode 100644
index 0d0075125243..000000000000
--- a/Documentation/devicetree/bindings/sound/qcom,q6asm.txt
+++ /dev/null
@@ -1,70 +0,0 @@ 
-Qualcomm Audio Stream Manager (Q6ASM) binding
-
-Q6ASM is one of the APR audio service on Q6DSP.
-Please refer to qcom,apr.txt for details of the common apr service bindings
-used by the apr service device.
-
-- but must contain the following property:
-
-- compatible:
-	Usage: required
-	Value type: <stringlist>
-	Definition: must be "qcom,q6asm-v<MAJOR-NUMBER>.<MINOR-NUMBER>".
-		    Or "qcom,q6asm" where the version number can be queried
-		    from DSP.
-		    example "qcom,q6asm-v2.0"
-
-= ASM DAIs (Digital Audio Interface)
-"dais" subnode of the ASM node represents dai specific configuration
-
-- compatible:
-	Usage: required
-	Value type: <stringlist>
-	Definition: must be "qcom,q6asm-dais".
-
-- #sound-dai-cells
-	Usage: required
-	Value type: <u32>
-	Definition: Must be 1
-
-== ASM DAI is subnode of "dais" and represent a dai, it includes board specific
-configuration of each dai. Must contain the following properties.
-
-- reg
-	Usage: required
-	Value type: <u32>
-	Definition: Must be dai id
-
-- direction:
-	Usage: Required for Compress offload dais
-	Value type: <u32>
-	Definition: Specifies 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:
-	Usage: Required for Compress offload dais
-	Value type: <boolean>
-	Definition: present for Compress offload dais
-
-
-= EXAMPLE
-#include <dt-bindings/sound/qcom,q6asm.h>
-
-apr-service@7 {
-	compatible = "qcom,q6asm";
-	reg = <APR_SVC_ASM>;
-	q6asmdai: dais {
-		compatible = "qcom,q6asm-dais";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		#sound-dai-cells = <1>;
-
-		dai@0 {
-			reg = <0>;
-			direction = <Q6ASM_DAI_RX>;
-			is-compress-dai;
-		};
-	};
-};
diff --git a/Documentation/devicetree/bindings/sound/qcom,q6asm.yaml b/Documentation/devicetree/bindings/sound/qcom,q6asm.yaml
new file mode 100644
index 000000000000..505bd64a0717
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/qcom,q6asm.yaml
@@ -0,0 +1,112 @@ 
+# 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>
+
+description:
+  Q6ASM is one of the APR audio services on Q6DSP. Each of its subnodes
+  represent a dai with board specific configuration.
+
+properties:
+  compatible:
+    enum:
+      - qcom,q6asm-dais
+
+  iommus:
+    maxItems: 1
+
+  '#sound-dai-cells':
+    const: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  '^dai@[0-9]+$':
+    type: object
+    description:
+      Q6ASM Digital Audio Interface
+
+    properties:
+      reg:
+        maxItems: 1
+
+      direction:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2]
+        description: |
+          The direction of the dai stream::
+           - Q6ASM_DAI_TX_RX (0) for both tx and rx
+           - Q6ASM_DAI_TX (1) for only tx (Capture/Encode)
+           - Q6ASM_DAI_RX (2) for only rx (Playback/Decode)
+
+      is-compress-dai:
+        type: boolean
+        description:
+          Compress offload dai.
+
+    dependencies:
+      is-compress-dai: ['direction']
+
+    required:
+      - reg
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - "#sound-dai-cells"
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/qcom,apr.h>
+    #include <dt-bindings/sound/qcom,q6asm.h>
+
+    apr {
+        compatible = "qcom,apr-v2";
+        qcom,domain = <APR_DOMAIN_ADSP>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        service@7 {
+            compatible = "qcom,q6asm";
+            reg = <APR_SVC_ASM>;
+            qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";
+
+            dais {
+                compatible = "qcom,q6asm-dais";
+                iommus = <&apps_smmu 0x1821 0x0>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+                #sound-dai-cells = <1>;
+
+                dai@0 {
+                    reg = <0>;
+                };
+
+                dai@1 {
+                    reg = <1>;
+                };
+
+                dai@2 {
+                    reg = <2>;
+                    is-compress-dai;
+                    direction = <1>;
+                };
+            };
+        };
+    };