diff mbox series

[v2,1/3] dt-bindings: media: Add macros for video interface bus types

Message ID 20220306173905.22990-2-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series dt-bindings: Add macros for video interface bus types | expand

Commit Message

Laurent Pinchart March 6, 2022, 5:39 p.m. UTC
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>
---
Changes since v1:

- Dual-license under GPL-2.0-only or MIT
- Rename PARALLEL TO BT601
---
 include/dt-bindings/media/video-interfaces.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 include/dt-bindings/media/video-interfaces.h

Comments

Laurent Pinchart March 6, 2022, 6:04 p.m. UTC | #1
On Sun, Mar 06, 2022 at 07:39:03PM +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>
> ---
> Changes since v1:
> 
> - Dual-license under GPL-2.0-only or MIT
> - Rename PARALLEL TO BT601

Contrary to popular belief, further investigation revealed that BT.601
doesn't define VSYNC and HSYNC (or HREF, as it is also commonly called)
signals. MEDIA_BUS_TYPE_BT601 is thus likely not a good name. I haven't
been able to find a standard for parallel camera interfaces that would
be a good match here. On the display side there's MIPI DPI, but on the
camera side it seems things have evolved quite organically. I may have
missed something though.

> ---
>  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..4c3810edff4c
> --- /dev/null
> +++ b/include/dt-bindings/media/video-interfaces.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
> +/*
> + * 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_BT601			5
> +#define MEDIA_BUS_TYPE_BT656			6
> +
> +#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */
Rob Herring March 8, 2022, 11:18 p.m. UTC | #2
On Sun, Mar 06, 2022 at 08:04:49PM +0200, Laurent Pinchart wrote:
> On Sun, Mar 06, 2022 at 07:39:03PM +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>
> > ---
> > Changes since v1:
> > 
> > - Dual-license under GPL-2.0-only or MIT
> > - Rename PARALLEL TO BT601
> 
> Contrary to popular belief, further investigation revealed that BT.601
> doesn't define VSYNC and HSYNC (or HREF, as it is also commonly called)
> signals. MEDIA_BUS_TYPE_BT601 is thus likely not a good name. I haven't
> been able to find a standard for parallel camera interfaces that would
> be a good match here. On the display side there's MIPI DPI, but on the
> camera side it seems things have evolved quite organically. I may have
> missed something though.

So keep 'PARALLEL' and anything less ambiguous will be a new type.

Rob
diff mbox series

Patch

diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h
new file mode 100644
index 000000000000..4c3810edff4c
--- /dev/null
+++ b/include/dt-bindings/media/video-interfaces.h
@@ -0,0 +1,16 @@ 
+/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
+/*
+ * 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_BT601			5
+#define MEDIA_BUS_TYPE_BT656			6
+
+#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */