Skip to contentSkip to conversation

Convert name-prefix doc to json-schema

PATCH Superseded Sameer Pujar 2 participants 5 messages Sep 1, 2021

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Convert name-prefix doc to json-schema

Following are the changes:
- Add json-schema for 'sound-name-prefix' documentation under 'name-perfix.yaml'
- Use schema references wherever needed.
- Remove txt based doc

Sameer Pujar (3):
ASoC: Add json-schema documentation for sound-name-prefix
ASoC: Use schema reference for sound-name-prefix
ASoC: Remove name-prefix.txt

 .../devicetree/bindings/sound/name-prefix.txt      | 24 ---------------
 .../devicetree/bindings/sound/name-prefix.yaml     | 35 ++++++++++++++++++++++
 .../bindings/sound/nvidia,tegra186-dspk.yaml       |  7 +----
 .../bindings/sound/nvidia,tegra210-dmic.yaml       |  7 +----
 .../bindings/sound/nvidia,tegra210-i2s.yaml        |  7 +----
 .../devicetree/bindings/sound/nxp,tfa989x.yaml     |  5 +---
 Documentation/devicetree/bindings/sound/rt5659.txt |  2 +-
 .../bindings/sound/simple-audio-mux.yaml           |  5 +---
 8 files changed, 41 insertions(+), 51 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/name-prefix.txt
 create mode 100644 Documentation/devicetree/bindings/sound/name-prefix.yaml
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 ASoC: Add json-schema documentation for sound-name-prefix

The 'sound-name-prefix' is used to prepend suitable strings to a component widgets or controls. This is helpful when there are multiple instances of the same component. Add relevant json-schema and is inspired from sound-name-prefix.txt documentation.

Cc Jerome Brunet <[email protected]>
Cc Rob Herring <[email protected]>
---
 .../devicetree/bindings/sound/name-prefix.yaml     | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/name-prefix.yaml
Documentation/devicetree/bindings/sound/name-prefix.yaml new file +35 -0
new file mode 100644
index 00000000..b58cc9e
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/name-prefix.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Component sound name prefix
+
+maintainers:
+  - Jerome Brunet <[email protected]>
+
+properties:
+  sound-name-prefix:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: |
+      Card implementing the routing property define the connection between
+      audio components as list of string pair. Component using the same
+      sink/source names may use this property to prepend the name of their
+      sinks/sources with the provided string.
+
+additionalProperties: true
+
+examples:
+  - |
+    analog-amplifier@0 {
+        compatible = "simple-audio-amplifier";
+        sound-name-prefix = "FRONT";
+    };
+
+    analog-amplifier@1 {
+        compatible = "simple-audio-amplifier";
+        sound-name-prefix = "BACK";
+    };
+
+...
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 ASoC: Use schema reference for sound-name-prefix

In reply to Sameer Pujar

Use schema reference for 'sound-name-prefix' property wherever necessary.

Cc Jerome Brunet <[email protected]>
Cc Stephan Gerhold <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Rob Herring <[email protected]>
---
 Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml | 7 +------
 Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml | 7 +------
 Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml  | 7 +------
 Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml          | 5 +----
 Documentation/devicetree/bindings/sound/rt5659.txt                | 2 +-
 Documentation/devicetree/bindings/sound/simple-audio-mux.yaml     | 5 +----
 6 files changed, 6 insertions(+), 27 deletions(-)
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +1 -6
index 5f6b37c..ae04a11 100644
@@ -48,12 +48,7 @@ properties:
 
   sound-name-prefix:
     pattern: "^DSPK[1-9]$"
-    $ref: /schemas/types.yaml#/definitions/string
-    description:
-      Used as prefix for sink/source names of the component. Must be a
-      unique string among multiple instances of the same component.
-      The name can be "DSPK1" or "DSPKx", where x depends on the maximum
-      available instances on a Tegra SoC.
+    $ref: "name-prefix.yaml#/properties/sound-name-prefix"
 
   ports:
     $ref: /schemas/graph.yaml#/properties/ports
Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml +1 -6
index fd275a5..0f9f449 100644
@@ -49,12 +49,7 @@ properties:
 
   sound-name-prefix:
     pattern: "^DMIC[1-9]$"
-    $ref: /schemas/types.yaml#/definitions/string
-    description:
-      used as prefix for sink/source names of the component. Must be a
-      unique string among multiple instances of the same component.
-      The name can be "DMIC1" or "DMIC2" ... "DMICx", where x depends
-      on the maximum available instances on a Tegra SoC.
+    $ref: "name-prefix.yaml#/properties/sound-name-prefix"
 
   ports:
     $ref: /schemas/graph.yaml#/properties/ports
Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml +1 -6
index 6337070..a830b58 100644
@@ -65,12 +65,7 @@ properties:
 
   sound-name-prefix:
     pattern: "^I2S[1-9]$"
