Show a patch.

GET /api/patches/27161/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 27161,
    "url": "https://patchwork.libcamera.org/api/patches/27161/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27161/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260703122543.1991189-3-paul.elder@ideasonboard.com>",
    "date": "2026-07-03T12:25:08",
    "name": "[RFC,02/19] include: linux: rkisp2-config.h: update to v7.0",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5201f695c0069ba21d047c6cfb0686aaec7cf40b",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27161/mbox/",
    "series": [
        {
            "id": 6035,
            "url": "https://patchwork.libcamera.org/api/series/6035/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6035",
            "date": "2026-07-03T12:25:06",
            "name": "Add support for rkisp2",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6035/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27161/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27161/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AB719C3302\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jul 2026 12:26:08 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2B4F165FCE;\n\tFri,  3 Jul 2026 14:26:08 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4EE2E65F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jul 2026 14:26:07 +0200 (CEST)",
            "from neptunite.hamster-moth.ts.net (unknown\n\t[IPv6:2404:7a81:160:2100:a2cc:2f45:3bd7:2589])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 688351494;\n\tFri,  3 Jul 2026 14:25:18 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"a+uAA+zs\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783081521;\n\tbh=VMASAyHP5XydmR7UL3gcxwzBylUin8TniB3R2omdLmI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=a+uAA+zsF78JgEd7jXZgYaAN0Qqc+Q1YhkaUflOqyNIoloIWkXJ1ZUOFXKOBwmnHn\n\tcVnA11cu1bN6T8mG7D8+A/bwiZ66EnD2659Ah7tsCAiYb4mRQXsT/tTGVTvQVSuu9+\n\tOCCz/UdwNDokS48I8rNibKL90pSAOquqACnUIkc8=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "laurent.pinchart@ideasonboard.com",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>, michael.riesch@collabora.com, \n\txuhf@rock-chips.com, stefan.klug@ideasonboard.com,\n\tkieran.bingham@ideasonboard.com, dan.scally@ideasonboard.com,\n\tjacopo.mondi@ideasonboard.com, nicolas.dufresne@collabora.com,\n\tlibcamera-devel@lists.libcamera.org",
        "Subject": "[RFC PATCH 02/19] include: linux: rkisp2-config.h: update to v7.0",
        "Date": "Fri,  3 Jul 2026 21:25:08 +0900",
        "Message-ID": "<20260703122543.1991189-3-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.47.2",
        "In-Reply-To": "<20260703122543.1991189-1-paul.elder@ideasonboard.com>",
        "References": "<20260703122543.1991189-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Update rkisp2-config.h to the most recent version.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nThis comes from RFC of \"media: rockchip: rkisp2: Add rkisp2 driver\":\nhttps://lore.kernel.org/all/20260424175853.638202-1-paul.elder@ideasonboard.com/\n---\n include/linux/README          |   2 +-\n include/linux/rkisp2-config.h | 562 ++++++++++++++++++++++++++++++++++\n include/linux/videodev2.h     |   4 +\n 3 files changed, 567 insertions(+), 1 deletion(-)\n create mode 100644 include/linux/rkisp2-config.h",
    "diff": "diff --git a/include/linux/README b/include/linux/README\nindex b02952bb28ca..fed0903f5d37 100644\n--- a/include/linux/README\n+++ b/include/linux/README\n@@ -1,4 +1,4 @@\n # SPDX-License-Identifier: CC0-1.0\n \n-Files in this directory are imported from v7.0 of the Linux kernel. Do not\n+Files in this directory are imported from v7.0-19-g4869cb2fa7d1 of the Linux kernel. Do not\n modify them manually.\ndiff --git a/include/linux/rkisp2-config.h b/include/linux/rkisp2-config.h\nnew file mode 100644\nindex 000000000000..5b69490be93d\n--- /dev/null\n+++ b/include/linux/rkisp2-config.h\n@@ -0,0 +1,562 @@\n+/* SPDX-License-Identifier: ((GPL-2.0-or-later WITH Linux-syscall-note) OR MIT) */\n+/*\n+ * Rockchip ISP2 userspace API\n+ * Copyright (C) 2017 Rockchip Electronics Co., Ltd.\n+ * Copyright (C) 2026 Ideas on Board Oy.\n+ */\n+\n+#ifndef _RKISP2_CONFIG_H\n+#define _RKISP2_CONFIG_H\n+\n+#include <linux/types.h>\n+\n+#include <linux/media/v4l2-isp.h>\n+\n+#define RKISP2_ISP_GAMMA_OUT_MAX_SEGMENTS   49\n+\n+#define RKISP2_ISP_LSC_SAMPLES_MAX\t\t17\n+#define RKISP2_ISP_LSC_SECTORS_TBL_SIZE_MAX\t16\n+\n+#define RKISP2_ISP_AE_MEAN_MAX_LITE\t25\n+#define RKISP2_ISP_AE_MEAN_MAX_BIG\t225\n+\n+#define RKISP2_ISP_HIST_WEIGHT_GRIDS_SIZE_LITE\t25\n+#define RKISP2_ISP_HIST_WEIGHT_GRIDS_SIZE_BIG\t225\n+#define RKISP2_ISP_HIST_WEIGHT_GRIDS_SIZE_MAX\t\tRKISP2_ISP_HIST_WEIGHT_GRIDS_SIZE_BIG\n+\n+#define RKISP2_ISP_HIST_BIN_N_MAX\t256\n+\n+#define RKISP2_ISP_AWB_COUNTS_SIZE\t225\n+\n+/**\n+ * enum rkisp2_isp_version - ISP variants\n+ *\n+ * @RKISP3_V0: Used at least in RK3588\n+ */\n+enum rkisp2_isp_version {\n+\tRKISP3_V0 = 30,\n+};\n+\n+/* See enum rkisp2_isp_goc_segments for logarithmic segment sizes */\n+enum rkisp2_isp_goc_mode {\n+\tRKISP2_ISP_GOC_MODE_LOGARITHMIC,\n+\tRKISP2_ISP_GOC_MODE_EQUIDISTANT\n+};\n+\n+/*\n+ * The segments are:\n+ * 1 x8, 2 x4, 4 x4, 8 x4, 16 x4, 32 x4, 64 x4, 128 x4, 256 x4, 512 x4\n+ * In 48-segment mode, the last group of 512 x4 becomes 256 x8\n+ */\n+enum rkisp2_isp_goc_segments {\n+\tRKISP2_ISP_GOC_SEGMENTS_44,\n+\tRKISP2_ISP_GOC_SEGMENTS_48\n+};\n+\n+enum rkisp2_isp_lsc_config {\n+\tRKISP2_ISP_LSC_CONFIG_8X8,\n+\tRKISP2_ISP_LSC_CONFIG_16X16\n+};\n+\n+enum rkisp2_isp_set_active_table_when {\n+\tRKISP2_ISP_LSC_SET_ACTIVE_TABLE_AFTER,\n+\tRKISP2_ISP_LSC_SET_ACTIVE_TABLE_BEFORE,\n+};\n+\n+enum rkisp2_isp_histogram_mode {\n+\tRKISP2_ISP_HISTOGRAM_MODE_DISABLE,\n+\tRKISP2_ISP_HISTOGRAM_MODE_R_HISTOGRAM = 2,\n+\tRKISP2_ISP_HISTOGRAM_MODE_G_HISTOGRAM,\n+\tRKISP2_ISP_HISTOGRAM_MODE_B_HISTOGRAM,\n+\tRKISP2_ISP_HISTOGRAM_MODE_Y_HISTOGRAM\n+};\n+\n+/*\n+ * This selects which bits are used from the input data to compute the\n+ * histogram\n+ */\n+enum rkisp2_isp_histogram_data_sel {\n+\tRKISP2_ISP_HISTOGRAM_DATA_SEL_11_4,\n+\tRKISP2_ISP_HISTOGRAM_DATA_SEL_10_3,\n+\tRKISP2_ISP_HISTOGRAM_DATA_SEL_9_2,\n+\tRKISP2_ISP_HISTOGRAM_DATA_SEL_8_1,\n+\tRKISP2_ISP_HISTOGRAM_DATA_SEL_7_0,\n+};\n+\n+/*---------- Statistics ------------*/\n+\n+/**\n+ * struct rkisp2_isp_ae_lite - statistics auto exposure data\n+ *\n+ * @exp_mean_r: Mean luminance value of block xy for r channel\n+ * @exp_mean_g: Mean luminance value of block xy for g channel\n+ * @exp_mean_b: Mean luminance value of block xy for b channel\n+ * @done: This set to nonzero when the stats are ready\n+ *\n+ * Image is divided into 5x5 blocks on lite and 15x15 blocks on big.\n+ */\n+struct rkisp2_isp_ae_lite {\n+\t__u16 exp_mean_r[RKISP2_ISP_AE_MEAN_MAX_LITE];\n+\t__u16 exp_mean_g[RKISP2_ISP_AE_MEAN_MAX_LITE];\n+\t__u16 exp_mean_b[RKISP2_ISP_AE_MEAN_MAX_LITE];\n+\t__u8 done;\n+};\n+\n+/**\n+ * struct rkisp2_cif_isp_hist_stat - statistics histogram data\n+ *\n+ * @hist_bins: measured bin counters. Each bin is a 28 bits unsigned fixed point\n+ *\t       type. Bits 0-4 are the fractional part and bits 5-27 are the\n+ *\t       integer part.\n+ * @done: This set to nonzero when the stats are ready\n+ *\n+ * There are 256 bins, at least on 3.x.\n+ */\n+struct rkisp2_isp_hist {\n+\t__u32 hist_bins[RKISP2_ISP_HIST_BIN_N_MAX];\n+\t__u8 done;\n+};\n+\n+/**\n+ * struct rkisp2_isp_awb - statistics auto white balance data\n+ *\n+ * @counts_r: Counts of red (18-bits)\n+ * @counts_g: Counts of green (18-bits)\n+ * @counts_b: Counts of blue (18-bits)\n+ * @counts_w: Counts of white point (10-bits)\n+ * @done: This set to nonzero when the stats are ready\n+ *\n+ * TODO Figure out what is being counted\n+ */\n+struct rkisp2_isp_awb {\n+\t__u32 counts_r[RKISP2_ISP_AWB_COUNTS_SIZE];\n+\t__u32 counts_g[RKISP2_ISP_AWB_COUNTS_SIZE];\n+\t__u32 counts_b[RKISP2_ISP_AWB_COUNTS_SIZE];\n+\t__u16 counts_w[RKISP2_ISP_AWB_COUNTS_SIZE];\n+\t__u8 done;\n+};\n+\n+/**\n+ * struct rkisp2_stats_buffer - 3A statistics for the RkISP2\n+ *\n+ * @ae_lite: ae lite stats\n+ * @hist_lite: histogram lite stats\n+ * @hist_big0: histogram big0 stats\n+ * @hist_big1: histogram big0 stats\n+ * @hist_big2: histogram big0 stats\n+ * @awb: awb stats\n+ */\n+struct rkisp2_stats_buffer {\n+\tstruct rkisp2_isp_ae_lite ae_lite;\n+\tstruct rkisp2_isp_hist hist_lite;\n+\tstruct rkisp2_isp_hist hist_big0;\n+\tstruct rkisp2_isp_hist hist_big1;\n+\tstruct rkisp2_isp_hist hist_big2;\n+\tstruct rkisp2_isp_awb awb;\n+};\n+\n+/*---------- Parameters ------------*/\n+\n+/**\n+ * enum rkisp2_params_block_type - RkISP1 extensible params block type\n+ *\n+ * @RKISP2_PARAMS_BLOCK_BLS: Black level subtraction\n+ * @RKISP2_PARAMS_BLOCK_AWB_GAINS: AWB gains\n+ * @RKISP2_PARAMS_BLOCK_CSM: Color conversion coefficients (in the ISP block)\n+ * @RKISP2_PARAMS_BLOCK_CCM: Color correction matrix (in the CCM block)\n+ * @RKISP2_PARAMS_BLOCK_GOC: Gamma out correction\n+ * @RKISP2_PARAMS_BLOCK_LSC: Lens shading correction\n+ * @RKISP2_PARAMS_BLOCK_AE_LITE: AE measurement config (lite)\n+ * @RKISP2_PARAMS_BLOCK_HIST_LITE: Histogram measurement config (lite)\n+ * @RKISP2_PARAMS_BLOCK_HIST_BIG0: Histogram measurement config (zeroth big block)\n+ * @RKISP2_PARAMS_BLOCK_HIST_BIG1: Histogram measurement config (first big block)\n+ * @RKISP2_PARAMS_BLOCK_HIST_BIG2: Histogram measurement config (second big block)\n+ * @RKISP2_PARAMS_BLOCK_AWB_MEAS: AWB measurements config\n+ * */\n+enum rkisp2_params_block_type {\n+\tRKISP2_PARAMS_BLOCK_BLS,\n+\tRKISP2_PARAMS_BLOCK_AWB_GAINS,\n+\tRKISP2_PARAMS_BLOCK_CSM,\n+\tRKISP2_PARAMS_BLOCK_CCM,\n+\tRKISP2_PARAMS_BLOCK_GOC,\n+\tRKISP2_PARAMS_BLOCK_LSC,\n+\tRKISP2_PARAMS_BLOCK_AE_LITE,\n+\tRKISP2_PARAMS_BLOCK_HIST_LITE,\n+\tRKISP2_PARAMS_BLOCK_HIST_BIG0,\n+\tRKISP2_PARAMS_BLOCK_HIST_BIG1,\n+\tRKISP2_PARAMS_BLOCK_HIST_BIG2,\n+\tRKISP2_PARAMS_BLOCK_AWB_MEAS,\n+};\n+\n+/**\n+ * struct rkisp2_isp_window -  measurement window.\n+ *\n+ * Measurements are calculated per window inside the frame.\n+ * This struct represents a window for a measurement.\n+ *\n+ * @h_offs: the horizontal offset of the window from the left of the frame in pixels.\n+ * @v_offs: the vertical offset of the window from the top of the frame in pixels.\n+ * @h_size: the horizontal size of the window in pixels\n+ * @v_size: the vertical size of the window in pixels.\n+ */\n+struct rkisp2_isp_window {\n+\t__u16 h_offs;\n+\t__u16 v_offs;\n+\t__u16 h_size;\n+\t__u16 v_size;\n+};\n+\n+/**\n+ * struct rkisp2_isp_bls_fixed_val - BLS fixed subtraction values\n+ *\n+ * These are signed 13-bit (-4096 to +4095).\n+ *\n+ * @a: Fixed black level value for Bayer channel 0\n+ * @b: Fixed black level value for Bayer channel 1\n+ * @c: Fixed black level value for Bayer channel 2\n+ * @d: Fixed black level value for Bayer channel 3\n+ */\n+struct rkisp2_isp_bls_fixed_val {\n+\t__s16 a;\n+\t__s16 b;\n+\t__s16 c;\n+\t__s16 d;\n+};\n+\n+/**\n+ * struct rkisp2_isp_awb_gains - Auto white balance gain in the ISP block\n+ *\n+ * All fields in this struct are 16 bit, where:\n+ * 0x100h = 1, unsigned integer value, range 0 to 63 with 8 bit fractional part.\n+ *\n+ * This leaves the upper two msb unaccounted for; it is unknown if these are\n+ * unused or misdocumented.\n+ *\n+ * TODO investigate the upper two bits\n+ *\n+ * @r: gain value for red component.\n+ * @gr: gain value for green component in red line.\n+ * @b: gain value for blue component.\n+ * @gb: gain value for green component in blue line.\n+ */\n+struct rkisp2_isp_awb_gains {\n+\t__u16 r;\n+\t__u16 gr;\n+\t__u16 b;\n+\t__u16 gb;\n+};\n+\n+/**\n+ * struct rkisp2_isp_color_cc - Color coefficients\n+ *\n+ * @r: Red coefficient\n+ * @g: Green coefficient\n+ * @b: Blue coefficient\n+ */\n+struct rkisp2_isp_color_cc {\n+\t__u8 r;\n+\t__u8 g;\n+\t__u8 b;\n+};\n+\n+/**\n+ * struct rkisp2_isp_awb_color_quad - Group of RGB and luminance for AWB\n+ *\n+ * TODO redesign this?\n+ *\n+ * @r: Red\n+ * @g: Green\n+ * @b: Blue\n+ * @y: Y (luminance)\n+ */\n+struct rkisp2_isp_awb_color_quad {\n+\t__u8 r;\n+\t__u8 g;\n+\t__u8 b;\n+\t__u8 y;\n+};\n+\n+/**\n+ * struct rkisp2_params_bls - RkISP2 params BLS config\n+ *\n+ * RkISP2 parameters Black Level Subtraction configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_BLS`.\n+ *\n+ * TODO Check if auto-mode and window selection is for both blocks or just for\n+ * one block (it might be the same as 2.x)\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @enable_auto: Automatic mode activated means that the measured values\n+ *\t\t are subtracted. Otherwise the fixed subtraction\n+ *\t\t values will be subtracted.\n+ * @enabled_windows: enabled window (bit 0 for window 1, bit 1 for window 2)\n+ * @bls_window1: Measurement window 1 size\n+ * @bls_window2: Measurement window 2 size\n+ * @bls_samples: Set amount of measured pixels for each Bayer position\n+ *\t\t (A, B, C and D) to 2^bls_samples. (TODO needs confirmation)\n+ * @bls_fixed_val: Black Level Subtraction fixed values for the BLS module at\n+ * \t\t   the front of the pipeline\n+ * @bls1_fixed_val: Black Level Subtraction fixed values for the BLS module after\n+ * \t\t    bayer noise reduction\n+ */\n+struct rkisp2_params_bls {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 enable_auto;\n+\t__u8 enabled_windows;\n+\tstruct rkisp2_isp_window bls_window1;\n+\tstruct rkisp2_isp_window bls_window2;\n+\t__u8 bls_samples;\n+\tstruct rkisp2_isp_bls_fixed_val bls_fixed_val;\n+\tstruct rkisp2_isp_bls_fixed_val bls1_fixed_val;\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct rkisp2_params_awb_gains - RKISP2 params AWB gains config\n+ *\n+ * RkISP2 parameters auto white balance gains configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_AWB_GAINS`.\n+ *\n+ * TODO investigate what the different blocks mean\n+ *\n+ * Block 0 is equivalent to the awb gains block on 2.x, but blocks 1 and\n+ * 2 do not exist on 2.x.\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @gains: Gains configuration for block i\n+ */\n+struct rkisp2_params_awb_gains {\n+\tstruct v4l2_isp_params_block_header header;\n+\tstruct rkisp2_isp_awb_gains gains[3];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct rkisp2_params_csm - Configuration used by Color Space Conversion\n+ *\n+ * RkISP2 parameters histogram configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_CSM`.\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @coeff: color correction matrix. Values are 9-bit signed fixed-point numbers with 2 bit integer\n+ *\t\tand 7 bit fractional part, ranging from -2 (0x100) to +1.992 (0x0FF). 0 is\n+ *\t\trepresented by 0x000 and a coefficient value of 1 as 0x080.\n+ */\n+struct rkisp2_params_csm {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u16 coeff[3][3];\n+};\n+\n+/**\n+ * struct rkisp2_params_ccm - Configuration used by Color Correction Matrix\n+ *\n+ * RkISP2 parameters histogram configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_CCM`.\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @high_y_alpha_adj_en: Enable CCM high Y alpha adjustment (TODO figure out what this does)\n+ * @coeff: color correction matrix. Values are 11-bit signed fixed-point numbers with 4 bit integer\n+ *\t\tand 7 bit fractional part, ranging from -8 (0x400) to +7.992 (0x3FF). 0 is\n+ *\t\trepresented by 0x000 and a coefficient value of 1 as 0x080. The\n+ *\t\tvalue is expanded 128 times (TODO figure out what this means).\n+ * @offset: Red, Green, Blue offsets for the color correction matrix. 12-bits\n+ *\t    wide ranging from -4096 to 4095, but only for red; green and blue are 11-bit\n+ *\t    signed fixed-point like coeff, but are still 12-bits wide.\n+ * @y_coeff: Red, Green, Blue coefficients for RGB2Y calculation. red and green\n+ *\t     are 11-bits wide and blue is 12-bits wide. The value is expanded 128 times.\n+ * @alp: CCM curve y-axis point definition for ccm input pixel's luminance.\n+ *       11-bit unsigned ranging from 0 to 1024. The value is expanded 128 times.\n+ * @inflection_point: Inflection point of the ccm alpha interpolation curve.\n+ * \t\t      The inflection point is 2^inflection_point. Since the maximum y-value is\n+ * \t\t      1024, the maximum value of this field is expected to be 10 (0xa), but the\n+ * \t\t      documentation says 4'b10.\n+ */\n+struct rkisp2_params_ccm {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 high_y_alpha_adj_en;\n+\t__u16 coeff[3][3];\n+\t__u16 offset[3];\n+\t__u16 y_coeff[3];\n+\t__u16 alp[17];\n+\t__u8 inflection_point;\n+};\n+\n+/**\n+ * struct rkisp2_params_goc - Configuration used by Gamma Out correction\n+ *\n+ * RkISP2 parameters gamma out correction configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_GOC`.\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @mode: goc mode (from enum rkisp2_isp_goc_mode)\n+ * @segments: segments mode (from enum rkisp2_isp_goc_segments)\n+ * @offset: offset value of the gamma out curve\n+ * @gamma_y: gamma out curve y-axis for all color components\n+ *\n+ * The number of entries of @gamma_y depends on the segments mode. The entries\n+ * are 12-bit unsigned.\n+ */\n+struct rkisp2_params_goc {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 mode;\n+\t__u8 segments;\n+\t__u16 offset;\n+\t__u16 gamma_y[RKISP2_ISP_GAMMA_OUT_MAX_SEGMENTS];\n+};\n+\n+/**\n+ * struct rkisp2_params_lsc - Configuration used by Lens shading correction\n+ *\n+ * RkISP2 parameters lens shading correction configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_LSC`.\n+ *\n+ * The LSC module on the rkisp2 two tables: the 0th table and the 1th table.\n+ * They can be programmed independently and (somewhat) simultaneously, and can be\n+ * swapped by setting a single register. Hence the UAPI here is designed so\n+ * that all these components can be controlled independently.\n+ *\n+ * In the first dimension of {r,gr,gb,b}_data_tbl we can designate which table\n+ * to write the data to. write_table is then used to signal whether to write\n+ * the data, and this can be controlled for both tables. active_table chooses\n+ * which table to activate. set_active_table_when signals whether to set the\n+ * active_table before or after programming the table. This allows\n+ * optimizations such as setting a future table in one parameter buffer while\n+ * swapping before setting it.\n+ *\n+ * This design gives us more control. For example, if we want to only program\n+ * the 0th table without modifying the 1th table, we do not need to also\n+ * populate the 1th table and we can use write_table to designate that we only\n+ * want to program the 0th table. We can also swap tables without needing to\n+ * re-populate the tables by setting active_table and unsetting write_table.\n+ *\n+ * {x,y}_sizes designates the grid of the LSC, and the table entries above\n+ * correspond to the *vertices* of the grid. {x,y}_grads control the bilinear\n+ * interpolation within the grid.\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @r_data_tbl: Sample table red\n+ * @gr_data_tbl: Sample table green (red)\n+ * @gb_data_tbl: Sample table green (blue)\n+ * @b_data_tbl: Sample table blue\n+ * @write_table: Set to 1 to signal to write the respective table from above\n+ * @active_table: Choose which of the two tables is active (0 or 1)\n+ * @set_active_table_when: From rkisp2_isp_set_active_table_when; switch to the\n+ *\t\t\t   active table before or after programming the table\n+ * @x_sizes: Sizes x\n+ * @y_sizes: Sizes y\n+ * @x_grads: Gradients x\n+ * @y_grads: Gradients y\n+ * @window_mode: From enum rkisp2_isp_lsc_config\n+ */\n+struct rkisp2_params_lsc {\n+\tstruct v4l2_isp_params_block_header header;\n+\n+\t__u16 r_data_tbl[2][RKISP2_ISP_LSC_SAMPLES_MAX][RKISP2_ISP_LSC_SAMPLES_MAX];\n+\t__u16 gr_data_tbl[2][RKISP2_ISP_LSC_SAMPLES_MAX][RKISP2_ISP_LSC_SAMPLES_MAX];\n+\t__u16 gb_data_tbl[2][RKISP2_ISP_LSC_SAMPLES_MAX][RKISP2_ISP_LSC_SAMPLES_MAX];\n+\t__u16 b_data_tbl[2][RKISP2_ISP_LSC_SAMPLES_MAX][RKISP2_ISP_LSC_SAMPLES_MAX];\n+\t__u8 write_table[2];\n+\t__u8 active_table;\n+\t__u8 set_active_table_when;\n+\n+\t__u16 x_sizes[RKISP2_ISP_LSC_SECTORS_TBL_SIZE_MAX];\n+\t__u16 y_sizes[RKISP2_ISP_LSC_SECTORS_TBL_SIZE_MAX];\n+\t__u16 x_grads[RKISP2_ISP_LSC_SECTORS_TBL_SIZE_MAX];\n+\t__u16 y_grads[RKISP2_ISP_LSC_SECTORS_TBL_SIZE_MAX];\n+\n+\t__u8 window_mode;\n+};\n+\n+/**\n+ * struct rkisp2_params_ae_lite - RKISP2 params AE lite config\n+ *\n+ * RkISP2 parameters auto exposure measurement configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_AE_LITE`.\n+ *\n+ * TODO change window_num to enum?\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @window_num: 0 for 1x1, 1 for 5x5\n+ * @meas_window: Size of measurement window. First window for 5x5.\n+ */\n+struct rkisp2_params_ae_lite {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 window_num;\n+\tstruct rkisp2_isp_window meas_window;\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct rkisp2_params_hist_lite RKISP2 params histogram lite config\n+ *\n+ * RkISP2 parameters histogram configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_HIST_LITE`.\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @data_sel: Data selection mode (from enum rkisp2_isp_histogram_data_sel)\n+ * @mode: Histogram mode (from enum rkisp2_isp_histogram_mode)\n+ * @stepsize: Predivider (count every <stepsize> pixel)\n+ * @waterline: Waterline for region statics\n+ * @coeffs: Coefficients for raw2y formula\n+ * @meas_window: Size of first measurement subwindow\n+ * @weights: Weights\n+ */\n+struct rkisp2_params_hist_lite {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 data_sel;\n+\t__u8 mode;\n+\t__u8 stepsize;\n+\t__u16 waterline;\n+\tstruct rkisp2_isp_color_cc coeffs;\n+\tstruct rkisp2_isp_window meas_window;\n+\t__u8 weights[RKISP2_ISP_HIST_WEIGHT_GRIDS_SIZE_LITE];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * Same as struct rkisp2_params_hist_lite but for big channel\n+ *\n+ * RkISP2 parameters histogram configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_HIST_BIG{0,1,2}`.\n+ *\n+ * @window_num: 0 or 1 for 5x5, 2 or 3 for 15x15\n+ */\n+struct rkisp2_params_hist_big {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 window_num;\n+\t__u8 data_sel;\n+\t__u8 mode;\n+\t__u8 stepsize;\n+\t__u16 waterline;\n+\tstruct rkisp2_isp_color_cc coeffs;\n+\tstruct rkisp2_isp_window meas_window;\n+\t__u8 weights[RKISP2_ISP_HIST_WEIGHT_GRIDS_SIZE_BIG];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct rkisp2_params_awb_meas - Configuration used by rawawb\n+ *\n+ * RkISP2 parameters AWB measurement configuration block.\n+ * Identified by :c:type:`RKISP2_PARAMS_BLOCK_AWB_MEAS`.\n+ *\n+ * @header: The RkISP2 parameters block header\n+ * @meas_window: Size of first measurement subwindow (13 bits)\n+ * @limits: Limits for white point detection [min, max] (8 bits)\n+ * @weights: Weights (6-bits)\n+ */\n+struct rkisp2_params_awb_meas {\n+\tstruct v4l2_isp_params_block_header header;\n+\tstruct rkisp2_isp_window meas_window;\n+\tstruct rkisp2_isp_awb_color_quad limits[2];\n+\t__u8 weights[RKISP2_ISP_AWB_COUNTS_SIZE];\n+};\n+\n+#define RKISP2_PARAMS_MAX_SIZE\t\t\t\t\t\\\n+\t(sizeof(struct rkisp2_params_bls)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_awb_gains)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_csm)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_ccm)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_goc)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_lsc)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_ae_lite)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_hist_lite)\t\t\t+\\\n+\tsizeof(struct rkisp2_params_hist_big) * 3\t\t+\\\n+\tsizeof(struct rkisp2_params_awb_meas))\n+\n+#endif /* _RKISP2_CONFIG_H */\ndiff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\nindex 8bccad84ff83..d242f3c0ab5f 100644\n--- a/include/linux/videodev2.h\n+++ b/include/linux/videodev2.h\n@@ -851,6 +851,10 @@ struct v4l2_pix_format {\n #define V4L2_META_FMT_RK_ISP1_STAT_3A\tv4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */\n #define V4L2_META_FMT_RK_ISP1_EXT_PARAMS\tv4l2_fourcc('R', 'K', '1', 'E') /* Rockchip ISP1 3a Extensible Parameters */\n \n+/* Vendor specific - used for RKISP2 camera sub-system */\n+#define V4L2_META_FMT_RKISP2_PARAMS\tv4l2_fourcc('R', 'K', '2', 'P') /* Rockchip ISP2 Parameters */\n+#define V4L2_META_FMT_RKISP2_STATS\tv4l2_fourcc('R', 'K', '2', 'S') /* Rockchip ISP2 3A Statistics */\n+\n /* Vendor specific - used for C3_ISP */\n #define V4L2_META_FMT_C3ISP_PARAMS\tv4l2_fourcc('C', '3', 'P', 'M') /* Amlogic C3 ISP Parameters */\n #define V4L2_META_FMT_C3ISP_STATS\tv4l2_fourcc('C', '3', 'S', 'T') /* Amlogic C3 ISP Statistics */\n",
    "prefixes": [
        "RFC",
        "02/19"
    ]
}