diff mbox series

[2/3] dt-bindings: hsi: nokia-modem: convert to YAML

Message ID 20240325-hsi-dt-binding-v1-2-88e8e97c3aae@collabora.com (mailing list archive)
State New
Headers show
Series Convert MIPI HSI DT bindings to YAML | expand

Commit Message

Sebastian Reichel March 25, 2024, 9:45 p.m. UTC
Convert the legacy txt binding to modern YAML.
No semantic change.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 .../devicetree/bindings/hsi/nokia-modem.txt        |  59 ------------
 .../devicetree/bindings/hsi/nokia-modem.yaml       | 101 +++++++++++++++++++++
 2 files changed, 101 insertions(+), 59 deletions(-)

Comments

Krzysztof Kozlowski March 26, 2024, 7:21 a.m. UTC | #1
On 25/03/2024 22:45, Sebastian Reichel wrote:
> Convert the legacy txt binding to modern YAML.
> No semantic change.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  .../devicetree/bindings/hsi/nokia-modem.txt        |  59 ------------
>  .../devicetree/bindings/hsi/nokia-modem.yaml       | 101 +++++++++++++++++++++
>  2 files changed, 101 insertions(+), 59 deletions(-)
> 


> -};
> diff --git a/Documentation/devicetree/bindings/hsi/nokia-modem.yaml b/Documentation/devicetree/bindings/hsi/nokia-modem.yaml
> new file mode 100644
> index 000000000000..c57cbcc7b722
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hsi/nokia-modem.yaml

Filename should match compatibles. nokia,n9-modem.yaml or nokia,modem.yaml


> @@ -0,0 +1,101 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hsi/nokia-modem.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Nokia modem
> +
> +maintainers:
> +  - Sebastian Reichel <sre@kernel.org>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - nokia,n900-modem
> +      - nokia,n950-modem
> +      - nokia,n9-modem
> +

Aren't hsi-channel-ids related to hsi-channel-names? If so, they should
be here with constraints.

> +  hsi-channel-names:
> +    items:
> +      - const: mcsaab-control
> +      - const: speech-control
> +      - const: speech-data
> +      - const: mcsaab-data
> +
> +  interrupts:
> +    items:
> +      - description: modem reset indication
> +
> +  gpios:
> +    minItems: 3
> +    maxItems: 5
> +
> +  gpio-names:
> +    items:
> +      - const: cmt_apeslpx
> +      - const: cmt_rst_rq
> +      - const: cmt_en
> +      - const: cmt_rst
> +      - const: cmt_bsi
> +    minItems: 3
> +
> +required:
> +  - gpios
> +  - gpio-names
> +  - interrupts
> +
> +allOf:
> +  - $ref: hsi-client.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - nokia,n950-modem
> +              - nokia,n9-modem
> +    then:
> +      properties:
> +        gpios:
> +          maxItems: 3
> +        gpio-names:
> +          maxItems: 3
> +    else:
> +      properties:
> +        gpios:
> +          minItems: 5
> +        gpio-names:
> +          minItems: 5
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    hsi-client {

This should be "modem".

> +        compatible = "nokia,n900-modem";
> +


Best regards,
Krzysztof
Sebastian Reichel March 26, 2024, 1 p.m. UTC | #2
Hi,

On Tue, Mar 26, 2024 at 08:21:05AM +0100, Krzysztof Kozlowski wrote:
> On 25/03/2024 22:45, Sebastian Reichel wrote:
> > Convert the legacy txt binding to modern YAML.
> > No semantic change.
> > 
> > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> > ---
> >  .../devicetree/bindings/hsi/nokia-modem.txt        |  59 ------------
> >  .../devicetree/bindings/hsi/nokia-modem.yaml       | 101 +++++++++++++++++++++
> >  2 files changed, 101 insertions(+), 59 deletions(-)
> > 
> 
> 
> > -};
> > diff --git a/Documentation/devicetree/bindings/hsi/nokia-modem.yaml b/Documentation/devicetree/bindings/hsi/nokia-modem.yaml
> > new file mode 100644
> > index 000000000000..c57cbcc7b722
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hsi/nokia-modem.yaml
> 
> Filename should match compatibles. nokia,n9-modem.yaml or nokia,modem.yaml

Ack, I will switch to nokia,modem.yaml in v2.

> > @@ -0,0 +1,101 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/hsi/nokia-modem.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Nokia modem
> > +
> > +maintainers:
> > +  - Sebastian Reichel <sre@kernel.org>
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - nokia,n900-modem
> > +      - nokia,n950-modem
> > +      - nokia,n9-modem
> > +
> 
> Aren't hsi-channel-ids related to hsi-channel-names? If so, they
> should be here with constraints.

Indeed. I forgot them, since they were not in the old binding :)
I will constraint them to min/max items 4 in v2.

> > +  hsi-channel-names:
> > +    items:
> > +      - const: mcsaab-control
> > +      - const: speech-control
> > +      - const: speech-data
> > +      - const: mcsaab-data

[...]

> > +examples:
> > +  - |
> > +    #include <dt-bindings/gpio/gpio.h>
> > +    #include <dt-bindings/interrupt-controller/irq.h>
> > +    hsi-client {
> 
> This should be "modem".

Ack.

> 
> > +        compatible = "nokia,n900-modem";
> > +

Thanks for the review,

-- Sebastian
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/hsi/nokia-modem.txt b/Documentation/devicetree/bindings/hsi/nokia-modem.txt
deleted file mode 100644
index 53de1d9d0b95..000000000000
--- a/Documentation/devicetree/bindings/hsi/nokia-modem.txt
+++ /dev/null
@@ -1,59 +0,0 @@ 
-Nokia modem client bindings
-
-The Nokia modem HSI client follows the common HSI client binding
-and inherits all required properties. The following additional
-properties are needed by the Nokia modem HSI client:
-
-Required properties:
-- compatible:		Should be one of
-      "nokia,n900-modem"
-      "nokia,n950-modem"
-      "nokia,n9-modem"
-- hsi-channel-names:	Should contain the following strings
-      "mcsaab-control"
-      "speech-control"
-      "speech-data"
-      "mcsaab-data"
-- gpios:		Should provide a GPIO handler for each GPIO listed in
-                        gpio-names
-- gpio-names:		Should contain the following strings
-      "cmt_apeslpx" (for n900, n950, n9)
-      "cmt_rst_rq"  (for n900, n950, n9)
-      "cmt_en"      (for n900, n950, n9)
-      "cmt_rst"     (for n900)
-      "cmt_bsi"     (for n900)
-- interrupts:		Should be IRQ handle for modem's reset indication
-
-Example:
-
-&ssi_port {
-	modem: hsi-client {
-		compatible = "nokia,n900-modem";
-
-		pinctrl-names = "default";
-		pinctrl-0 = <&modem_pins>;
-
-		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";
-
-		interrupts-extended = <&gpio3 8 IRQ_TYPE_EDGE_FALLING>; /* 72 */
-
-		gpios = <&gpio3  6 GPIO_ACTIVE_HIGH>, /* 70 */
-			<&gpio3  9 GPIO_ACTIVE_HIGH>, /* 73 */
-			<&gpio3 10 GPIO_ACTIVE_HIGH>, /* 74 */
-			<&gpio3 11 GPIO_ACTIVE_HIGH>, /* 75 */
-			<&gpio5 29 GPIO_ACTIVE_HIGH>; /* 157 */
-		gpio-names = "cmt_apeslpx",
-			     "cmt_rst_rq",
-			     "cmt_en",
-			     "cmt_rst",
-			     "cmt_bsi";
-	};
-};
diff --git a/Documentation/devicetree/bindings/hsi/nokia-modem.yaml b/Documentation/devicetree/bindings/hsi/nokia-modem.yaml
new file mode 100644
index 000000000000..c57cbcc7b722
--- /dev/null
+++ b/Documentation/devicetree/bindings/hsi/nokia-modem.yaml
@@ -0,0 +1,101 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hsi/nokia-modem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nokia modem
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+properties:
+  compatible:
+    enum:
+      - nokia,n900-modem
+      - nokia,n950-modem
+      - nokia,n9-modem
+
+  hsi-channel-names:
+    items:
+      - const: mcsaab-control
+      - const: speech-control
+      - const: speech-data
+      - const: mcsaab-data
+
+  interrupts:
+    items:
+      - description: modem reset indication
+
+  gpios:
+    minItems: 3
+    maxItems: 5
+
+  gpio-names:
+    items:
+      - const: cmt_apeslpx
+      - const: cmt_rst_rq
+      - const: cmt_en
+      - const: cmt_rst
+      - const: cmt_bsi
+    minItems: 3
+
+required:
+  - gpios
+  - gpio-names
+  - interrupts
+
+allOf:
+  - $ref: hsi-client.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nokia,n950-modem
+              - nokia,n9-modem
+    then:
+      properties:
+        gpios:
+          maxItems: 3
+        gpio-names:
+          maxItems: 3
+    else:
+      properties:
+        gpios:
+          minItems: 5
+        gpio-names:
+          minItems: 5
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    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";
+
+        interrupts-extended = <&gpio3 8 IRQ_TYPE_EDGE_FALLING>;
+
+        gpios = <&gpio3  6 GPIO_ACTIVE_HIGH>,
+                <&gpio3  9 GPIO_ACTIVE_HIGH>,
+                <&gpio3 10 GPIO_ACTIVE_HIGH>,
+                <&gpio3 11 GPIO_ACTIVE_HIGH>,
+                <&gpio5 29 GPIO_ACTIVE_HIGH>;
+        gpio-names = "cmt_apeslpx",
+                     "cmt_rst_rq",
+                     "cmt_en",
+                     "cmt_rst",
+                     "cmt_bsi";
+    };