-    $ref: /schemas/types.yaml#/definitions/string
-    description:
-      Used as prefix for sink/source names of the component. Must be a
-      unique string among multiple instances of the same component.
-      The name can be "I2S1" or "I2S2" ... "I2Sx", where x depends
-      on the maximum available instances on a Tegra SoC.
+    $ref: "name-prefix.yaml#/properties/sound-name-prefix"
 
   ports:
     $ref: /schemas/graph.yaml#/properties/ports
Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml +1 -4
index ffb8fcf..c93b10c 100644
@@ -22,10 +22,7 @@ properties:
     const: 0
 
   sound-name-prefix:
-    $ref: /schemas/types.yaml#/definitions/string
-    description:
-      Used as prefix for sink/source names of the component. Must be a
-      unique string among multiple instances of the same component.
+    $ref: "name-prefix.yaml#/properties/sound-name-prefix"
 
   vddd-supply:
     description: regulator phandle for the VDDD power supply.
Documentation/devicetree/bindings/sound/rt5659.txt +1 -1
index c473df5..013f534 100644
@@ -42,7 +42,7 @@ Optional properties:
 - realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
 - realtek,reset-gpios : The GPIO that controls the CODEC's RESET pin.
 
-- sound-name-prefix: Please refer to name-prefix.txt
+- sound-name-prefix: Please refer to name-prefix.yaml
 
 - ports: A Codec may have a single or multiple I2S interfaces. These
   interfaces on Codec side can be described under 'ports' or 'port'.
Documentation/devicetree/bindings/sound/simple-audio-mux.yaml +1 -4
index 5986d1f..5333682 100644
@@ -22,10 +22,7 @@ properties:
       GPIOs used to select the input line.
 
   sound-name-prefix:
-    $ref: /schemas/types.yaml#/definitions/string
-    description:
-      Used as prefix for sink/source names of the component. Must be a
-      unique string among multiple instances of the same component.
+    $ref: "name-prefix.yaml#/properties/sound-name-prefix"
 
 required:
   - compatible
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/3] ASoC: Use schema reference for sound-name-prefix

Quoted 24 lines · Sameer Pujar

Use schema reference for 'sound-name-prefix' property wherever necessary.

Cc Jerome Brunet <[email protected]>
Cc Stephan Gerhold <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Rob Herring <[email protected]>
---
 Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml | 7 +------
 Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml | 7 +------
 Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml  | 7 +------
 Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml          | 5 +----
 Documentation/devicetree/bindings/sound/rt5659.txt                | 2 +-
 Documentation/devicetree/bindings/sound/simple-audio-mux.yaml     | 5 +----
 6 files changed, 6 insertions(+), 27 deletions(-)
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +0 -0
index 5f6b37c..ae04a11 100644

Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml properties: · line 51

Quoted 10 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +1 -6
@@ -48,12 +48,7 @@ properties:
 
   sound-name-prefix:
     pattern: "^DSPK[1-9]$"
-    $ref: /schemas/types.yaml#/definitions/string
-    description:
-      Used as prefix for sink/source names of the component. Must be a
-      unique string among multiple instances of the same component.
-      The name can be "DSPK1" or "DSPKx", where x depends on the maximum
-      available instances on a Tegra SoC.
+    $ref: "name-prefix.yaml#/properties/sound-name-prefix"

This is generally not how we reference common properties.

Either you add a $ref to the whole schema document at the top level of this one or add a 'select: true' in name-prefix.yaml.

Rob

#4 lore raw

PATCH 3/3 ASoC: Remove name-prefix.txt

In reply to Sameer Pujar

Since schema name-prefix.yaml is available and references are updated, remove txt based doc.

Cc Jerome Brunet <[email protected]>
Cc Rob Herring <[email protected]>
---
 .../devicetree/bindings/sound/name-prefix.txt      | 24 ----------------------
 1 file changed, 24 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/name-prefix.txt
Documentation/devicetree/bindings/sound/name-prefix.txt deleted +0 -24
deleted file mode 100644
index 6457759..00000000
@@ -1,24 +0,0 @@
-Name prefix:
-
-Card implementing the routing property define the connection between
-audio components as list of string pair. Component using the same
-sink/source names may use the name prefix property to prepend the
-name of their sinks/sources with the provided string.
-
-Optional name prefix property:
-- sound-name-prefix : string using as prefix for the sink/source names of
-		      the component.
-
-Example: Two instances of the same component.
-
-amp0: analog-amplifier@0 {
-	compatible = "simple-audio-amplifier";
-	enable-gpios = <&gpio GPIOH_3 0>;
-	sound-name-prefix = "FRONT";
-};
-
-amp1: analog-amplifier@1 {
-	compatible = "simple-audio-amplifier";
-	enable-gpios = <&gpio GPIOH_4 0>;
-	sound-name-prefix = "BACK";
-};
Signature · 1 line
2.7.4