diff mbox series

[v2,1/7] dt-bindings: hsi: hsi-client: convert to YAML

Message ID 20240327-hsi-dt-binding-v2-1-110fab4c32ae@collabora.com (mailing list archive)
State New, archived
Headers show
Series Convert MIPI HSI DT bindings to YAML | expand

Commit Message

Sebastian Reichel March 27, 2024, 7:11 p.m. UTC
Convert the legacy txt binding to modern YAML and rename from
client-devices to hsi-client. Also the example got dropped,
since this is a shared schema. No semantic change in the binding
itself.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 .../devicetree/bindings/hsi/client-devices.txt     | 44 ------------
 .../devicetree/bindings/hsi/hsi-client.yaml        | 81 ++++++++++++++++++++++
 2 files changed, 81 insertions(+), 44 deletions(-)

Comments

Krzysztof Kozlowski March 28, 2024, 9:27 a.m. UTC | #1
On 27/03/2024 20:11, Sebastian Reichel wrote:
> Convert the legacy txt binding to modern YAML and rename from
> client-devices to hsi-client. Also the example got dropped,
> since this is a shared schema. No semantic change in the binding
> itself.
> 

...

> +allOf:
> +  - if:
> +      required:
> +        - hsi-mode
> +    then:
> +      properties:
> +        hsi-rx-mode: false
> +        hsi-tx-mode: false
> +  - if:
> +      required:
> +        - hsi-rx-mode
> +    then:
> +      properties:
> +        hsi-mode: false

Why do you still have this allOf? The point I was trying to make last
time, was that all your efforts to mutually exclude these properties can
be achieved with that one simple oneOf. That's why I linked you other
schemas as an example how to achieve this.

Could be that I miss here something, so why do you exactly need this allOf?

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/hsi/client-devices.txt b/Documentation/devicetree/bindings/hsi/client-devices.txt
deleted file mode 100644
index 104c9a3e57a4..000000000000
--- a/Documentation/devicetree/bindings/hsi/client-devices.txt
+++ /dev/null
@@ -1,44 +0,0 @@ 
-Each HSI port is supposed to have one child node, which
-symbols the remote device connected to the HSI port. The
-following properties are standardized for HSI clients:
-
-Required HSI configuration properties:
-
-- hsi-channel-ids:	A list of channel ids
-
-- hsi-rx-mode:		Receiver Bit transmission mode ("stream" or "frame")
-- hsi-tx-mode:		Transmitter Bit transmission mode ("stream" or "frame")
-- hsi-mode:		May be used instead hsi-rx-mode and hsi-tx-mode if
-			the transmission mode is the same for receiver and
-			transmitter
-- hsi-speed-kbps:	Max bit transmission speed in kbit/s
-- hsi-flow:		RX flow type ("synchronized" or "pipeline")
-- hsi-arb-mode:		Arbitration mode for TX frame ("round-robin", "priority")
-
-Optional HSI configuration properties:
-
-- hsi-channel-names:	A list with one name per channel specified in the
-			hsi-channel-ids property
-
-
-Device Tree node example for an HSI client:
-
-hsi-controller {
-	hsi-port {
-		modem: hsi-client {
-			compatible = "nokia,n900-modem";
-
-			hsi-channel-ids = <0>, <1>, <2>, <3>;
-			hsi-channel-names = "mcsaab-control",
-					    "speech-control",
-					    "speech-data",
-					    "mcsaab-data";
-			hsi-speed-kbps = <55000>;
-			hsi-mode = "frame";
-			hsi-flow = "synchronized";
-			hsi-arb-mode = "round-robin";
-
-			/* more client specific properties */
-		};
-	};
-};
diff --git a/Documentation/devicetree/bindings/hsi/hsi-client.yaml b/Documentation/devicetree/bindings/hsi/hsi-client.yaml
new file mode 100644
index 000000000000..9c8d6887e840
--- /dev/null
+++ b/Documentation/devicetree/bindings/hsi/hsi-client.yaml
@@ -0,0 +1,81 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hsi/hsi-client.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HSI bus peripheral
+
+description:
+  Each HSI port is supposed to have one child node, which
+  symbols the remote device connected to the HSI port.
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+properties:
+  hsi-channel-ids:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 8
+
+  hsi-channel-names:
+    minItems: 1
+    maxItems: 8
+
+  hsi-rx-mode:
+    enum: [stream, frame]
+    description: Receiver Bit transmission mode
+
+  hsi-tx-mode:
+    enum: [stream, frame]
+    description: Transmitter Bit transmission mode
+
+  hsi-mode:
+    enum: [stream, frame]
+    description:
+      May be used instead hsi-rx-mode and hsi-tx-mode if the
+      transmission mode is the same for receiver and transmitter.
+
+  hsi-speed-kbps:
+    description: Max bit transmission speed in kbit/s
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  hsi-flow:
+    enum: [synchronized, pipeline]
+    description: RX flow type
+
+  hsi-arb-mode:
+    enum: [round-robin, priority]
+    description: Arbitration mode for TX frame
+
+additionalProperties: true
+
+required:
+  - compatible
+  - hsi-channel-ids
+  - hsi-speed-kbps
+  - hsi-flow
+  - hsi-arb-mode
+
+oneOf:
+  - required:
+      - hsi-mode
+  - required:
+      - hsi-rx-mode
+      - hsi-tx-mode
+
+allOf:
+  - if:
+      required:
+        - hsi-mode
+    then:
+      properties:
+        hsi-rx-mode: false
+        hsi-tx-mode: false
+  - if:
+      required:
+        - hsi-rx-mode
+    then:
+      properties:
+        hsi-mode: false