Skip to contentSkip to conversation

dt-bindings: media: video-interfaces: Use documented bindings in example

PATCH In review Rob Herring 2 participants 4 messages Mar 16, 2021

Subsystems (2)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: media: video-interfaces: Use documented bindings in example

The example in video-interfaces.yaml managed to use a bunch of undocumented bindings. Update the example to use real bindings (and ones with a schema).

Cc Mauro Carvalho Chehab <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 .../bindings/media/video-interfaces.yaml      | 75 ++++++++-----------
 1 file changed, 33 insertions(+), 42 deletions(-)
Documentation/devicetree/bindings/media/video-interfaces.yaml +33 -42
index 0a7a73fd59f2..f30b9b91717b 100644
@@ -227,17 +227,12 @@ examples:
   # only one of the following data pipelines can be active:
   # ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
   - |
+    #include <dt-bindings/clock/r8a7796-cpg-mssr.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/r8a7796-sysc.h>
+
     ceu@fe910000 {
-        compatible = "renesas,sh-mobile-ceu";
         reg = <0xfe910000 0xa0>;
-        interrupts = <0x880>;
-
-        mclk: master_clock {
-            compatible = "renesas,ceu-clock";
-            #clock-cells = <1>;
-            clock-frequency = <50000000>;  /* Max clock frequency */
-            clock-output-names = "mclk";
-        };
 
         port {
             #address-cells = <1>;
@@ -271,18 +266,14 @@ examples:
         #size-cells = <0>;
 
         camera@21 {
-            compatible = "ovti,ov772x";
+            compatible = "ovti,ov7720";
             reg = <0x21>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
-
-            clock-frequency = <20000000>;
             clocks = <&mclk 0>;
-            clock-names = "xclk";
 
             port {
                 /* With 1 endpoint per port no need for addresses. */
                 ov772x_1_1: endpoint {
+                    bus-type = <5>;
                     bus-width = <8>;
                     remote-endpoint = <&ceu0_1>;
                     hsync-active = <1>;
@@ -295,48 +286,48 @@ examples:
         };
 
         camera@1a {
-            compatible = "sony,imx074";
+            compatible = "sony,imx334";
             reg = <0x1a>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
 
-            clock-frequency = <30000000>;  /* Shared clock with ov772x_1 */
             clocks = <&mclk 0>;
-            clock-names = "sysclk";    /* Assuming this is the
-                       name in the datasheet */
+
             port {
-                imx074_1: endpoint {
+                imx334_1: endpoint {
                     clock-lanes = <0>;
                     data-lanes = <1 2>;
+                    link-frequencies = /bits/ 64 <891000000>;
                     remote-endpoint = <&csi2_1>;
                 };
             };
         };
     };
 
-    csi2: csi2@ffc90000 {
-        compatible = "renesas,sh-mobile-csi2";
-        reg = <0xffc90000 0x1000>;
-        interrupts = <0x17a0>;
-        #address-cells = <1>;
-        #size-cells = <0>;
+    csi2@fea80000 {
+        compatible = "renesas,r8a7796-csi2";
+        reg = <0xfea80000 0x10000>;
+        interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpg CPG_MOD 714>;
+        power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+        resets = <&cpg 714>;
 
-        port@1 {
-            compatible = "renesas,csi2c";  /* One of CSI2I and CSI2C. */
-            reg = <1>;      /* CSI-2 PHY #1 of 2: PHY_S,
-                       PHY_M has port address 0,
-                       is unused. */
-            csi2_1: endpoint {
-                clock-lanes = <0>;
-                data-lanes = <2 1>;
-                remote-endpoint = <&imx074_1>;
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                reg = <0>;
+                csi2_1: endpoint {
+                    clock-lanes = <0>;
+                    data-lanes = <2 1>;
+                    remote-endpoint = <&imx334_1>;
+                };
             };
-        };
-        port@2 {
-            reg = <2>;      /* port 2: link to the CEU */
+            port@1 {
+                reg = <1>;
 
-            csi2_2: endpoint {
-                remote-endpoint = <&ceu0_0>;
+                csi2_2: endpoint {
+                    remote-endpoint = <&ceu0_0>;
+                };
             };
         };
     };
Signature · 1 line
2.27.0
#1 lore raw

Hi Rob,

Thank you for the patch.

Quoted 84 lines · Rob Herring

The example in video-interfaces.yaml managed to use a bunch of undocumented bindings. Update the example to use real bindings (and ones with a schema).

Cc Mauro Carvalho Chehab <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 .../bindings/media/video-interfaces.yaml      | 75 ++++++++-----------
 1 file changed, 33 insertions(+), 42 deletions(-)
Documentation/devicetree/bindings/media/video-interfaces.yaml +10 -22
index 0a7a73fd59f2..f30b9b91717b 100644
@@ -227,17 +227,12 @@ examples:
   # only one of the following data pipelines can be active:
   # ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
   - |
+    #include <dt-bindings/clock/r8a7796-cpg-mssr.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/r8a7796-sysc.h>
+
     ceu@fe910000 {
-        compatible = "renesas,sh-mobile-ceu";
         reg = <0xfe910000 0xa0>;
-        interrupts = <0x880>;
-
-        mclk: master_clock {
-            compatible = "renesas,ceu-clock";
-            #clock-cells = <1>;
-            clock-frequency = <50000000>;  /* Max clock frequency */
-            clock-output-names = "mclk";
-        };
 
         port {
             #address-cells = <1>;
@@ -271,18 +266,14 @@ examples:
         #size-cells = <0>;
 
         camera@21 {
-            compatible = "ovti,ov772x";
+            compatible = "ovti,ov7720";
             reg = <0x21>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
-
-            clock-frequency = <20000000>;
             clocks = <&mclk 0>;
-            clock-names = "xclk";
 
             port {
                 /* With 1 endpoint per port no need for addresses. */
                 ov772x_1_1: endpoint {
+                    bus-type = <5>;
                     bus-width = <8>;
                     remote-endpoint = <&ceu0_1>;
                     hsync-active = <1>;
@@ -295,48 +286,48 @@ examples:
         };
 
         camera@1a {
-            compatible = "sony,imx074";
+            compatible = "sony,imx334";
             reg = <0x1a>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
 
-            clock-frequency = <30000000>;  /* Shared clock with ov772x_1 */
             clocks = <&mclk 0>;
-            clock-names = "sysclk";    /* Assuming this is the
-                       name in the datasheet */
+
             port {
-                imx074_1: endpoint {
+                imx334_1: endpoint {
                     clock-lanes = <0>;
                     data-lanes = <1 2>;
+                    link-frequencies = /bits/ 64 <891000000>;
                     remote-endpoint = <&csi2_1>;
                 };
             };
         };

Documentation/devicetree/bindings/media/video-interfaces.yaml examples: · line 306

Quoted 10 lines
Documentation/devicetree/bindings/media/video-interfaces.yaml +2 -6
     };
 
-    csi2: csi2@ffc90000 {
-        compatible = "renesas,sh-mobile-csi2";
-        reg = <0xffc90000 0x1000>;
-        interrupts = <0x17a0>;
-        #address-cells = <1>;
-        #size-cells = <0>;
+    csi2@fea80000 {
+        compatible = "renesas,r8a7796-csi2";

That's certainly better, but the r8a7796 doesn't have a CEU :-) It has a VIN. Maybe we could copy the last example from renesas,vin.yaml to replace the CEU ?

Quoted 41 lines
Documentation/devicetree/bindings/media/video-interfaces.yaml +21 -14
+        reg = <0xfea80000 0x10000>;
+        interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpg CPG_MOD 714>;
+        power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+        resets = <&cpg 714>;
 
-        port@1 {
-            compatible = "renesas,csi2c";  /* One of CSI2I and CSI2C. */
-            reg = <1>;      /* CSI-2 PHY #1 of 2: PHY_S,
-                       PHY_M has port address 0,
-                       is unused. */
-            csi2_1: endpoint {
-                clock-lanes = <0>;
-                data-lanes = <2 1>;
-                remote-endpoint = <&imx074_1>;
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                reg = <0>;
+                csi2_1: endpoint {
+                    clock-lanes = <0>;
+                    data-lanes = <2 1>;
+                    remote-endpoint = <&imx334_1>;
+                };
             };
-        };
-        port@2 {
-            reg = <2>;      /* port 2: link to the CEU */
+            port@1 {
+                reg = <1>;
 
-            csi2_2: endpoint {
-                remote-endpoint = <&ceu0_0>;
+                csi2_2: endpoint {
+                    remote-endpoint = <&ceu0_0>;
+                };
             };
         };
     };
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#2 lore raw
Quoted 92 lines · Laurent Pinchart

Hi Rob,

Thank you for the patch.

Quoted 86 lines · Rob Herring

The example in video-interfaces.yaml managed to use a bunch of undocumented bindings. Update the example to use real bindings (and ones with a schema).

Cc Mauro Carvalho Chehab <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 .../bindings/media/video-interfaces.yaml      | 75 ++++++++-----------
 1 file changed, 33 insertions(+), 42 deletions(-)
Documentation/devicetree/bindings/media/video-interfaces.yaml +10 -22
index 0a7a73fd59f2..f30b9b91717b 100644
@@ -227,17 +227,12 @@ examples:
   # only one of the following data pipelines can be active:
   # ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
   - |
+    #include <dt-bindings/clock/r8a7796-cpg-mssr.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/r8a7796-sysc.h>
+
     ceu@fe910000 {
-        compatible = "renesas,sh-mobile-ceu";
         reg = <0xfe910000 0xa0>;
-        interrupts = <0x880>;
-
-        mclk: master_clock {
-            compatible = "renesas,ceu-clock";
-            #clock-cells = <1>;
-            clock-frequency = <50000000>;  /* Max clock frequency */
-            clock-output-names = "mclk";
-        };
 
         port {
             #address-cells = <1>;
@@ -271,18 +266,14 @@ examples:
         #size-cells = <0>;
 
         camera@21 {
-            compatible = "ovti,ov772x";
+            compatible = "ovti,ov7720";
             reg = <0x21>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
-
-            clock-frequency = <20000000>;
             clocks = <&mclk 0>;
-            clock-names = "xclk";
 
             port {
                 /* With 1 endpoint per port no need for addresses. */
                 ov772x_1_1: endpoint {
+                    bus-type = <5>;
                     bus-width = <8>;
                     remote-endpoint = <&ceu0_1>;
                     hsync-active = <1>;
@@ -295,48 +286,48 @@ examples:
         };
 
         camera@1a {
-            compatible = "sony,imx074";
+            compatible = "sony,imx334";
             reg = <0x1a>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
 
-            clock-frequency = <30000000>;  /* Shared clock with ov772x_1 */
             clocks = <&mclk 0>;
-            clock-names = "sysclk";    /* Assuming this is the
-                       name in the datasheet */
+
             port {
-                imx074_1: endpoint {
+                imx334_1: endpoint {
                     clock-lanes = <0>;
                     data-lanes = <1 2>;
+                    link-frequencies = /bits/ 64 <891000000>;
                     remote-endpoint = <&csi2_1>;
                 };
             };
         };
     };
 
Quoted 12 lines

Documentation/devicetree/bindings/media/video-interfaces.yaml examples: · line 306

Quoted 8 lines
Documentation/devicetree/bindings/media/video-interfaces.yaml +2 -6
-    csi2: csi2@ffc90000 {
-        compatible = "renesas,sh-mobile-csi2";
-        reg = <0xffc90000 0x1000>;
-        interrupts = <0x17a0>;
-        #address-cells = <1>;
-        #size-cells = <0>;
+    csi2@fea80000 {
+        compatible = "renesas,r8a7796-csi2";

That's certainly better, but the r8a7796 doesn't have a CEU :-) It has a VIN. Maybe we could copy the last example from renesas,vin.yaml to replace the CEU ?

What about just removing the example here? It bothers me to have 2 copies (maybe 3 with sensor schemas) of an example and we should have plenty of examples. On the flip side, it's nice to have this stand on its own. Another option would be just remove compatibles and make the example barebones with only what's defined in video-interfaces.yaml. But then it's not validated at all.

Rob

#3 lore raw

Hi Rob,

Quoted 101 lines · Rob Herring
Quoted 87 lines · Laurent Pinchart
Quoted 86 lines · Rob Herring

The example in video-interfaces.yaml managed to use a bunch of undocumented bindings. Update the example to use real bindings (and ones with a schema).

Cc Mauro Carvalho Chehab <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 .../bindings/media/video-interfaces.yaml      | 75 ++++++++-----------
 1 file changed, 33 insertions(+), 42 deletions(-)
Documentation/devicetree/bindings/media/video-interfaces.yaml +10 -22
index 0a7a73fd59f2..f30b9b91717b 100644
@@ -227,17 +227,12 @@ examples:
   # only one of the following data pipelines can be active:
   # ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
   - |
+    #include <dt-bindings/clock/r8a7796-cpg-mssr.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/r8a7796-sysc.h>
+
     ceu@fe910000 {
-        compatible = "renesas,sh-mobile-ceu";
         reg = <0xfe910000 0xa0>;
-        interrupts = <0x880>;
-
-        mclk: master_clock {
-            compatible = "renesas,ceu-clock";
-            #clock-cells = <1>;
-            clock-frequency = <50000000>;  /* Max clock frequency */
-            clock-output-names = "mclk";
-        };
 
         port {
             #address-cells = <1>;
@@ -271,18 +266,14 @@ examples:
         #size-cells = <0>;
 
         camera@21 {
-            compatible = "ovti,ov772x";
+            compatible = "ovti,ov7720";
             reg = <0x21>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
-
-            clock-frequency = <20000000>;
             clocks = <&mclk 0>;
-            clock-names = "xclk";
 
             port {
                 /* With 1 endpoint per port no need for addresses. */
                 ov772x_1_1: endpoint {
+                    bus-type = <5>;
                     bus-width = <8>;
                     remote-endpoint = <&ceu0_1>;
                     hsync-active = <1>;
@@ -295,48 +286,48 @@ examples:
         };
 
         camera@1a {
-            compatible = "sony,imx074";
+            compatible = "sony,imx334";
             reg = <0x1a>;
-            vddio-supply = <&regulator1>;
-            vddcore-supply = <&regulator2>;
 
-            clock-frequency = <30000000>;  /* Shared clock with ov772x_1 */
             clocks = <&mclk 0>;
-            clock-names = "sysclk";    /* Assuming this is the
-                       name in the datasheet */
+
             port {
-                imx074_1: endpoint {
+                imx334_1: endpoint {
                     clock-lanes = <0>;
                     data-lanes = <1 2>;
+                    link-frequencies = /bits/ 64 <891000000>;
                     remote-endpoint = <&csi2_1>;
                 };
             };
         };
     };
 
Quoted 12 lines

Documentation/devicetree/bindings/media/video-interfaces.yaml examples: · line 306

Quoted 8 lines
Documentation/devicetree/bindings/media/video-interfaces.yaml +2 -6
-    csi2: csi2@ffc90000 {
-        compatible = "renesas,sh-mobile-csi2";
-        reg = <0xffc90000 0x1000>;
-        interrupts = <0x17a0>;
-        #address-cells = <1>;
-        #size-cells = <0>;
+    csi2@fea80000 {
+        compatible = "renesas,r8a7796-csi2";

That's certainly better, but the r8a7796 doesn't have a CEU :-) It has a VIN. Maybe we could copy the last example from renesas,vin.yaml to replace the CEU ?

Quoted 3 lines

What about just removing the example here? It bothers me to have 2 copies (maybe 3 with sensor schemas) of an example and we should have plenty of examples.

I'd be fine with that.

Quoted 3 lines

On the flip side, it's nice to have this stand on its own. Another option would be just remove compatibles and make the example barebones with only what's defined in video-interfaces.yaml.

Abstract examples seem good in this context.

Quoted 1 line

But then it's not validated at all.

But this part isn't nice :-(

If we keep examples that use real bindings, they should match the real hardware platforms. Other than that, I have no strong preference, it's up to you.

Signature · 3 lines
Regards,

Laurent Pinchart