1 From 09f5e82f292a900d17a5205e54a35e24296bd9f7 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Wed, 1 Apr 2020 08:46:29 +0100
4 Subject: [PATCH] media: uapi: v4l2-core: Add sensor ancillary data
7 Add V4L2_META_FMT_SENSOR_DATA format 4CC.
9 This new format will be used by the BCM2835 Unicam device to return
10 out camera sensor embedded data.
12 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
14 Documentation/media/uapi/v4l/meta-formats.rst | 1 +
15 .../uapi/v4l/pixfmt-meta-sensor-data.rst | 32 +++++++++++++++++++
16 drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
17 include/uapi/linux/videodev2.h | 1 +
18 4 files changed, 35 insertions(+)
19 create mode 100644 Documentation/media/uapi/v4l/pixfmt-meta-sensor-data.rst
21 --- a/Documentation/media/uapi/v4l/meta-formats.rst
22 +++ b/Documentation/media/uapi/v4l/meta-formats.rst
23 @@ -21,6 +21,7 @@ These formats are used for the :ref:`met
26 pixfmt-meta-intel-ipu3
27 + pixfmt-meta-sensor-data
32 +++ b/Documentation/media/uapi/v4l/pixfmt-meta-sensor-data.rst
34 +.. Permission is granted to copy, distribute and/or modify this
35 +.. document under the terms of the GNU Free Documentation License,
36 +.. Version 1.1 or any later version published by the Free Software
37 +.. Foundation, with no Invariant Sections, no Front-Cover Texts
38 +.. and no Back-Cover Texts. A copy of the license is included at
39 +.. Documentation/media/uapi/fdl-appendix.rst.
41 +.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
43 +.. _v4l2-meta-fmt-sensor-data:
45 +***********************************
46 +V4L2_META_FMT_SENSOR_DATA ('SENS')
47 +***********************************
49 +Sensor Ancillary Metadata
54 +This format describes ancillary data generated by a camera sensor and
55 +transmitted over a stream on the camera bus. Sensor vendors generally have their
56 +own custom format for this ancillary data. Some vendors follow a generic
57 +CSI-2/SMIA embedded data format as described in the `CSI-2 specification.
58 +<https://mipi.org/specifications/csi-2>`_
60 +The size of the embedded buffer is defined as a single line with a pixel width
61 +width specified in bytes. This is obtained by a call to the
62 +:c:type:`VIDIOC_SUBDEV_G_FMT` ioctl on the sensor subdevice where the ``pad``
63 +field in :c:type:`v4l2_subdev_format` is set to 1. Note that this size is fixed
64 +and cannot be modified with a call to :c:type:`VIDIOC_SUBDEV_S_FMT`.
66 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
67 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
68 @@ -1332,6 +1332,7 @@ static void v4l_fill_fmtdesc(struct v4l2
69 case V4L2_META_FMT_VSP1_HGT: descr = "R-Car VSP1 2-D Histogram"; break;
70 case V4L2_META_FMT_UVC: descr = "UVC Payload Header Metadata"; break;
71 case V4L2_META_FMT_D4XX: descr = "Intel D4xx UVC Metadata"; break;
72 + case V4L2_META_FMT_SENSOR_DATA: descr = "Sensor Ancillary Metadata"; break;
75 /* Compressed formats */
76 --- a/include/uapi/linux/videodev2.h
77 +++ b/include/uapi/linux/videodev2.h
78 @@ -769,6 +769,7 @@ struct v4l2_pix_format {
79 #define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */
80 #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */
81 #define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */
82 +#define V4L2_META_FMT_SENSOR_DATA v4l2_fourcc('S', 'E', 'N', 'S') /* Sensor Ancillary metadata */
84 /* priv field value to indicates that subsequent fields are valid. */
85 #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe