{"id":3684,"url":"https://patchwork.libcamera.org/api/1.1/patches/3684/?format=json","web_url":"https://patchwork.libcamera.org/patch/3684/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200504092829.10099-3-laurent.pinchart@ideasonboard.com>","date":"2020-05-04T09:28:25","name":"[libcamera-devel,2/6] include: uapi: Add header definitions for BCM2835 Unicam and ISP blocks","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c44d253aa2ba814e5e46e64ac20e46a030062ec0","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3684/mbox/","series":[{"id":880,"url":"https://patchwork.libcamera.org/api/1.1/series/880/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=880","date":"2020-05-04T09:28:23","name":"libcamera: Raspberry Pi camera support","version":1,"mbox":"https://patchwork.libcamera.org/series/880/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3684/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3684/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CD4F4603F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  4 May 2020 11:28:38 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 45F92304;\n\tMon,  4 May 2020 11:28:38 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"TfxnZQHe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588584518;\n\tbh=XkjIhHo56orF+/5XMA1wWg8nWC6d8Am2JMyNUzywyzw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=TfxnZQHeDmlDaPnlFrhxnGPBUL+czbvTGMA8N9tx5o39/iogMaumTrKksmwVvRdoT\n\tGr+jtxCXNA55dcU6kTAtJ5zVfmGsbxbiFCbG5Yao0xK6x561gMgYzMrc41giL1Eonu\n\tJJpSnnUIClyd3kkB2jVkbjp3DNVqKLjRara0tGAw=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  4 May 2020 12:28:25 +0300","Message-Id":"<20200504092829.10099-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200504092829.10099-1-laurent.pinchart@ideasonboard.com>","References":"<20200504092829.10099-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/6] include: uapi: Add header definitions\n\tfor BCM2835 Unicam and ISP blocks","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 04 May 2020 09:28:39 -0000"},"content":"From: Naushir Patuck <naush@raspberrypi.com>\n\nThis commit adds the headers and definitions required for the\nbcm2835_isp and bcm2835_unicam kernel modules.\n\nThe headers come from patches recently posted to the\nlinux-media@vger.kernel.org mailing list to add the Unicam and ISP\nperipherals drivers to the kernel.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/linux/bcm2835-isp.h     | 320 ++++++++++++++++++++++++++++++++\n include/linux/v4l2-controls.h   |   4 +\n include/linux/vc_sm_cma_ioctl.h | 135 ++++++++++++++\n include/linux/videodev2.h       |   2 +\n 4 files changed, 461 insertions(+)\n create mode 100644 include/linux/bcm2835-isp.h\n create mode 100644 include/linux/vc_sm_cma_ioctl.h","diff":"diff --git a/include/linux/bcm2835-isp.h b/include/linux/bcm2835-isp.h\nnew file mode 100644\nindex 000000000000..e7afc367fd76\n--- /dev/null\n+++ b/include/linux/bcm2835-isp.h\n@@ -0,0 +1,320 @@\n+/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */\n+/*\n+ * bcm2835-isp.h\n+ *\n+ * BCM2835 ISP driver - user space header file.\n+ *\n+ * Copyright © 2019-2020 Raspberry Pi (Trading) Ltd.\n+ *\n+ * Author: Naushir Patuck (naush@raspberrypi.com)\n+ *\n+ */\n+\n+#ifndef __BCM2835_ISP_H_\n+#define __BCM2835_ISP_H_\n+\n+#include <linux/v4l2-controls.h>\n+\n+#define V4L2_CID_USER_BCM2835_ISP_CC_MATRIX\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0001)\n+#define V4L2_CID_USER_BCM2835_ISP_LENS_SHADING\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0002)\n+#define V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0003)\n+#define V4L2_CID_USER_BCM2835_ISP_GEQ\t\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0004)\n+#define V4L2_CID_USER_BCM2835_ISP_GAMMA\t\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0005)\n+#define V4L2_CID_USER_BCM2835_ISP_DENOISE\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0006)\n+#define V4L2_CID_USER_BCM2835_ISP_SHARPEN\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0007)\n+#define V4L2_CID_USER_BCM2835_ISP_DPC\t\t\\\n+\t\t\t\t(V4L2_CID_USER_BCM2835_ISP_BASE + 0x0008)\n+\n+/*\n+ * All structs below are directly mapped onto the equivalent structs in\n+ * drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h\n+ * for convenience.\n+ */\n+\n+/**\n+ * struct bcm2835_isp_rational - Rational value type.\n+ *\n+ * @num:\tNumerator.\n+ * @den:\tDenominator.\n+ */\n+struct bcm2835_isp_rational {\n+\t__s32 num;\n+\t__s32 den;\n+};\n+\n+/**\n+ * struct bcm2835_isp_ccm - Colour correction matrix.\n+ *\n+ * @ccm:\t3x3 correction matrix coefficients.\n+ * @offsets:\t1x3 correction offsets.\n+ */\n+struct bcm2835_isp_ccm {\n+\tstruct bcm2835_isp_rational ccm[3][3];\n+\t__s32 offsets[3];\n+};\n+\n+/**\n+ * struct bcm2835_isp_custom_ccm - Custom CCM applied with the\n+ *\t\t\t\t   V4L2_CID_USER_BCM2835_ISP_CC_MATRIX ctrl.\n+ *\n+ * @enabled:\tEnable custom CCM.\n+ * @ccm:\tCustom CCM coefficients and offsets.\n+ */\n+struct bcm2835_isp_custom_ccm {\n+\t__u32 enabled;\n+\tstruct bcm2835_isp_ccm ccm;\n+};\n+\n+/**\n+ * enum bcm2835_isp_gain_format - format of the gains in the lens shading\n+ *\t\t\t\t  tables used with the\n+ *\t\t\t\t  V4L2_CID_USER_BCM2835_ISP_LENS_SHADING ctrl.\n+ *\n+ * @GAIN_FORMAT_U0P8_1:\t\tGains are u0.8 format, starting at 1.0\n+ * @GAIN_FORMAT_U1P7_0:\t\tGains are u1.7 format, starting at 0.0\n+ * @GAIN_FORMAT_U1P7_1:\t\tGains are u1.7 format, starting at 1.0\n+ * @GAIN_FORMAT_U2P6_0:\t\tGains are u2.6 format, starting at 0.0\n+ * @GAIN_FORMAT_U2P6_1:\t\tGains are u2.6 format, starting at 1.0\n+ * @GAIN_FORMAT_U3P5_0:\t\tGains are u3.5 format, starting at 0.0\n+ * @GAIN_FORMAT_U3P5_1:\t\tGains are u3.5 format, starting at 1.0\n+ * @GAIN_FORMAT_U4P10:\t\tGains are u4.10 format, starting at 0.0\n+ */\n+enum bcm2835_isp_gain_format {\n+\tGAIN_FORMAT_U0P8_1 = 0,\n+\tGAIN_FORMAT_U1P7_0 = 1,\n+\tGAIN_FORMAT_U1P7_1 = 2,\n+\tGAIN_FORMAT_U2P6_0 = 3,\n+\tGAIN_FORMAT_U2P6_1 = 4,\n+\tGAIN_FORMAT_U3P5_0 = 5,\n+\tGAIN_FORMAT_U3P5_1 = 6,\n+\tGAIN_FORMAT_U4P10  = 7,\n+};\n+\n+/**\n+ * struct bcm2835_isp_lens_shading - Lens shading tables supplied with the\n+ *\t\t\t\t     V4L2_CID_USER_BCM2835_ISP_LENS_SHADING\n+ *\t\t\t\t     ctrl.\n+ *\n+ * @enabled:\t\tEnable lens shading.\n+ * @grid_cell_size:\tSize of grid cells in samples (16, 32, 64, 128 or 256).\n+ * @grid_width:\t\tWidth of lens shading tables in grid cells.\n+ * @grid_stride:\tRow to row distance (in grid cells) between grid cells\n+ *\t\t\tin the same horizontal location.\n+ * @grid_height:\tHeight of lens shading tables in grid cells.\n+ * @mem_handle_table:\tMemory handle to the tables.\n+ * @ref_transform:\tReference transform - unsupported, please pass zero.\n+ * @corner_sampled:\tWhether the gains are sampled at the corner points\n+ *\t\t\tof the grid cells or in the cell centres.\n+ * @gain_format:\tFormat of the gains (see enum &bcm2835_isp_gain_format).\n+ */\n+struct bcm2835_isp_lens_shading {\n+\t__u32 enabled;\n+\t__u32 grid_cell_size;\n+\t__u32 grid_width;\n+\t__u32 grid_stride;\n+\t__u32 grid_height;\n+\t__u32 mem_handle_table;\n+\t__u32 ref_transform;\n+\t__u32 corner_sampled;\n+\t__u32 gain_format;\n+};\n+\n+/**\n+ * struct bcm2835_isp_black_level - Sensor black level set with the\n+ *\t\t\t\t    V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL ctrl.\n+ *\n+ * @enabled:\t\tEnable black level.\n+ * @black_level_r:\tBlack level for red channel.\n+ * @black_level_g:\tBlack level for green channels.\n+ * @black_level_b:\tBlack level for blue channel.\n+ */\n+struct bcm2835_isp_black_level {\n+\t__u32 enabled;\n+\t__u16 black_level_r;\n+\t__u16 black_level_g;\n+\t__u16 black_level_b;\n+\t__u8 pad_[2]; /* Unused */\n+};\n+\n+/**\n+ * struct bcm2835_isp_geq - Green equalisation parameters set with the\n+ *\t\t\t    V4L2_CID_USER_BCM2835_ISP_GEQ ctrl.\n+ *\n+ * @enabled:\tEnable green equalisation.\n+ * @offset:\tFixed offset of the green equalisation threshold.\n+ * @slope:\tSlope of the green equalisation threshold.\n+ */\n+struct bcm2835_isp_geq {\n+\t__u32 enabled;\n+\t__u32 offset;\n+\tstruct bcm2835_isp_rational slope;\n+};\n+\n+#define BCM2835_NUM_GAMMA_PTS 33\n+\n+/**\n+ * struct bcm2835_isp_gamma - Gamma parameters set with the\n+ *\t\t\t      V4L2_CID_USER_BCM2835_ISP_GAMMA ctrl.\n+ *\n+ * @enabled:\tEnable gamma adjustment.\n+ * @X:\t\tX values of the points defining the gamma curve.\n+ *\t\tValues should be scaled to 16 bits.\n+ * @Y:\t\tY values of the points defining the gamma curve.\n+ *\t\tValues should be scaled to 16 bits.\n+ */\n+struct bcm2835_isp_gamma {\n+\t__u32 enabled;\n+\t__u16 x[BCM2835_NUM_GAMMA_PTS];\n+\t__u16 y[BCM2835_NUM_GAMMA_PTS];\n+};\n+\n+/**\n+ * struct bcm2835_isp_denoise - Denoise parameters set with the\n+ *\t\t\t\tV4L2_CID_USER_BCM2835_ISP_DENOISE ctrl.\n+ *\n+ * @enabled:\tEnable denoise.\n+ * @constant:\tFixed offset of the noise threshold.\n+ * @slope:\tSlope of the noise threshold.\n+ * @strength:\tDenoise strength between 0.0 (off) and 1.0 (maximum).\n+ */\n+struct bcm2835_isp_denoise {\n+\t__u32 enabled;\n+\t__u32 constant;\n+\tstruct bcm2835_isp_rational slope;\n+\tstruct bcm2835_isp_rational strength;\n+};\n+\n+/**\n+ * struct bcm2835_isp_sharpen - Sharpen parameters set with the\n+ *\t\t\t\tV4L2_CID_USER_BCM2835_ISP_SHARPEN ctrl.\n+ *\n+ * @enabled:\tEnable sharpening.\n+ * @threshold:\tThreshold at which to start sharpening pixels.\n+ * @strength:\tStrength with which pixel sharpening increases.\n+ * @limit:\tLimit to the amount of sharpening applied.\n+ */\n+struct bcm2835_isp_sharpen {\n+\t__u32 enabled;\n+\tstruct bcm2835_isp_rational threshold;\n+\tstruct bcm2835_isp_rational strength;\n+\tstruct bcm2835_isp_rational limit;\n+};\n+\n+/**\n+ * enum bcm2835_isp_dpc_mode - defective pixel correction (DPC) strength.\n+ *\n+ * @DPC_MODE_OFF:\t\tNo DPC.\n+ * @DPC_MODE_NORMAL:\t\tNormal DPC.\n+ * @DPC_MODE_STRONG:\t\tStrong DPC.\n+ */\n+enum bcm2835_isp_dpc_mode {\n+\tDPC_MODE_OFF = 0,\n+\tDPC_MODE_NORMAL = 1,\n+\tDPC_MODE_STRONG = 2,\n+};\n+\n+/**\n+ * struct bcm2835_isp_dpc - Defective pixel correction (DPC) parameters set\n+ *\t\t\t    with the V4L2_CID_USER_BCM2835_ISP_DPC ctrl.\n+ *\n+ * @enabled:\tEnable DPC.\n+ * @strength:\tDPC strength (see enum &bcm2835_isp_dpc_mode).\n+ */\n+struct bcm2835_isp_dpc {\n+\t__u32 enabled;\n+\t__u32 strength;\n+};\n+\n+/*\n+ * ISP statistics structures.\n+ *\n+ * The bcm2835_isp_stats structure is generated at the output of the\n+ * statistics node.  Note that this does not directly map onto the statistics\n+ * output of the ISP HW.  Instead, the MMAL firmware code maps the HW statistics\n+ * to the bcm2835_isp_stats structure.\n+ */\n+#define DEFAULT_AWB_REGIONS_X 16\n+#define DEFAULT_AWB_REGIONS_Y 12\n+\n+#define NUM_HISTOGRAMS 2\n+#define NUM_HISTOGRAM_BINS 128\n+#define AWB_REGIONS (DEFAULT_AWB_REGIONS_X * DEFAULT_AWB_REGIONS_Y)\n+#define FLOATING_REGIONS 16\n+#define AGC_REGIONS 16\n+#define FOCUS_REGIONS 12\n+\n+/**\n+ * struct bcm2835_isp_stats_hist - Histogram statistics\n+ *\n+ * @r_hist:\tRed channel histogram.\n+ * @g_hist:\tCombined green channel histogram.\n+ * @b_hist:\tBlue channel histogram.\n+ */\n+struct bcm2835_isp_stats_hist {\n+\t__u32 r_hist[NUM_HISTOGRAM_BINS];\n+\t__u32 g_hist[NUM_HISTOGRAM_BINS];\n+\t__u32 b_hist[NUM_HISTOGRAM_BINS];\n+};\n+\n+/**\n+ * struct bcm2835_isp_stats_region - Region sums.\n+ *\n+ * @counted:\tThe number of 2x2 bayer tiles accumulated.\n+ * @notcounted:\tThe number of 2x2 bayer tiles not accumulated.\n+ * @r_sum:\tTotal sum of counted pixels in the red channel for a region.\n+ * @g_sum:\tTotal sum of counted pixels in the green channel for a region.\n+ * @b_sum:\tTotal sum of counted pixels in the blue channel for a region.\n+ */\n+struct bcm2835_isp_stats_region {\n+\t__u32 counted;\n+\t__u32 notcounted;\n+\t__u64 r_sum;\n+\t__u64 g_sum;\n+\t__u64 b_sum;\n+};\n+\n+/**\n+ * struct bcm2835_isp_stats_focus - Focus statistics.\n+ *\n+ * @contrast_val:\tFocus measure - accumulated output of the focus filter.\n+ *\t\t\tIn the first dimension, index [0] counts pixels below a\n+ *\t\t\tpreset threshold, and index [1] counts pixels above the\n+ *\t\t\tthreshold.  In the second dimension, index [0] uses the\n+ *\t\t\tfirst predefined filter, and index [1] uses the second\n+ *\t\t\tpredefined filter.\n+ * @contrast_val_num:\tThe number of counted pixels in the above accumulation.\n+ */\n+struct bcm2835_isp_stats_focus {\n+\t__u64 contrast_val[2][2];\n+\t__u32 contrast_val_num[2][2];\n+};\n+\n+/**\n+ * struct bcm2835_isp_stats - ISP statistics.\n+ *\n+ * @version:\t\tVersion of the bcm2835_isp_stats structure.\n+ * @size:\t\tSize of the bcm2835_isp_stats structure.\n+ * @hist:\t\tHistogram statistics for the entire image.\n+ * @awb_stats:\t\tStatistics for the regions defined for AWB calculations.\n+ * @floating_stats:\tStatistics for arbitrarily placed (floating) regions.\n+ * @agc_stats:\t\tStatistics for the regions defined for AGC calculations.\n+ * @focus_stats:\tFocus filter statistics for the focus regions.\n+ */\n+struct bcm2835_isp_stats {\n+\t__u32 version;\n+\t__u32 size;\n+\tstruct bcm2835_isp_stats_hist hist[NUM_HISTOGRAMS];\n+\tstruct bcm2835_isp_stats_region awb_stats[AWB_REGIONS];\n+\tstruct bcm2835_isp_stats_region floating_stats[FLOATING_REGIONS];\n+\tstruct bcm2835_isp_stats_region agc_stats[AGC_REGIONS];\n+\tstruct bcm2835_isp_stats_focus focus_stats[FOCUS_REGIONS];\n+};\n+\n+#endif /* __BCM2835_ISP_H_ */\ndiff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h\nindex 1213961c35cb..171351aee6fc 100644\n--- a/include/linux/v4l2-controls.h\n+++ b/include/linux/v4l2-controls.h\n@@ -192,6 +192,10 @@ enum v4l2_colorfx {\n  * We reserve 16 controls for this driver. */\n #define V4L2_CID_USER_IMX_BASE\t\t\t(V4L2_CID_USER_BASE + 0x10b0)\n \n+/* The base for the bcm2835-isp driver controls.\n+ * We reserve 16 controls for this driver. */\n+#define V4L2_CID_USER_BCM2835_ISP_BASE\t\t(V4L2_CID_USER_BASE + 0x10c0)\n+\n /* MPEG-class control IDs */\n /* The MPEG controls are applicable to all codec controls\n  * and the 'MPEG' part of the define is historical */\ndiff --git a/include/linux/vc_sm_cma_ioctl.h b/include/linux/vc_sm_cma_ioctl.h\nnew file mode 100644\nindex 000000000000..21b8758ea03f\n--- /dev/null\n+++ b/include/linux/vc_sm_cma_ioctl.h\n@@ -0,0 +1,135 @@\n+/*\n+Copyright (c) 2012, Broadcom Europe Ltd\n+All rights reserved.\n+\n+Redistribution and use in source and binary forms, with or without\n+modification, are permitted provided that the following conditions are met:\n+    * Redistributions of source code must retain the above copyright\n+      notice, this list of conditions and the following disclaimer.\n+    * Redistributions in binary form must reproduce the above copyright\n+      notice, this list of conditions and the following disclaimer in the\n+      documentation and/or other materials provided with the distribution.\n+    * Neither the name of the copyright holder nor the\n+      names of its contributors may be used to endorse or promote products\n+      derived from this software without specific prior written permission.\n+\n+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY\n+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+*/\n+\n+/*\n+ * Copyright 2019 Raspberry Pi (Trading) Ltd.  All rights reserved.\n+ *\n+ * Based on vmcs_sm_ioctl.h Copyright Broadcom Corporation.\n+ */\n+\n+#ifndef __VC_SM_CMA_IOCTL_H\n+#define __VC_SM_CMA_IOCTL_H\n+\n+/* ---- Include Files ---------------------------------------------------- */\n+\n+#include <linux/types.h>\t/* Needed for standard types */\n+\n+#include <linux/ioctl.h>\n+\n+/* ---- Constants and Types ---------------------------------------------- */\n+\n+#define VC_SM_CMA_RESOURCE_NAME               32\n+#define VC_SM_CMA_RESOURCE_NAME_DEFAULT       \"sm-host-resource\"\n+\n+/* Type define used to create unique IOCTL number */\n+#define VC_SM_CMA_MAGIC_TYPE                  'J'\n+\n+/* IOCTL commands on /dev/vc-sm-cma */\n+enum vc_sm_cma_cmd_e {\n+\tVC_SM_CMA_CMD_ALLOC = 0x5A,\t/* Start at 0x5A arbitrarily */\n+\n+\tVC_SM_CMA_CMD_IMPORT_DMABUF,\n+\n+\tVC_SM_CMA_CMD_CLEAN_INVALID2,\n+\n+\tVC_SM_CMA_CMD_LAST\t/* Do not delete */\n+};\n+\n+/* Cache type supported, conveniently matches the user space definition in\n+ * user-vcsm.h.\n+ */\n+enum vc_sm_cma_cache_e {\n+\tVC_SM_CMA_CACHE_NONE,\n+\tVC_SM_CMA_CACHE_HOST,\n+\tVC_SM_CMA_CACHE_VC,\n+\tVC_SM_CMA_CACHE_BOTH,\n+};\n+\n+/* IOCTL Data structures */\n+struct vc_sm_cma_ioctl_alloc {\n+\t/* user -> kernel */\n+\t__u32 size;\n+\t__u32 num;\n+\t__u32 cached;\t\t/* enum vc_sm_cma_cache_e */\n+\t__u32 pad;\n+\t__u8 name[VC_SM_CMA_RESOURCE_NAME];\n+\n+\t/* kernel -> user */\n+\t__s32 handle;\n+\t__u32 vc_handle;\n+\t__u64 dma_addr;\n+};\n+\n+struct vc_sm_cma_ioctl_import_dmabuf {\n+\t/* user -> kernel */\n+\t__s32 dmabuf_fd;\n+\t__u32 cached;\t\t/* enum vc_sm_cma_cache_e */\n+\t__u8 name[VC_SM_CMA_RESOURCE_NAME];\n+\n+\t/* kernel -> user */\n+\t__s32 handle;\n+\t__u32 vc_handle;\n+\t__u32 size;\n+\t__u32 pad;\n+\t__u64 dma_addr;\n+};\n+\n+/*\n+ * Cache functions to be set to struct vc_sm_cma_ioctl_clean_invalid2\n+ * invalidate_mode.\n+ */\n+#define VC_SM_CACHE_OP_NOP       0x00\n+#define VC_SM_CACHE_OP_INV       0x01\n+#define VC_SM_CACHE_OP_CLEAN     0x02\n+#define VC_SM_CACHE_OP_FLUSH     0x03\n+\n+struct vc_sm_cma_ioctl_clean_invalid2 {\n+\t__u32 op_count;\n+\t__u32 pad;\n+\tstruct vc_sm_cma_ioctl_clean_invalid_block {\n+\t\t__u32 invalidate_mode;\n+\t\t__u32 block_count;\n+\t\tvoid *  /*__user */start_address;\n+\t\t__u32 block_size;\n+\t\t__u32 inter_block_stride;\n+\t} s[0];\n+};\n+\n+/* IOCTL numbers */\n+#define VC_SM_CMA_IOCTL_MEM_ALLOC\\\n+\t_IOR(VC_SM_CMA_MAGIC_TYPE, VC_SM_CMA_CMD_ALLOC,\\\n+\t struct vc_sm_cma_ioctl_alloc)\n+\n+#define VC_SM_CMA_IOCTL_MEM_IMPORT_DMABUF\\\n+\t_IOR(VC_SM_CMA_MAGIC_TYPE, VC_SM_CMA_CMD_IMPORT_DMABUF,\\\n+\t struct vc_sm_cma_ioctl_import_dmabuf)\n+\n+#define VC_SM_CMA_IOCTL_MEM_CLEAN_INVALID2\\\n+\t_IOR(VC_SM_CMA_MAGIC_TYPE, VC_SM_CMA_CMD_CLEAN_INVALID2,\\\n+\t struct vc_sm_cma_ioctl_clean_invalid2)\n+\n+#endif /* __VC_SM_CMA_IOCTL_H */\ndiff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\nindex ab40b3272ed2..dde27de9b112 100644\n--- a/include/linux/videodev2.h\n+++ b/include/linux/videodev2.h\n@@ -749,6 +749,8 @@ struct v4l2_pix_format {\n #define V4L2_META_FMT_VSP1_HGT    v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */\n #define V4L2_META_FMT_UVC         v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */\n #define V4L2_META_FMT_D4XX        v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */\n+#define V4L2_META_FMT_SENSOR_DATA v4l2_fourcc('S', 'E', 'N', 'S') /* Sensor Ancillary metadata */\n+#define V4L2_META_FMT_BCM2835_ISP_STATS v4l2_fourcc('B', 'S', 'T', 'A') /* BCM2835 ISP image statistics output */\n \n /* Vendor specific - used for RK_ISP1 camera sub-system */\n #define V4L2_META_FMT_RK_ISP1_PARAMS\tv4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 params */\n","prefixes":["libcamera-devel","2/6"]}