diff mbox series

ASoC: dt-bindings: qcom,sdm845: convert to dtschema

Message ID 20220704153824.23226-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State New, archived
Headers show
Series ASoC: dt-bindings: qcom,sdm845: convert to dtschema | expand

Commit Message

Krzysztof Kozlowski July 4, 2022, 3:38 p.m. UTC
Convert the Samsung SDM845 sound card bindings to DT schema.

Changes during conversion: do not require 'codec' under dai-links - not
present in all nodes of examples and DTS; not required by the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 .../devicetree/bindings/sound/qcom,sdm845.txt |  91 ----------
 .../bindings/sound/qcom,sdm845.yaml           | 166 ++++++++++++++++++
 2 files changed, 166 insertions(+), 91 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.yaml

Comments

Stephan Gerhold July 4, 2022, 4:50 p.m. UTC | #1
On Mon, Jul 04, 2022 at 05:38:24PM +0200, Krzysztof Kozlowski wrote:
> Convert the Samsung SDM845 sound card bindings to DT schema.
> 

Nitpick: s/Samsung/Qualcomm

> Changes during conversion: do not require 'codec' under dai-links - not
> present in all nodes of examples and DTS; not required by the driver.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  .../devicetree/bindings/sound/qcom,sdm845.txt |  91 ----------
>  .../bindings/sound/qcom,sdm845.yaml           | 166 ++++++++++++++++++
>  2 files changed, 166 insertions(+), 91 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
>  create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.yaml
> 

Can you check if you can just add the compatibles to the existing
qcom,sm8250.yaml? It should be more or less identical given that the DT
parsing code in the driver is shared between all these SoCs.
I already added the MSM8916 compatibles there a while ago.

It also documents some additional properties ("pin-switches", "widgets")
that are supported for SDM845 through the common code but are missing
in its binding documentation.

Thanks,
Stephan
Krzysztof Kozlowski July 5, 2022, 7:32 a.m. UTC | #2
On 04/07/2022 18:50, Stephan Gerhold wrote:
> On Mon, Jul 04, 2022 at 05:38:24PM +0200, Krzysztof Kozlowski wrote:
>> Convert the Samsung SDM845 sound card bindings to DT schema.
>>
> 
> Nitpick: s/Samsung/Qualcomm

Yes, thanks.

> 
>> Changes during conversion: do not require 'codec' under dai-links - not
>> present in all nodes of examples and DTS; not required by the driver.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>  .../devicetree/bindings/sound/qcom,sdm845.txt |  91 ----------
>>  .../bindings/sound/qcom,sdm845.yaml           | 166 ++++++++++++++++++
>>  2 files changed, 166 insertions(+), 91 deletions(-)
>>  delete mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
>>  create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.yaml
>>
> 
> Can you check if you can just add the compatibles to the existing
> qcom,sm8250.yaml? It should be more or less identical given that the DT
> parsing code in the driver is shared between all these SoCs.
> I already added the MSM8916 compatibles there a while ago.
> 
> It also documents some additional properties ("pin-switches", "widgets")
> that are supported for SDM845 through the common code but are missing
> in its binding documentation.

I thought about merging these but then I would have to disallow these
properties, as I assumed these are not valid for SDM845. Are you saying
that pin-switches and widgets are actually valid for SDM845?

Best regards,
Krzysztof
Stephan Gerhold July 5, 2022, 5:22 p.m. UTC | #3
On Tue, Jul 05, 2022 at 09:32:07AM +0200, Krzysztof Kozlowski wrote:
> On 04/07/2022 18:50, Stephan Gerhold wrote:
> > Can you check if you can just add the compatibles to the existing
> > qcom,sm8250.yaml? It should be more or less identical given that the DT
> > parsing code in the driver is shared between all these SoCs.
> > I already added the MSM8916 compatibles there a while ago.
> > 
> > It also documents some additional properties ("pin-switches", "widgets")
> > that are supported for SDM845 through the common code but are missing
> > in its binding documentation.
> 
> I thought about merging these but then I would have to disallow these
> properties, as I assumed these are not valid for SDM845. Are you saying
> that pin-switches and widgets are actually valid for SDM845?
> 

Yes. I haven't tested it but it's implemented in the common DT parsing
code and I don't see why it wouldn't work. These are optional properties
that are only needed in certain special audio configurations. There
might be a SDM845 board out there that needs them. :)

Thanks,
Stephan
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/qcom,sdm845.txt b/Documentation/devicetree/bindings/sound/qcom,sdm845.txt
deleted file mode 100644
index de4c604641da..000000000000
--- a/Documentation/devicetree/bindings/sound/qcom,sdm845.txt
+++ /dev/null
@@ -1,91 +0,0 @@ 
-* Qualcomm Technologies Inc. SDM845 ASoC sound card driver
-
-This binding describes the SDM845 sound card, which uses qdsp for audio.
-
-- compatible:
-	Usage: required
-	Value type: <stringlist>
-	Definition: must be one of this
-			"qcom,sdm845-sndcard"
-			"qcom,db845c-sndcard"
-			"lenovo,yoga-c630-sndcard"
-
-- audio-routing:
-	Usage: Optional
-	Value type: <stringlist>
-	Definition:  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.
-
-- model:
-	Usage: required
-	Value type: <stringlist>
-	Definition: The user-visible name of this sound card.
-
-- aux-devs
-	Usage: optional
-	Value type: <array of phandles>
-	Definition: A list of phandles for auxiliary devices (e.g. analog
-		    amplifiers) that do not appear directly within the DAI
-		    links. Should be connected to another audio component
-		    using "audio-routing".
-
-= dailinks
-Each subnode of sndcard represents either a dailink, and subnodes of each
-dailinks would be cpu/codec/platform dais.
-
-- link-name:
-	Usage: required
-	Value type: <string>
-	Definition: User friendly name for dai link
-
-= CPU, PLATFORM, CODEC dais subnodes
-- cpu:
-	Usage: required
-	Value type: <subnode>
-	Definition: cpu dai sub-node
-
-- codec:
-	Usage: required
-	Value type: <subnode>
-	Definition: codec dai sub-node
-
-- platform:
-	Usage: Optional
-	Value type: <subnode>
-	Definition: platform dai sub-node
-
-- sound-dai:
-	Usage: required
-	Value type: <phandle>
-	Definition: dai phandle/s and port of CPU/CODEC/PLATFORM node.
-
-Example:
-
-audio {
-	compatible = "qcom,sdm845-sndcard";
-	model = "sdm845-snd-card";
-	pinctrl-names = "default", "sleep";
-	pinctrl-0 = <&pri_mi2s_active &pri_mi2s_ws_active>;
-	pinctrl-1 = <&pri_mi2s_sleep &pri_mi2s_ws_sleep>;
-
-	mm1-dai-link {
-		link-name = "MultiMedia1";
-		cpu {
-			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
-		};
-	};
-
-	pri-mi2s-dai-link {
-		link-name = "PRI MI2S Playback";
-		cpu {
-			sound-dai = <&q6afedai PRIMARY_MI2S_RX>;
-		};
-
-		platform {
-			sound-dai = <&q6routing>;
-		};
-	};
-};
diff --git a/Documentation/devicetree/bindings/sound/qcom,sdm845.yaml b/Documentation/devicetree/bindings/sound/qcom,sdm845.yaml
new file mode 100644
index 000000000000..5e7e6b051cf0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/qcom,sdm845.yaml
@@ -0,0 +1,166 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/qcom,sdm845.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Technologies Inc. SDM845 ASoC sound card
+
+maintainers:
+  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+
+properties:
+  compatible:
+    enum:
+      - qcom,sdm845-sndcard
+      - qcom,db845c-sndcard
+      - lenovo,yoga-c630-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 for auxiliary devices (e.g. analog amplifiers) that do
+      not appear directly within the DAI links. Should be connected to another
+      audio component using "audio-routing".
+
+  model:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: User-visible sound card name
+
+patternProperties:
+  ".*-dai-link$":
+    type: object
+    description:
+      Each subnode represents a dai link. Subnodes of each dai links would be
+      cpu/codec dais.
+
+    properties:
+      link-name:
+        $ref: /schemas/types.yaml#/definitions/string
+        description: User friendly name for dai link.
+
+      cpu:
+        type: object
+        description: CPU DAI subnode.
+        properties:
+          sound-dai:
+            maxItems: 1
+
+      codec:
+        type: object
+        description: Codec DAI subnode.
+        properties:
+          sound-dai:
+            minItems: 1
+            maxItems: 4
+
+      platform:
+        type: object
+        description: Platform DAI subnode.
+        properties:
+          sound-dai:
+            maxItems: 1
+
+    required:
+      - link-name
+      - cpu
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - model
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/sound/qcom,q6afe.h>
+    #include <dt-bindings/sound/qcom,q6asm.h>
+
+    sound {
+        compatible = "qcom,sdm845-sndcard";
+        model = "Samsung-W737";
+
+        audio-routing = "RX_BIAS", "MCLK",
+                        "AMIC2", "MIC BIAS2",
+                        "SpkrLeft IN", "SPK1 OUT",
+                        "SpkrRight IN", "SPK2 OUT",
+                        "MM_DL1",  "MultiMedia1 Playback",
+                        "MM_DL3",  "MultiMedia3 Playback",
+                        "MultiMedia2 Capture", "MM_UL2";
+
+        mm1-dai-link {
+            link-name = "MultiMedia1";
+            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>;
+            };
+        };
+
+        slim-dai-link {
+            link-name = "SLIM Playback";
+            cpu {
+                sound-dai = <&q6afedai SLIMBUS_0_RX>;
+            };
+
+            platform {
+                sound-dai = <&q6routing>;
+            };
+
+            codec {
+                sound-dai = <&left_spkr>, <&right_spkr>, <&swm 0>, <&wcd9340 0>;
+            };
+        };
+
+        slimcap-dai-link {
+            link-name = "SLIM Capture";
+            cpu {
+                sound-dai = <&q6afedai SLIMBUS_0_TX>;
+            };
+
+            platform {
+                sound-dai = <&q6routing>;
+            };
+
+            codec {
+                sound-dai = <&wcd9340 1>;
+            };
+        };
+
+        slim-wcd-dai-link {
+            link-name = "SLIM WCD Playback";
+            cpu {
+                sound-dai = <&q6afedai SLIMBUS_1_RX>;
+            };
+
+            platform {
+                sound-dai = <&q6routing>;
+            };
+
+            codec {
+                sound-dai = <&wcd9340 2>;
+            };
+        };
+    };