2024-03-27 19:12:49

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCH v2 1/7] dt-bindings: hsi: hsi-client: convert to YAML

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 <[email protected]>
---
.../devicetree/bindings/hsi/client-devices.txt | 44 ------------
.../devicetree/bindings/hsi/hsi-client.yaml | 81 ++++++++++++++++++++++
2 files changed, 81 insertions(+), 44 deletions(-)

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 <[email protected]>
+
+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

--
2.43.0



2024-03-28 09:28:50

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 1/7] dt-bindings: hsi: hsi-client: convert to YAML

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