Skip to contentSkip to conversation

ASoC: dt-bindings: adi,adau17x1: Convert to DT schema

RFC PATCH Superseded Vijaya Anand 2 participants 2 messages Mar 11, 2023 – Mar 12, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 ASoC: dt-bindings: adi,adau17x1: Convert to DT schema

Convert the binding document for adi,adau17x1 from txt to yaml so one could validate dt-entries correctly and any future additions can go into yaml format. Add address and size cells to example to prevent errors regarding reg format.

---
 .../bindings/sound/adi,adau17x1.txt           | 32 ------------
 .../bindings/sound/adi,adau17x1.yaml          | 52 +++++++++++++++++++
 2 files changed, 52 insertions(+), 32 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/adi,adau17x1.txt
 create mode 100644 Documentation/devicetree/bindings/sound/adi,adau17x1.yaml
Documentation/devicetree/bindings/sound/adi,adau17x1.txt deleted +0 -32
deleted file mode 100644
index 1447dec28125..000000000000
@@ -1,32 +0,0 @@
-Analog Devices ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781
-
-Required properties:
-
- - compatible:		Should contain one of the following:
-			"adi,adau1361"
-			"adi,adau1461"
-			"adi,adau1761"
-			"adi,adau1961"
-			"adi,adau1381"
-			"adi,adau1781"
-
- - reg:			The i2c address. Value depends on the state of ADDR0
-			and ADDR1, as wired in hardware.
-
-Optional properties:
- - clock-names:		If provided must be "mclk".
- - clocks:		phandle + clock-specifiers for the clock that provides
-			the audio master clock for the device.
-
-Examples:
-#include <dt-bindings/sound/adau17x1.h>
-
-	i2c_bus {
-		adau1361@38 {
-			compatible = "adi,adau1761";
-			reg = <0x38>;
-
-			clock-names = "mclk";
-			clocks = <&audio_clock>;
-		};
-	};
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.37.1 (Apple Git-137.1)
#1 lore raw
Quoted 7 lines · Vijaya Anand

Convert the binding document for adi,adau17x1 from txt to yaml so one could validate dt-entries correctly and any future additions can go into yaml format. Add address and size cells to example to prevent errors regarding reg format.

Thank you for your patch. There is something to discuss/improve.

Quoted 18 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt deleted +0 -12
-Examples:
-#include <dt-bindings/sound/adau17x1.h>
-
-	i2c_bus {
-		adau1361@38 {
-			compatible = "adi,adau1761";
-			reg = <0x38>;
-
-			clock-names = "mclk";
-			clocks = <&audio_clock>;
-		};
-	};
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +0 -0
new file mode 100644
index 000000000000..9c1dbf2b4e70

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +7 -0
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/adi,adau17x1.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781

But what is this? Codec? Amplifier?

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 20

Quoted 13 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +13 -0
+
+maintainers:
+  - Lars-Peter Clausen <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - adi,adau1361
+      - adi,adau1461
+      - adi,adau1761
+      - adi,adau1961
+      - adi,adau1381
+      - adi,adau1781

Please put them in some order, e.g. alphabetical.

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 24

Quoted 4 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +4 -0
+
+  reg:
+    maxItems: 1
+    description: The i2c address. Value depends on the state of ADDR0 and ADDR1, as wired in hardware.

This exceeds 80 characters (see coding style).

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 33

Quoted 9 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +9 -0
+
+  clock-names:
+    const: mclk
+
+  clocks:
+    maxItems: 1
+    description:
+      phandle + clock-specifiers for the clock that provides the audio master
+      clock for the device.

Drop "phandle + clock-specifiers for the " and make it simpler, just items with description:

clocks
items:
- description: .......

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 39

Quoted 6 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +6 -0
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false

Instead:
additionalProperties: false
Unless you plan to reference dai-common or component-common

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 43

Quoted 4 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +4 -0
+
+examples:
+  - |
+    i2c_bus {

i2c

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 46

Quoted 3 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +3 -0
+      #address-cells = <1>;
+      #size-cells = <0>;
+      adau1361@38 {

Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Documentation/devicetree/bindings/sound/adi,adau17x1.yaml line 50

Quoted 4 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.yaml new file +4 -0
+        compatible = "adi,adau1761";
+        reg = <0x38>;
+        clock-names = "mclk";
+        clocks = <&audio_clock>;

Best regards,
Krzysztof