All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] dt-bindings: Add macros for video interface bus types
@ 2022-02-27 20:33 ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 20:33 UTC (permalink / raw)
  To: devicetree, linux-media
  Cc: linux-arm-kernel, Rob Herring, Sakari Ailus, Jacopo Mondi,
	Eugen Hristev, Hugues Fruchet, Maxime Coquelin, Alexandre Torgue

Hello,

This small patch series is the result of me getting a bus-type numerical
value wrong in a device tree file and spending too long debugging the
issue. Hopefully there's nothing controversial here.

If the idea is accepted, and if desired, I can convert the DT sources to
use the new macros. How should I then split that, one big patch, one
patch per SoC vendor (easy for arm64, but how about arm ?), ... ?

Laurent Pinchart (2):
  dt-bindings: media: Add macros for video interface bus types
  dt-bindings: Use new video interface bus type macros in examples

 .../display/bridge/analogix,anx7625.yaml         |  3 ++-
 .../devicetree/bindings/media/i2c/mipi-ccs.yaml  |  3 ++-
 .../bindings/media/i2c/ovti,ov772x.yaml          |  3 ++-
 .../bindings/media/marvell,mmp2-ccic.yaml        |  3 ++-
 .../bindings/media/microchip,xisc.yaml           |  3 ++-
 .../devicetree/bindings/media/st,stm32-dcmi.yaml |  4 +++-
 include/dt-bindings/media/video-interfaces.h     | 16 ++++++++++++++++
 7 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 include/dt-bindings/media/video-interfaces.h

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] dt-bindings: Add macros for video interface bus types
@ 2022-02-27 20:33 ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 20:33 UTC (permalink / raw)
  To: devicetree, linux-media
  Cc: linux-arm-kernel, Rob Herring, Sakari Ailus, Jacopo Mondi,
	Eugen Hristev, Hugues Fruchet, Maxime Coquelin, Alexandre Torgue

Hello,

This small patch series is the result of me getting a bus-type numerical
value wrong in a device tree file and spending too long debugging the
issue. Hopefully there's nothing controversial here.

If the idea is accepted, and if desired, I can convert the DT sources to
use the new macros. How should I then split that, one big patch, one
patch per SoC vendor (easy for arm64, but how about arm ?), ... ?

Laurent Pinchart (2):
  dt-bindings: media: Add macros for video interface bus types
  dt-bindings: Use new video interface bus type macros in examples

 .../display/bridge/analogix,anx7625.yaml         |  3 ++-
 .../devicetree/bindings/media/i2c/mipi-ccs.yaml  |  3 ++-
 .../bindings/media/i2c/ovti,ov772x.yaml          |  3 ++-
 .../bindings/media/marvell,mmp2-ccic.yaml        |  3 ++-
 .../bindings/media/microchip,xisc.yaml           |  3 ++-
 .../devicetree/bindings/media/st,stm32-dcmi.yaml |  4 +++-
 include/dt-bindings/media/video-interfaces.h     | 16 ++++++++++++++++
 7 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 include/dt-bindings/media/video-interfaces.h

-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
  2022-02-27 20:33 ` Laurent Pinchart
@ 2022-02-27 20:33   ` Laurent Pinchart
  -1 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 20:33 UTC (permalink / raw)
  To: devicetree, linux-media
  Cc: linux-arm-kernel, Rob Herring, Sakari Ailus, Jacopo Mondi,
	Eugen Hristev, Hugues Fruchet, Maxime Coquelin, Alexandre Torgue

Add a new dt-bindings/media/video-interfaces.h header that defines
macros corresponding to the bus types from media/video-interfaces.yaml.
This allows avoiding hardcoded constants in device tree sources.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 include/dt-bindings/media/video-interfaces.h

diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
new file mode 100644
index 000000000000..e38058e1cca7
--- /dev/null
+++ b/include/dt-bindings/media/video-interfaces.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ */
+
+#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
+#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
+
+#define MEDIA_BUS_TYPE_CSI2_CPHY		1
+#define MEDIA_BUS_TYPE_CSI1			2
+#define MEDIA_BUS_TYPE_CCP2			3
+#define MEDIA_BUS_TYPE_CSI2_DPHY		4
+#define MEDIA_BUS_TYPE_PARALLEL			5
+#define MEDIA_BUS_TYPE_BT656			6
+
+#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
@ 2022-02-27 20:33   ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 20:33 UTC (permalink / raw)
  To: devicetree, linux-media
  Cc: linux-arm-kernel, Rob Herring, Sakari Ailus, Jacopo Mondi,
	Eugen Hristev, Hugues Fruchet, Maxime Coquelin, Alexandre Torgue

Add a new dt-bindings/media/video-interfaces.h header that defines
macros corresponding to the bus types from media/video-interfaces.yaml.
This allows avoiding hardcoded constants in device tree sources.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 include/dt-bindings/media/video-interfaces.h

diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
new file mode 100644
index 000000000000..e38058e1cca7
--- /dev/null
+++ b/include/dt-bindings/media/video-interfaces.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ */
+
+#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
+#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
+
+#define MEDIA_BUS_TYPE_CSI2_CPHY		1
+#define MEDIA_BUS_TYPE_CSI1			2
+#define MEDIA_BUS_TYPE_CCP2			3
+#define MEDIA_BUS_TYPE_CSI2_DPHY		4
+#define MEDIA_BUS_TYPE_PARALLEL			5
+#define MEDIA_BUS_TYPE_BT656			6
+
+#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */
-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] dt-bindings: Use new video interface bus type macros in examples
  2022-02-27 20:33 ` Laurent Pinchart
@ 2022-02-27 20:33   ` Laurent Pinchart
  -1 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 20:33 UTC (permalink / raw)
  To: devicetree, linux-media
  Cc: linux-arm-kernel, Rob Herring, Sakari Ailus, Jacopo Mondi,
	Eugen Hristev, Hugues Fruchet, Maxime Coquelin, Alexandre Torgue

Now that a header exists with macros for the media interface bus-type
values, replace hardcoding numerical constants with the corresponding
macros in the DT binding examples.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 .../devicetree/bindings/display/bridge/analogix,anx7625.yaml  | 3 ++-
 Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml     | 3 ++-
 Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml  | 3 ++-
 .../devicetree/bindings/media/marvell,mmp2-ccic.yaml          | 3 ++-
 Documentation/devicetree/bindings/media/microchip,xisc.yaml   | 3 ++-
 Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml    | 4 +++-
 6 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
index 1d3e88daca04..0e6c43a29491 100644
--- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
@@ -130,6 +130,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     i2c0 {
         #address-cells = <1>;
@@ -155,7 +156,7 @@ examples:
                     reg = <0>;
                     anx7625_in: endpoint {
                         remote-endpoint = <&mipi_dsi>;
-                        bus-type = <5>;
+                        bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                         data-lanes = <0 1 2 3>;
                     };
                 };
diff --git a/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml b/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml
index 39395ea8c318..edde4201116f 100644
--- a/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml
@@ -104,6 +104,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     i2c2 {
         #address-cells = <1>;
@@ -124,7 +125,7 @@ examples:
                     remote-endpoint = <&csi2a_ep>;
                     link-frequencies = /bits/ 64 <199200000 210000000
                                                   499200000>;
-                    bus-type = <4>;
+                    bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
                 };
             };
         };
diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml
index 44529425ce3a..161e6d598e1c 100644
--- a/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml
@@ -105,6 +105,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     i2c0 {
         #address-cells = <1>;
@@ -118,7 +119,7 @@ examples:
 
             port {
                 ov772x_0: endpoint {
-                    bus-type = <5>;
+                    bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                     vsync-active = <0>;
                     hsync-active = <0>;
                     pclk-sample = <0>;
diff --git a/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml b/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml
index b39b84c5f012..0e3478551e13 100644
--- a/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml
+++ b/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml
@@ -68,6 +68,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/clock/marvell,mmp2.h>
+    #include <dt-bindings/media/video-interfaces.h>
     #include <dt-bindings/power/marvell,mmp2.h>
 
     camera@d420a000 {
@@ -83,7 +84,7 @@ examples:
       port {
         camera0_0: endpoint {
           remote-endpoint = <&ov7670_0>;
-          bus-type = <5>;      /* Parallel */
+          bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
           hsync-active = <1>;  /* Active high */
           vsync-active = <1>;  /* Active high */
           pclk-sample = <0>;   /* Falling */
diff --git a/Documentation/devicetree/bindings/media/microchip,xisc.yaml b/Documentation/devicetree/bindings/media/microchip,xisc.yaml
index 086e1430af4f..d13d16c710e2 100644
--- a/Documentation/devicetree/bindings/media/microchip,xisc.yaml
+++ b/Documentation/devicetree/bindings/media/microchip,xisc.yaml
@@ -106,6 +106,7 @@ examples:
     #include <dt-bindings/interrupt-controller/arm-gic.h>
     #include <dt-bindings/clock/at91.h>
     #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     xisc: xisc@e1408000 {
         compatible = "microchip,sama7g5-isc";
@@ -118,7 +119,7 @@ examples:
 
         port {
                 xisc_in: endpoint {
-                       bus-type = <5>; /* Parallel */
+                       bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                        remote-endpoint = <&csi2dc_out>;
                        hsync-active = <1>;
                        vsync-active = <1>;
diff --git a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
index 9c1262a276b5..285c6075950a 100644
--- a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
+++ b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
@@ -90,7 +90,9 @@ examples:
   - |
     #include <dt-bindings/interrupt-controller/arm-gic.h>
     #include <dt-bindings/clock/stm32mp1-clks.h>
+    #include <dt-bindings/media/video-interfaces.h>
     #include <dt-bindings/reset/stm32mp1-resets.h>
+    #
     dcmi: dcmi@4c006000 {
         compatible = "st,stm32-dcmi";
         reg = <0x4c006000 0x400>;
@@ -104,7 +106,7 @@ examples:
         port {
              dcmi_0: endpoint {
                    remote-endpoint = <&ov5640_0>;
-                   bus-type = <5>;
+                   bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                    bus-width = <8>;
                    hsync-active = <0>;
                    vsync-active = <0>;
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] dt-bindings: Use new video interface bus type macros in examples
@ 2022-02-27 20:33   ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 20:33 UTC (permalink / raw)
  To: devicetree, linux-media
  Cc: linux-arm-kernel, Rob Herring, Sakari Ailus, Jacopo Mondi,
	Eugen Hristev, Hugues Fruchet, Maxime Coquelin, Alexandre Torgue

Now that a header exists with macros for the media interface bus-type
values, replace hardcoding numerical constants with the corresponding
macros in the DT binding examples.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 .../devicetree/bindings/display/bridge/analogix,anx7625.yaml  | 3 ++-
 Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml     | 3 ++-
 Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml  | 3 ++-
 .../devicetree/bindings/media/marvell,mmp2-ccic.yaml          | 3 ++-
 Documentation/devicetree/bindings/media/microchip,xisc.yaml   | 3 ++-
 Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml    | 4 +++-
 6 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
index 1d3e88daca04..0e6c43a29491 100644
--- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
@@ -130,6 +130,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     i2c0 {
         #address-cells = <1>;
@@ -155,7 +156,7 @@ examples:
                     reg = <0>;
                     anx7625_in: endpoint {
                         remote-endpoint = <&mipi_dsi>;
-                        bus-type = <5>;
+                        bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                         data-lanes = <0 1 2 3>;
                     };
                 };
diff --git a/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml b/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml
index 39395ea8c318..edde4201116f 100644
--- a/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml
@@ -104,6 +104,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     i2c2 {
         #address-cells = <1>;
@@ -124,7 +125,7 @@ examples:
                     remote-endpoint = <&csi2a_ep>;
                     link-frequencies = /bits/ 64 <199200000 210000000
                                                   499200000>;
-                    bus-type = <4>;
+                    bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
                 };
             };
         };
diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml
index 44529425ce3a..161e6d598e1c 100644
--- a/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml
@@ -105,6 +105,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     i2c0 {
         #address-cells = <1>;
@@ -118,7 +119,7 @@ examples:
 
             port {
                 ov772x_0: endpoint {
-                    bus-type = <5>;
+                    bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                     vsync-active = <0>;
                     hsync-active = <0>;
                     pclk-sample = <0>;
diff --git a/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml b/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml
index b39b84c5f012..0e3478551e13 100644
--- a/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml
+++ b/Documentation/devicetree/bindings/media/marvell,mmp2-ccic.yaml
@@ -68,6 +68,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/clock/marvell,mmp2.h>
+    #include <dt-bindings/media/video-interfaces.h>
     #include <dt-bindings/power/marvell,mmp2.h>
 
     camera@d420a000 {
@@ -83,7 +84,7 @@ examples:
       port {
         camera0_0: endpoint {
           remote-endpoint = <&ov7670_0>;
-          bus-type = <5>;      /* Parallel */
+          bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
           hsync-active = <1>;  /* Active high */
           vsync-active = <1>;  /* Active high */
           pclk-sample = <0>;   /* Falling */
diff --git a/Documentation/devicetree/bindings/media/microchip,xisc.yaml b/Documentation/devicetree/bindings/media/microchip,xisc.yaml
index 086e1430af4f..d13d16c710e2 100644
--- a/Documentation/devicetree/bindings/media/microchip,xisc.yaml
+++ b/Documentation/devicetree/bindings/media/microchip,xisc.yaml
@@ -106,6 +106,7 @@ examples:
     #include <dt-bindings/interrupt-controller/arm-gic.h>
     #include <dt-bindings/clock/at91.h>
     #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     xisc: xisc@e1408000 {
         compatible = "microchip,sama7g5-isc";
@@ -118,7 +119,7 @@ examples:
 
         port {
                 xisc_in: endpoint {
-                       bus-type = <5>; /* Parallel */
+                       bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                        remote-endpoint = <&csi2dc_out>;
                        hsync-active = <1>;
                        vsync-active = <1>;
diff --git a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
index 9c1262a276b5..285c6075950a 100644
--- a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
+++ b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
@@ -90,7 +90,9 @@ examples:
   - |
     #include <dt-bindings/interrupt-controller/arm-gic.h>
     #include <dt-bindings/clock/stm32mp1-clks.h>
+    #include <dt-bindings/media/video-interfaces.h>
     #include <dt-bindings/reset/stm32mp1-resets.h>
+    #
     dcmi: dcmi@4c006000 {
         compatible = "st,stm32-dcmi";
         reg = <0x4c006000 0x400>;
@@ -104,7 +106,7 @@ examples:
         port {
              dcmi_0: endpoint {
                    remote-endpoint = <&ov5640_0>;
-                   bus-type = <5>;
+                   bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
                    bus-width = <8>;
                    hsync-active = <0>;
                    vsync-active = <0>;
-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
  2022-02-27 20:33   ` Laurent Pinchart
@ 2022-02-27 21:07     ` Sakari Ailus
  -1 siblings, 0 replies; 16+ messages in thread
From: Sakari Ailus @ 2022-02-27 21:07 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: devicetree, linux-media, linux-arm-kernel, Rob Herring,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

Hi Laurent,

Thanks for the set.

On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> Add a new dt-bindings/media/video-interfaces.h header that defines
> macros corresponding to the bus types from media/video-interfaces.yaml.
> This allows avoiding hardcoded constants in device tree sources.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>  create mode 100644 include/dt-bindings/media/video-interfaces.h
> 
> diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> new file mode 100644
> index 000000000000..e38058e1cca7
> --- /dev/null
> +++ b/include/dt-bindings/media/video-interfaces.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + */
> +
> +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +
> +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> +#define MEDIA_BUS_TYPE_CSI1			2
> +#define MEDIA_BUS_TYPE_CCP2			3
> +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> +#define MEDIA_BUS_TYPE_PARALLEL			5

I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
is. I don't mind postponing that, but I think you could as well start here.
Up to you.

Should this be somehow visible in video-interfaces.yaml?

> +#define MEDIA_BUS_TYPE_BT656			6
> +
> +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
@ 2022-02-27 21:07     ` Sakari Ailus
  0 siblings, 0 replies; 16+ messages in thread
From: Sakari Ailus @ 2022-02-27 21:07 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: devicetree, linux-media, linux-arm-kernel, Rob Herring,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

Hi Laurent,

Thanks for the set.

On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> Add a new dt-bindings/media/video-interfaces.h header that defines
> macros corresponding to the bus types from media/video-interfaces.yaml.
> This allows avoiding hardcoded constants in device tree sources.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>  create mode 100644 include/dt-bindings/media/video-interfaces.h
> 
> diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> new file mode 100644
> index 000000000000..e38058e1cca7
> --- /dev/null
> +++ b/include/dt-bindings/media/video-interfaces.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + */
> +
> +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +
> +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> +#define MEDIA_BUS_TYPE_CSI1			2
> +#define MEDIA_BUS_TYPE_CCP2			3
> +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> +#define MEDIA_BUS_TYPE_PARALLEL			5

I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
is. I don't mind postponing that, but I think you could as well start here.
Up to you.

Should this be somehow visible in video-interfaces.yaml?

> +#define MEDIA_BUS_TYPE_BT656			6
> +
> +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */

-- 
Kind regards,

Sakari Ailus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
  2022-02-27 21:07     ` Sakari Ailus
@ 2022-02-27 21:16       ` Laurent Pinchart
  -1 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 21:16 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: devicetree, linux-media, linux-arm-kernel, Rob Herring,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

Hi Sakari,

On Sun, Feb 27, 2022 at 11:07:23PM +0200, Sakari Ailus wrote:
> On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> > Add a new dt-bindings/media/video-interfaces.h header that defines
> > macros corresponding to the bus types from media/video-interfaces.yaml.
> > This allows avoiding hardcoded constants in device tree sources.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >  create mode 100644 include/dt-bindings/media/video-interfaces.h
> > 
> > diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> > new file mode 100644
> > index 000000000000..e38058e1cca7
> > --- /dev/null
> > +++ b/include/dt-bindings/media/video-interfaces.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +/*
> > + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > + */
> > +
> > +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > +
> > +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> > +#define MEDIA_BUS_TYPE_CSI1			2
> > +#define MEDIA_BUS_TYPE_CCP2			3
> > +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> > +#define MEDIA_BUS_TYPE_PARALLEL			5
> 
> I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
> is. I don't mind postponing that, but I think you could as well start here.
> Up to you.

I think it's a good idea, but we then need to decide what to do with
other types of parallel buses. Let's start this discussion now, and
implement it in a patch on top of this series.

> Should this be somehow visible in video-interfaces.yaml?

I wish we could use macros in .yaml files instead of numerical values,
but I don't think that's possible. I can do this:

   bus-type:
     $ref: /schemas/types.yaml#/definitions/uint32
     enum:
-      - 1 # MIPI CSI-2 C-PHY
-      - 2 # MIPI CSI1
-      - 3 # CCP2
-      - 4 # MIPI CSI-2 D-PHY
-      - 5 # Parallel
-      - 6 # BT.656
+      - 1 # MIPI CSI-2 C-PHY (MEDIA_BUS_TYPE_CSI2_CPHY)
+      - 2 # MIPI CSI1 (MEDIA_BUS_TYPE_CSI1)
+      - 3 # CCP2 (MEDIA_BUS_TYPE_CCP2)
+      - 4 # MIPI CSI-2 D-PHY (MEDIA_BUS_TYPE_CSI2_DPHY)
+      - 5 # Parallel (MEDIA_BUS_TYPE_PARALLEL)
+      - 6 # BT.656 (MEDIA_BUS_TYPE_BT656)
     description:
-      Data bus type.
+      Data bus type. Use the macros listed above (defined in
+      dt-bindings/video-interfaces.h) instead of numerical values.

Any better proposal ?

> > +#define MEDIA_BUS_TYPE_BT656			6
> > +
> > +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
@ 2022-02-27 21:16       ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-02-27 21:16 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: devicetree, linux-media, linux-arm-kernel, Rob Herring,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

Hi Sakari,

On Sun, Feb 27, 2022 at 11:07:23PM +0200, Sakari Ailus wrote:
> On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> > Add a new dt-bindings/media/video-interfaces.h header that defines
> > macros corresponding to the bus types from media/video-interfaces.yaml.
> > This allows avoiding hardcoded constants in device tree sources.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >  create mode 100644 include/dt-bindings/media/video-interfaces.h
> > 
> > diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> > new file mode 100644
> > index 000000000000..e38058e1cca7
> > --- /dev/null
> > +++ b/include/dt-bindings/media/video-interfaces.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +/*
> > + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > + */
> > +
> > +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > +
> > +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> > +#define MEDIA_BUS_TYPE_CSI1			2
> > +#define MEDIA_BUS_TYPE_CCP2			3
> > +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> > +#define MEDIA_BUS_TYPE_PARALLEL			5
> 
> I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
> is. I don't mind postponing that, but I think you could as well start here.
> Up to you.

I think it's a good idea, but we then need to decide what to do with
other types of parallel buses. Let's start this discussion now, and
implement it in a patch on top of this series.

> Should this be somehow visible in video-interfaces.yaml?

I wish we could use macros in .yaml files instead of numerical values,
but I don't think that's possible. I can do this:

   bus-type:
     $ref: /schemas/types.yaml#/definitions/uint32
     enum:
-      - 1 # MIPI CSI-2 C-PHY
-      - 2 # MIPI CSI1
-      - 3 # CCP2
-      - 4 # MIPI CSI-2 D-PHY
-      - 5 # Parallel
-      - 6 # BT.656
+      - 1 # MIPI CSI-2 C-PHY (MEDIA_BUS_TYPE_CSI2_CPHY)
+      - 2 # MIPI CSI1 (MEDIA_BUS_TYPE_CSI1)
+      - 3 # CCP2 (MEDIA_BUS_TYPE_CCP2)
+      - 4 # MIPI CSI-2 D-PHY (MEDIA_BUS_TYPE_CSI2_DPHY)
+      - 5 # Parallel (MEDIA_BUS_TYPE_PARALLEL)
+      - 6 # BT.656 (MEDIA_BUS_TYPE_BT656)
     description:
-      Data bus type.
+      Data bus type. Use the macros listed above (defined in
+      dt-bindings/video-interfaces.h) instead of numerical values.

Any better proposal ?

> > +#define MEDIA_BUS_TYPE_BT656			6
> > +
> > +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
  2022-02-27 20:33   ` Laurent Pinchart
@ 2022-03-01 14:50     ` Rob Herring
  -1 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2022-03-01 14:50 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: devicetree, linux-media, linux-arm-kernel, Sakari Ailus,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> Add a new dt-bindings/media/video-interfaces.h header that defines
> macros corresponding to the bus types from media/video-interfaces.yaml.
> This allows avoiding hardcoded constants in device tree sources.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>  create mode 100644 include/dt-bindings/media/video-interfaces.h
> 
> diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> new file mode 100644
> index 000000000000..e38058e1cca7
> --- /dev/null
> +++ b/include/dt-bindings/media/video-interfaces.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */

Dual-license please.

> +/*
> + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + */
> +
> +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +
> +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> +#define MEDIA_BUS_TYPE_CSI1			2
> +#define MEDIA_BUS_TYPE_CCP2			3
> +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> +#define MEDIA_BUS_TYPE_PARALLEL			5
> +#define MEDIA_BUS_TYPE_BT656			6
> +
> +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
@ 2022-03-01 14:50     ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2022-03-01 14:50 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: devicetree, linux-media, linux-arm-kernel, Sakari Ailus,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> Add a new dt-bindings/media/video-interfaces.h header that defines
> macros corresponding to the bus types from media/video-interfaces.yaml.
> This allows avoiding hardcoded constants in device tree sources.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>  create mode 100644 include/dt-bindings/media/video-interfaces.h
> 
> diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> new file mode 100644
> index 000000000000..e38058e1cca7
> --- /dev/null
> +++ b/include/dt-bindings/media/video-interfaces.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */

Dual-license please.

> +/*
> + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + */
> +
> +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> +
> +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> +#define MEDIA_BUS_TYPE_CSI1			2
> +#define MEDIA_BUS_TYPE_CCP2			3
> +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> +#define MEDIA_BUS_TYPE_PARALLEL			5
> +#define MEDIA_BUS_TYPE_BT656			6
> +
> +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
  2022-02-27 21:16       ` Laurent Pinchart
@ 2022-03-01 15:04         ` Rob Herring
  -1 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2022-03-01 15:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sakari Ailus, devicetree, linux-media, linux-arm-kernel,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

On Sun, Feb 27, 2022 at 11:16:28PM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> On Sun, Feb 27, 2022 at 11:07:23PM +0200, Sakari Ailus wrote:
> > On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> > > Add a new dt-bindings/media/video-interfaces.h header that defines
> > > macros corresponding to the bus types from media/video-interfaces.yaml.
> > > This allows avoiding hardcoded constants in device tree sources.
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > >  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
> > >  1 file changed, 16 insertions(+)
> > >  create mode 100644 include/dt-bindings/media/video-interfaces.h
> > > 
> > > diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> > > new file mode 100644
> > > index 000000000000..e38058e1cca7
> > > --- /dev/null
> > > +++ b/include/dt-bindings/media/video-interfaces.h
> > > @@ -0,0 +1,16 @@
> > > +/* SPDX-License-Identifier: GPL-2.0-only */
> > > +/*
> > > + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > + */
> > > +
> > > +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > +
> > > +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> > > +#define MEDIA_BUS_TYPE_CSI1			2
> > > +#define MEDIA_BUS_TYPE_CCP2			3
> > > +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> > > +#define MEDIA_BUS_TYPE_PARALLEL			5
> > 
> > I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
> > is. I don't mind postponing that, but I think you could as well start here.
> > Up to you.
> 
> I think it's a good idea, but we then need to decide what to do with
> other types of parallel buses. Let's start this discussion now, and
> implement it in a patch on top of this series.

5 and what it means is an ABI. If it is ambiguous and needs to be more 
specific, then you need new numbers for all of those specific types.

If it is just a rename, I prefer it is done from the start.

> > Should this be somehow visible in video-interfaces.yaml?
> 
> I wish we could use macros in .yaml files instead of numerical values,
> but I don't think that's possible. I can do this:
> 
>    bus-type:
>      $ref: /schemas/types.yaml#/definitions/uint32
>      enum:
> -      - 1 # MIPI CSI-2 C-PHY
> -      - 2 # MIPI CSI1
> -      - 3 # CCP2
> -      - 4 # MIPI CSI-2 D-PHY
> -      - 5 # Parallel
> -      - 6 # BT.656
> +      - 1 # MIPI CSI-2 C-PHY (MEDIA_BUS_TYPE_CSI2_CPHY)
> +      - 2 # MIPI CSI1 (MEDIA_BUS_TYPE_CSI1)
> +      - 3 # CCP2 (MEDIA_BUS_TYPE_CCP2)
> +      - 4 # MIPI CSI-2 D-PHY (MEDIA_BUS_TYPE_CSI2_DPHY)
> +      - 5 # Parallel (MEDIA_BUS_TYPE_PARALLEL)
> +      - 6 # BT.656 (MEDIA_BUS_TYPE_BT656)

Seems a bit redundant to have both comment text and define. The only 
part missing from the defines is 'MIPI'.

>      description:
> -      Data bus type.
> +      Data bus type. Use the macros listed above (defined in
> +      dt-bindings/video-interfaces.h) instead of numerical values.
> 
> Any better proposal ?
> 
> > > +#define MEDIA_BUS_TYPE_BT656			6
> > > +
> > > +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
@ 2022-03-01 15:04         ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2022-03-01 15:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sakari Ailus, devicetree, linux-media, linux-arm-kernel,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

On Sun, Feb 27, 2022 at 11:16:28PM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> On Sun, Feb 27, 2022 at 11:07:23PM +0200, Sakari Ailus wrote:
> > On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> > > Add a new dt-bindings/media/video-interfaces.h header that defines
> > > macros corresponding to the bus types from media/video-interfaces.yaml.
> > > This allows avoiding hardcoded constants in device tree sources.
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > >  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
> > >  1 file changed, 16 insertions(+)
> > >  create mode 100644 include/dt-bindings/media/video-interfaces.h
> > > 
> > > diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> > > new file mode 100644
> > > index 000000000000..e38058e1cca7
> > > --- /dev/null
> > > +++ b/include/dt-bindings/media/video-interfaces.h
> > > @@ -0,0 +1,16 @@
> > > +/* SPDX-License-Identifier: GPL-2.0-only */
> > > +/*
> > > + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > + */
> > > +
> > > +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > +
> > > +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> > > +#define MEDIA_BUS_TYPE_CSI1			2
> > > +#define MEDIA_BUS_TYPE_CCP2			3
> > > +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> > > +#define MEDIA_BUS_TYPE_PARALLEL			5
> > 
> > I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
> > is. I don't mind postponing that, but I think you could as well start here.
> > Up to you.
> 
> I think it's a good idea, but we then need to decide what to do with
> other types of parallel buses. Let's start this discussion now, and
> implement it in a patch on top of this series.

5 and what it means is an ABI. If it is ambiguous and needs to be more 
specific, then you need new numbers for all of those specific types.

If it is just a rename, I prefer it is done from the start.

> > Should this be somehow visible in video-interfaces.yaml?
> 
> I wish we could use macros in .yaml files instead of numerical values,
> but I don't think that's possible. I can do this:
> 
>    bus-type:
>      $ref: /schemas/types.yaml#/definitions/uint32
>      enum:
> -      - 1 # MIPI CSI-2 C-PHY
> -      - 2 # MIPI CSI1
> -      - 3 # CCP2
> -      - 4 # MIPI CSI-2 D-PHY
> -      - 5 # Parallel
> -      - 6 # BT.656
> +      - 1 # MIPI CSI-2 C-PHY (MEDIA_BUS_TYPE_CSI2_CPHY)
> +      - 2 # MIPI CSI1 (MEDIA_BUS_TYPE_CSI1)
> +      - 3 # CCP2 (MEDIA_BUS_TYPE_CCP2)
> +      - 4 # MIPI CSI-2 D-PHY (MEDIA_BUS_TYPE_CSI2_DPHY)
> +      - 5 # Parallel (MEDIA_BUS_TYPE_PARALLEL)
> +      - 6 # BT.656 (MEDIA_BUS_TYPE_BT656)

Seems a bit redundant to have both comment text and define. The only 
part missing from the defines is 'MIPI'.

>      description:
> -      Data bus type.
> +      Data bus type. Use the macros listed above (defined in
> +      dt-bindings/video-interfaces.h) instead of numerical values.
> 
> Any better proposal ?
> 
> > > +#define MEDIA_BUS_TYPE_BT656			6
> > > +
> > > +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
  2022-03-01 15:04         ` Rob Herring
@ 2022-03-06 16:54           ` Laurent Pinchart
  -1 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-03-06 16:54 UTC (permalink / raw)
  To: Rob Herring
  Cc: Sakari Ailus, devicetree, linux-media, linux-arm-kernel,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

Hi Rob,

On Tue, Mar 01, 2022 at 09:04:10AM -0600, Rob Herring wrote:
> On Sun, Feb 27, 2022 at 11:16:28PM +0200, Laurent Pinchart wrote:
> > On Sun, Feb 27, 2022 at 11:07:23PM +0200, Sakari Ailus wrote:
> > > On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> > > > Add a new dt-bindings/media/video-interfaces.h header that defines
> > > > macros corresponding to the bus types from media/video-interfaces.yaml.
> > > > This allows avoiding hardcoded constants in device tree sources.
> > > > 
> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > ---
> > > >  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
> > > >  1 file changed, 16 insertions(+)
> > > >  create mode 100644 include/dt-bindings/media/video-interfaces.h
> > > > 
> > > > diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> > > > new file mode 100644
> > > > index 000000000000..e38058e1cca7
> > > > --- /dev/null
> > > > +++ b/include/dt-bindings/media/video-interfaces.h
> > > > @@ -0,0 +1,16 @@
> > > > +/* SPDX-License-Identifier: GPL-2.0-only */
> > > > +/*
> > > > + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > + */
> > > > +
> > > > +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > > +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > > +
> > > > +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> > > > +#define MEDIA_BUS_TYPE_CSI1			2
> > > > +#define MEDIA_BUS_TYPE_CCP2			3
> > > > +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> > > > +#define MEDIA_BUS_TYPE_PARALLEL			5
> > > 
> > > I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
> > > is. I don't mind postponing that, but I think you could as well start here.
> > > Up to you.
> > 
> > I think it's a good idea, but we then need to decide what to do with
> > other types of parallel buses. Let's start this discussion now, and
> > implement it in a patch on top of this series.
> 
> 5 and what it means is an ABI. If it is ambiguous and needs to be more 
> specific, then you need new numbers for all of those specific types.
> 
> If it is just a rename, I prefer it is done from the start.

It's both :-) It's ambiguous, but only used to refer to BT.601-liked
buses today in mainline, so I'll rename it. The number may be used to
refer to different types of parallel buses out-of-tree, and we can add
new types for that in mainline later when/if needed.

> > > Should this be somehow visible in video-interfaces.yaml?
> > 
> > I wish we could use macros in .yaml files instead of numerical values,
> > but I don't think that's possible. I can do this:
> > 
> >    bus-type:
> >      $ref: /schemas/types.yaml#/definitions/uint32
> >      enum:
> > -      - 1 # MIPI CSI-2 C-PHY
> > -      - 2 # MIPI CSI1
> > -      - 3 # CCP2
> > -      - 4 # MIPI CSI-2 D-PHY
> > -      - 5 # Parallel
> > -      - 6 # BT.656
> > +      - 1 # MIPI CSI-2 C-PHY (MEDIA_BUS_TYPE_CSI2_CPHY)
> > +      - 2 # MIPI CSI1 (MEDIA_BUS_TYPE_CSI1)
> > +      - 3 # CCP2 (MEDIA_BUS_TYPE_CCP2)
> > +      - 4 # MIPI CSI-2 D-PHY (MEDIA_BUS_TYPE_CSI2_DPHY)
> > +      - 5 # Parallel (MEDIA_BUS_TYPE_PARALLEL)
> > +      - 6 # BT.656 (MEDIA_BUS_TYPE_BT656)
> 
> Seems a bit redundant to have both comment text and define. The only 
> part missing from the defines is 'MIPI'.

I agree. I'll use the macros.

It would be nice if macros could be used instead of numerical values in
the YAML schema, but that's certainly not high on the wishlist.

> >      description:
> > -      Data bus type.
> > +      Data bus type. Use the macros listed above (defined in
> > +      dt-bindings/video-interfaces.h) instead of numerical values.
> > 
> > Any better proposal ?
> > 
> > > > +#define MEDIA_BUS_TYPE_BT656			6
> > > > +
> > > > +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dt-bindings: media: Add macros for video interface bus types
@ 2022-03-06 16:54           ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2022-03-06 16:54 UTC (permalink / raw)
  To: Rob Herring
  Cc: Sakari Ailus, devicetree, linux-media, linux-arm-kernel,
	Jacopo Mondi, Eugen Hristev, Hugues Fruchet, Maxime Coquelin,
	Alexandre Torgue

Hi Rob,

On Tue, Mar 01, 2022 at 09:04:10AM -0600, Rob Herring wrote:
> On Sun, Feb 27, 2022 at 11:16:28PM +0200, Laurent Pinchart wrote:
> > On Sun, Feb 27, 2022 at 11:07:23PM +0200, Sakari Ailus wrote:
> > > On Sun, Feb 27, 2022 at 10:33:51PM +0200, Laurent Pinchart wrote:
> > > > Add a new dt-bindings/media/video-interfaces.h header that defines
> > > > macros corresponding to the bus types from media/video-interfaces.yaml.
> > > > This allows avoiding hardcoded constants in device tree sources.
> > > > 
> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > ---
> > > >  include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
> > > >  1 file changed, 16 insertions(+)
> > > >  create mode 100644 include/dt-bindings/media/video-interfaces.h
> > > > 
> > > > diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
> > > > new file mode 100644
> > > > index 000000000000..e38058e1cca7
> > > > --- /dev/null
> > > > +++ b/include/dt-bindings/media/video-interfaces.h
> > > > @@ -0,0 +1,16 @@
> > > > +/* SPDX-License-Identifier: GPL-2.0-only */
> > > > +/*
> > > > + * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > + */
> > > > +
> > > > +#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > > +#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__
> > > > +
> > > > +#define MEDIA_BUS_TYPE_CSI2_CPHY		1
> > > > +#define MEDIA_BUS_TYPE_CSI1			2
> > > > +#define MEDIA_BUS_TYPE_CCP2			3
> > > > +#define MEDIA_BUS_TYPE_CSI2_DPHY		4
> > > > +#define MEDIA_BUS_TYPE_PARALLEL			5
> > > 
> > > I've been long thinkin of renaming "PARALLEL" as "BT.601" which it really
> > > is. I don't mind postponing that, but I think you could as well start here.
> > > Up to you.
> > 
> > I think it's a good idea, but we then need to decide what to do with
> > other types of parallel buses. Let's start this discussion now, and
> > implement it in a patch on top of this series.
> 
> 5 and what it means is an ABI. If it is ambiguous and needs to be more 
> specific, then you need new numbers for all of those specific types.
> 
> If it is just a rename, I prefer it is done from the start.

It's both :-) It's ambiguous, but only used to refer to BT.601-liked
buses today in mainline, so I'll rename it. The number may be used to
refer to different types of parallel buses out-of-tree, and we can add
new types for that in mainline later when/if needed.

> > > Should this be somehow visible in video-interfaces.yaml?
> > 
> > I wish we could use macros in .yaml files instead of numerical values,
> > but I don't think that's possible. I can do this:
> > 
> >    bus-type:
> >      $ref: /schemas/types.yaml#/definitions/uint32
> >      enum:
> > -      - 1 # MIPI CSI-2 C-PHY
> > -      - 2 # MIPI CSI1
> > -      - 3 # CCP2
> > -      - 4 # MIPI CSI-2 D-PHY
> > -      - 5 # Parallel
> > -      - 6 # BT.656
> > +      - 1 # MIPI CSI-2 C-PHY (MEDIA_BUS_TYPE_CSI2_CPHY)
> > +      - 2 # MIPI CSI1 (MEDIA_BUS_TYPE_CSI1)
> > +      - 3 # CCP2 (MEDIA_BUS_TYPE_CCP2)
> > +      - 4 # MIPI CSI-2 D-PHY (MEDIA_BUS_TYPE_CSI2_DPHY)
> > +      - 5 # Parallel (MEDIA_BUS_TYPE_PARALLEL)
> > +      - 6 # BT.656 (MEDIA_BUS_TYPE_BT656)
> 
> Seems a bit redundant to have both comment text and define. The only 
> part missing from the defines is 'MIPI'.

I agree. I'll use the macros.

It would be nice if macros could be used instead of numerical values in
the YAML schema, but that's certainly not high on the wishlist.

> >      description:
> > -      Data bus type.
> > +      Data bus type. Use the macros listed above (defined in
> > +      dt-bindings/video-interfaces.h) instead of numerical values.
> > 
> > Any better proposal ?
> > 
> > > > +#define MEDIA_BUS_TYPE_BT656			6
> > > > +
> > > > +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-03-06 16:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-27 20:33 [PATCH 0/2] dt-bindings: Add macros for video interface bus types Laurent Pinchart
2022-02-27 20:33 ` Laurent Pinchart
2022-02-27 20:33 ` [PATCH 1/2] dt-bindings: media: " Laurent Pinchart
2022-02-27 20:33   ` Laurent Pinchart
2022-02-27 21:07   ` Sakari Ailus
2022-02-27 21:07     ` Sakari Ailus
2022-02-27 21:16     ` Laurent Pinchart
2022-02-27 21:16       ` Laurent Pinchart
2022-03-01 15:04       ` Rob Herring
2022-03-01 15:04         ` Rob Herring
2022-03-06 16:54         ` Laurent Pinchart
2022-03-06 16:54           ` Laurent Pinchart
2022-03-01 14:50   ` Rob Herring
2022-03-01 14:50     ` Rob Herring
2022-02-27 20:33 ` [PATCH 2/2] dt-bindings: Use new video interface bus type macros in examples Laurent Pinchart
2022-02-27 20:33   ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.