[PATCH v4 1/7] dt-bindings: media: Add macros for video interface devices

Kieran Bingham <[email protected]> Tue, 04 Aug 2026 20:43:28 +0100
Newsgroups gmane.linux.kernel,gmane.linux.drivers.video-input-infrastructure,gmane.linux.drivers.devicetree,gmane.linux.ports.arm.kernel,gmane.linux.ports.arm.msm,gmane.linux.kernel.renesas-soc,gmane.linux.ports.arm.rockchip,gmane.linux.ports.tegra
Message-ID <[email protected]>
Add a new dt-bindings/media/video-interface-devices.h header that
defines macros corresponding to the orientation enumeration types from
media/video-interface-devices.yaml.

Expand the documentation of the video-interface-devices orientation to
reference the new header which provides human readable defines for the
orientation enum, to help avoid hardcoding values in dts.

Reviewed-by: Laurent Pinchart <[email protected]>
Acked-by: Conor Dooley <[email protected]>
Acked-by: Sakari Ailus <[email protected]>
Reviewed-by: Vladimir Zapolskiy <[email protected]>
Reviewed-by: Frank Li <[email protected]>
Acked-by: Michael Riesch <[email protected]>
Reviewed-by: David Heidelberg <[email protected]>
Signed-off-by: Kieran Bingham <[email protected]>
---
 .../bindings/media/video-interface-devices.yaml         | 17 +++++++++++------
 include/dt-bindings/media/video-interface-devices.h     | 13 +++++++++++++
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/video-interface-devices.yaml b/Documentation/devicetree/bindings/media/video-interface-devices.yaml
index a81d2a155fe668a95e0916c99e702de8b5c07005..c9c3f4f1671969ac2e77f2db4cdc598a6886047b 100644
--- a/Documentation/devicetree/bindings/media/video-interface-devices.yaml
+++ b/Documentation/devicetree/bindings/media/video-interface-devices.yaml
@@ -392,17 +392,22 @@ properties:
       The orientation of a device (typically an image sensor or a flash LED)
       describing its mounting position relative to the usage orientation of the
       system where the device is installed on.
+      See include/dt-bindings/media/video-interface-devices.h.
+
     $ref: /schemas/types.yaml#/definitions/uint32
     enum:
-        # Front. The device is mounted on the front facing side of the system. For
-        # mobile devices such as smartphones, tablets and laptops the front side
-        # is the user facing side.
+        # MEDIA_ORIENTATION_FRONT
+        # The device is mounted on the front facing side of the system. For
+        # mobile devices such as smartphones, tablets and laptops the front
+        # side is the user facing side.
       - 0
-        # Back. The device is mounted on the back side of the system, which is
+        # MEDIA_ORIENTATION_BACK
+        # The device is mounted on the back side of the system, which is
         # defined as the opposite side of the front facing one.
       - 1
-        # External. The device is not attached directly to the system but is
-        # attached in a way that allows it to move freely.
+        # MEDIA_ORIENTATION_EXTERNAL
+        # The device is not attached directly to the system but is attached in
+        # a way that allows it to move freely.
       - 2
 
 additionalProperties: true
diff --git a/include/dt-bindings/media/video-interface-devices.h b/include/dt-bindings/media/video-interface-devices.h
new file mode 100644
index 0000000000000000000000000000000000000000..d2340b4572927a734f679bcab4f7c845b94454af
--- /dev/null
+++ b/include/dt-bindings/media/video-interface-devices.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
+/*
+ * Copyright (C) 2026 Kieran Bingham <[email protected]>
+ */
+
+#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACE_DEVICES_H__
+#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACE_DEVICES_H__
+
+#define MEDIA_ORIENTATION_FRONT		0
+#define MEDIA_ORIENTATION_BACK		1
+#define MEDIA_ORIENTATION_EXTERNAL	2
+
+#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACE_DEVICES_H__ */

-- 
2.53.0