[PATCH] ASoC: dt-bindings: qcom,sdm845: convert to dtschema

Krzysztof Kozlowski krzysztof.kozlowski at linaro.org
Mon Jul 4 17:38:24 CEST 2022


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 at 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

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 at 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>;
+            };
+        };
+    };
-- 
2.34.1



More information about the Alsa-devel mailing list