a89ce1a8d6ba8d578d10243f110ef4b8abcf36cb
[openwrt/staging/linusw.git] /
1 From 2f43e72bd136b5e69dbc6453555d8c5fecbb9d3a 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
5 V4L2 foucc type.
6
7 Add V4L2_META_FMT_SENSOR_DATA format 4CC.
8
9 This new format will be used by the BCM2835 Unicam device to return
10 out camera sensor embedded data.
11
12 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
13 ---
14 .../userspace-api/media/v4l/meta-formats.rst | 1 +
15 .../media/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/userspace-api/media/v4l/pixfmt-meta-sensor-data.rst
20
21 --- a/Documentation/userspace-api/media/v4l/meta-formats.rst
22 +++ b/Documentation/userspace-api/media/v4l/meta-formats.rst
23 @@ -15,6 +15,7 @@ These formats are used for the :ref:`met
24 pixfmt-meta-d4xx
25 pixfmt-meta-intel-ipu3
26 pixfmt-meta-rkisp1
27 + pixfmt-meta-sensor-data
28 pixfmt-meta-uvc
29 pixfmt-meta-vsp1-hgo
30 pixfmt-meta-vsp1-hgt
31 --- /dev/null
32 +++ b/Documentation/userspace-api/media/v4l/pixfmt-meta-sensor-data.rst
33 @@ -0,0 +1,32 @@
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.
40 +..
41 +.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
42 +
43 +.. _v4l2-meta-fmt-sensor-data:
44 +
45 +***********************************
46 +V4L2_META_FMT_SENSOR_DATA ('SENS')
47 +***********************************
48 +
49 +Sensor Ancillary Metadata
50 +
51 +Description
52 +===========
53 +
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>`_
59 +
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`.
65 +
66 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
67 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
68 @@ -1404,6 +1404,7 @@ static void v4l_fill_fmtdesc(struct v4l2
69 case V4L2_META_FMT_UVC: descr = "UVC Payload Header Metadata"; break;
70 case V4L2_META_FMT_D4XX: descr = "Intel D4xx UVC Metadata"; break;
71 case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break;
72 + case V4L2_META_FMT_SENSOR_DATA: descr = "Sensor Ancillary Metadata"; break;
73
74 default:
75 /* Compressed formats */
76 --- a/include/uapi/linux/videodev2.h
77 +++ b/include/uapi/linux/videodev2.h
78 @@ -778,6 +778,7 @@ struct v4l2_pix_format {
79 #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */
80 #define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */
81 #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D') /* Vivid Metadata */
82 +#define V4L2_META_FMT_SENSOR_DATA v4l2_fourcc('S', 'E', 'N', 'S') /* Sensor Ancillary metadata */
83
84 /* priv field value to indicates that subsequent fields are valid. */
85 #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe