Patch Detail
Show a patch.
GET /api/1.1/patches/2036/?format=api
{ "id": 2036, "url": "https://patchwork.libcamera.org/api/1.1/patches/2036/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2036/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190927024417.725906-12-niklas.soderlund@ragnatech.se>", "date": "2019-09-27T02:44:15", "name": "[libcamera-devel,v3,11/13] include: linux: Add rkisp1 kernel header and format definitions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "973a71b33897bd8eea7861bdd6ccf54fe3a1e453", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2036/mbox/", "series": [ { "id": 508, "url": "https://patchwork.libcamera.org/api/1.1/series/508/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=508", "date": "2019-09-27T02:44:04", "name": "libcamera: ipa: Add basic IPA support", "version": 3, "mbox": "https://patchwork.libcamera.org/series/508/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2036/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2036/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CB36C61922\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Sep 2019 04:45:35 +0200 (CEST)", "from bismarck.berto.se (unknown [84.172.88.101])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid d12c36b4-e0d0-11e9-bdc3-005056917a89;\n\tFri, 27 Sep 2019 04:45:08 +0200 (CEST)" ], "X-Halon-ID": "d12c36b4-e0d0-11e9-bdc3-005056917a89", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 27 Sep 2019 04:44:15 +0200", "Message-Id": "<20190927024417.725906-12-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20190927024417.725906-1-niklas.soderlund@ragnatech.se>", "References": "<20190927024417.725906-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 11/13] include: linux: Add rkisp1\n\tkernel header and format definitions", "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": "Fri, 27 Sep 2019 02:45:36 -0000" }, "content": "Add kernel header and format definitions from v8 of the rkisp1 series\n[1]. The driver is currently out of tree, the header file is not\nexported as part of the standard kernel uAPI.\n\nHeaders have been exported on top of a v5.2 kernel tree using\nscripts/headers_install.sh.\n\n1. https://lore.kernel.org/linux-media/20190730184256.30338-1-helen.koike@collabora.com/\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nAcked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nAcked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/linux/rkisp1-config.h | 816 ++++++++++++++++++++++++++++++++++\n include/linux/videodev2.h | 4 +\n 2 files changed, 820 insertions(+)\n create mode 100644 include/linux/rkisp1-config.h", "diff": "diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\nnew file mode 100644\nindex 0000000000000000..f0d1bd82e857fd79\n--- /dev/null\n+++ b/include/linux/rkisp1-config.h\n@@ -0,0 +1,816 @@\n+/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */\n+/*\n+ * Rockchip isp1 driver\n+ * Copyright (C) 2017 Rockchip Electronics Co., Ltd.\n+ */\n+\n+/*\n+ * TODO: Improve documentation, mostly regarding abbreviation and hardware\n+ * specificities.\n+ */\n+\n+#ifndef _RKISP1_CONFIG_H\n+#define _RKISP1_CONFIG_H\n+\n+#include <linux/types.h>\n+#include <linux/v4l2-controls.h>\n+\n+#define CIFISP_MODULE_DPCC (1 << 0)\n+#define CIFISP_MODULE_BLS (1 << 1)\n+#define CIFISP_MODULE_SDG (1 << 2)\n+#define CIFISP_MODULE_HST (1 << 3)\n+#define CIFISP_MODULE_LSC (1 << 4)\n+#define CIFISP_MODULE_AWB_GAIN (1 << 5)\n+#define CIFISP_MODULE_FLT (1 << 6)\n+#define CIFISP_MODULE_BDM (1 << 7)\n+#define CIFISP_MODULE_CTK (1 << 8)\n+#define CIFISP_MODULE_GOC (1 << 9)\n+#define CIFISP_MODULE_CPROC (1 << 10)\n+#define CIFISP_MODULE_AFC (1 << 11)\n+#define CIFISP_MODULE_AWB (1 << 12)\n+#define CIFISP_MODULE_IE (1 << 13)\n+#define CIFISP_MODULE_AEC (1 << 14)\n+#define CIFISP_MODULE_WDR (1 << 15)\n+#define CIFISP_MODULE_DPF (1 << 16)\n+#define CIFISP_MODULE_DPF_STRENGTH (1 << 17)\n+\n+#define CIFISP_CTK_COEFF_MAX 0x100\n+#define CIFISP_CTK_OFFSET_MAX 0x800\n+\n+#define CIFISP_AE_MEAN_MAX 25\n+#define CIFISP_HIST_BIN_N_MAX 16\n+#define CIFISP_AFM_MAX_WINDOWS 3\n+#define CIFISP_DEGAMMA_CURVE_SIZE 17\n+\n+#define CIFISP_BDM_MAX_TH 0xFF\n+\n+/*\n+ * Black level compensation\n+ */\n+/* maximum value for horizontal start address */\n+#define CIFISP_BLS_START_H_MAX 0x00000FFF\n+/* maximum value for horizontal stop address */\n+#define CIFISP_BLS_STOP_H_MAX 0x00000FFF\n+/* maximum value for vertical start address */\n+#define CIFISP_BLS_START_V_MAX 0x00000FFF\n+/* maximum value for vertical stop address */\n+#define CIFISP_BLS_STOP_V_MAX 0x00000FFF\n+/* maximum is 2^18 = 262144*/\n+#define CIFISP_BLS_SAMPLES_MAX 0x00000012\n+/* maximum value for fixed black level */\n+#define CIFISP_BLS_FIX_SUB_MAX 0x00000FFF\n+/* minimum value for fixed black level */\n+#define CIFISP_BLS_FIX_SUB_MIN 0xFFFFF000\n+/* 13 bit range (signed)*/\n+#define CIFISP_BLS_FIX_MASK 0x00001FFF\n+\n+/*\n+ * Automatic white balance measurments\n+ */\n+#define CIFISP_AWB_MAX_GRID 1\n+#define CIFISP_AWB_MAX_FRAMES 7\n+\n+/*\n+ * Gamma out\n+ */\n+/* Maximum number of color samples supported */\n+#define CIFISP_GAMMA_OUT_MAX_SAMPLES 17\n+\n+/*\n+ * Lens shade correction\n+ */\n+#define CIFISP_LSC_GRAD_TBL_SIZE 8\n+#define CIFISP_LSC_SIZE_TBL_SIZE 8\n+/*\n+ * The following matches the tuning process,\n+ * not the max capabilities of the chip.\n+ * Last value unused.\n+ */\n+#define\tCIFISP_LSC_DATA_TBL_SIZE 290\n+\n+/*\n+ * Histogram calculation\n+ */\n+/* Last 3 values unused. */\n+#define CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28\n+\n+/*\n+ * Defect Pixel Cluster Correction\n+ */\n+#define CIFISP_DPCC_METHODS_MAX 3\n+\n+/*\n+ * Denoising pre filter\n+ */\n+#define CIFISP_DPF_MAX_NLF_COEFFS 17\n+#define CIFISP_DPF_MAX_SPATIAL_COEFFS 6\n+\n+/*\n+ * Measurement types\n+ */\n+#define CIFISP_STAT_AWB (1 << 0)\n+#define CIFISP_STAT_AUTOEXP (1 << 1)\n+#define CIFISP_STAT_AFM_FIN (1 << 2)\n+#define CIFISP_STAT_HIST (1 << 3)\n+\n+enum cifisp_histogram_mode {\n+\tCIFISP_HISTOGRAM_MODE_DISABLE,\n+\tCIFISP_HISTOGRAM_MODE_RGB_COMBINED,\n+\tCIFISP_HISTOGRAM_MODE_R_HISTOGRAM,\n+\tCIFISP_HISTOGRAM_MODE_G_HISTOGRAM,\n+\tCIFISP_HISTOGRAM_MODE_B_HISTOGRAM,\n+\tCIFISP_HISTOGRAM_MODE_Y_HISTOGRAM\n+};\n+\n+enum cifisp_awb_mode_type {\n+\tCIFISP_AWB_MODE_MANUAL,\n+\tCIFISP_AWB_MODE_RGB,\n+\tCIFISP_AWB_MODE_YCBCR\n+};\n+\n+enum cifisp_flt_mode {\n+\tCIFISP_FLT_STATIC_MODE,\n+\tCIFISP_FLT_DYNAMIC_MODE\n+};\n+\n+/**\n+ * enum cifisp_exp_ctrl_autostop - stop modes\n+ * @CIFISP_EXP_CTRL_AUTOSTOP_0: continuous measurement\n+ * @CIFISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame\n+ */\n+enum cifisp_exp_ctrl_autostop {\n+\tCIFISP_EXP_CTRL_AUTOSTOP_0 = 0,\n+\tCIFISP_EXP_CTRL_AUTOSTOP_1 = 1,\n+};\n+\n+/**\n+ * enum cifisp_exp_meas_mode - Exposure measure mode\n+ * @CIFISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B\n+ * @CIFISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256)\n+ */\n+enum cifisp_exp_meas_mode {\n+\tCIFISP_EXP_MEASURING_MODE_0,\n+\tCIFISP_EXP_MEASURING_MODE_1,\n+};\n+\n+/*---------- PART1: Input Parameters ------------*/\n+\n+struct cifisp_window {\n+\t__u16 h_offs;\n+\t__u16 v_offs;\n+\t__u16 h_size;\n+\t__u16 v_size;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_bls_fixed_val - BLS fixed subtraction values\n+ *\n+ * The values will be subtracted from the sensor\n+ * values. Therefore a negative value means addition instead of subtraction!\n+ *\n+ * @r: Fixed (signed!) subtraction value for Bayer pattern R\n+ * @gr: Fixed (signed!) subtraction value for Bayer pattern Gr\n+ * @gb: Fixed (signed!) subtraction value for Bayer pattern Gb\n+ * @b: Fixed (signed!) subtraction value for Bayer pattern B\n+ */\n+struct cifisp_bls_fixed_val {\n+\t__s16 r;\n+\t__s16 gr;\n+\t__s16 gb;\n+\t__s16 b;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_bls_config - Configuration used by black level subtraction\n+ *\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+ * @en_windows: enabled window\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.\n+ * @cifisp_bls_fixed_val: Fixed subtraction values\n+ */\n+struct cifisp_bls_config {\n+\t__u8 enable_auto;\n+\t__u8 en_windows;\n+\tstruct cifisp_window bls_window1;\n+\tstruct cifisp_window bls_window2;\n+\t__u8 bls_samples;\n+\tstruct cifisp_bls_fixed_val fixed_val;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_dpcc_methods_config - Methods Configuration used by DPCC\n+ *\n+ * Methods Configuration used by Defect Pixel Cluster Correction\n+ *\n+ * @method: Method enable bits\n+ * @line_thresh: Line threshold\n+ * @line_mad_fac: Line MAD factor\n+ * @pg_fac: Peak gradient factor\n+ * @rnd_thresh: Rank Neighbor Difference threshold\n+ * @rg_fac: Rank gradient factor\n+ */\n+struct cifisp_dpcc_methods_config {\n+\t__u32 method;\n+\t__u32 line_thresh;\n+\t__u32 line_mad_fac;\n+\t__u32 pg_fac;\n+\t__u32 rnd_thresh;\n+\t__u32 rg_fac;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_dpcc_methods_config - Configuration used by DPCC\n+ *\n+ * Configuration used by Defect Pixel Cluster Correction\n+ *\n+ * @mode: dpcc output mode\n+ * @output_mode: whether use hard coded methods\n+ * @set_use: stage1 methods set\n+ * @methods: methods config\n+ * @ro_limits: rank order limits\n+ * @rnd_offs: differential rank offsets for rank neighbor difference\n+ */\n+struct cifisp_dpcc_config {\n+\t__u32 mode;\n+\t__u32 output_mode;\n+\t__u32 set_use;\n+\tstruct cifisp_dpcc_methods_config methods[CIFISP_DPCC_METHODS_MAX];\n+\t__u32 ro_limits;\n+\t__u32 rnd_offs;\n+} __attribute__ ((packed));\n+\n+struct cifisp_gamma_corr_curve {\n+\t__u16 gamma_y[CIFISP_DEGAMMA_CURVE_SIZE];\n+} __attribute__ ((packed));\n+\n+struct cifisp_gamma_curve_x_axis_pnts {\n+\t__u32 gamma_dx0;\n+\t__u32 gamma_dx1;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_gamma_corr_curve - Configuration used by sensor degamma\n+ *\n+ * @curve_x: gamma curve point definition axis for x\n+ * @xa_pnts: x increments\n+ */\n+struct cifisp_sdg_config {\n+\tstruct cifisp_gamma_corr_curve curve_r;\n+\tstruct cifisp_gamma_corr_curve curve_g;\n+\tstruct cifisp_gamma_corr_curve curve_b;\n+\tstruct cifisp_gamma_curve_x_axis_pnts xa_pnts;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_lsc_config - Configuration used by Lens shading correction\n+ *\n+ * refer to REF_01 for details\n+ */\n+struct cifisp_lsc_config {\n+\t__u32 r_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n+\t__u32 gr_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n+\t__u32 gb_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n+\t__u32 b_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n+\n+\t__u32 x_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];\n+\t__u32 y_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];\n+\n+\t__u32 x_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];\n+\t__u32 y_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];\n+\t__u16 config_width;\n+\t__u16 config_height;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_ie_config - Configuration used by image effects\n+ *\n+ * @eff_mat_1: 3x3 Matrix Coefficients for Emboss Effect 1\n+ * @eff_mat_2: 3x3 Matrix Coefficients for Emboss Effect 2\n+ * @eff_mat_3: 3x3 Matrix Coefficients for Emboss 3/Sketch 1\n+ * @eff_mat_4: 3x3 Matrix Coefficients for Sketch Effect 2\n+ * @eff_mat_5: 3x3 Matrix Coefficients for Sketch Effect 3\n+ * @eff_tint: Chrominance increment values of tint (used for sepia effect)\n+ */\n+struct cifisp_ie_config {\n+\t__u16 effect;\n+\t__u16 color_sel;\n+\t__u16 eff_mat_1;\n+\t__u16 eff_mat_2;\n+\t__u16 eff_mat_3;\n+\t__u16 eff_mat_4;\n+\t__u16 eff_mat_5;\n+\t__u16 eff_tint;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_cproc_config - Configuration used by Color Processing\n+ *\n+ * @c_out_range: Chrominance pixel clipping range at output.\n+ *\t\t (0 for limit, 1 for full)\n+ * @y_in_range: Luminance pixel clipping range at output.\n+ * @y_out_range: Luminance pixel clipping range at output.\n+ * @contrast: 00~ff, 0.0~1.992\n+ * @brightness: 80~7F, -128~+127\n+ * @sat: saturation, 00~FF, 0.0~1.992\n+ * @hue: 80~7F, -90~+87.188\n+ */\n+struct cifisp_cproc_config {\n+\t__u8 c_out_range;\n+\t__u8 y_in_range;\n+\t__u8 y_out_range;\n+\t__u8 contrast;\n+\t__u8 brightness;\n+\t__u8 sat;\n+\t__u8 hue;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_awb_meas_config - Configuration used by auto white balance\n+ *\n+ * @awb_wnd: white balance measurement window (in pixels)\n+ *\t (from enum cifisp_awb_mode_type)\n+ * @max_y: only pixels values < max_y contribute to awb measurement, set to 0\n+ *\t to disable this feature\n+ * @min_y: only pixels values > min_y contribute to awb measurement\n+ * @max_csum: Chrominance sum maximum value, only consider pixels with Cb+Cr,\n+ *\t smaller than threshold for awb measurements\n+ * @min_c: Chrominance minimum value, only consider pixels with Cb/Cr\n+ *\t each greater than threshold value for awb measurements\n+ * @frames: number of frames - 1 used for mean value calculation\n+ *\t (ucFrames=0 means 1 Frame)\n+ * @awb_ref_cr: reference Cr value for AWB regulation, target for AWB\n+ * @awb_ref_cb: reference Cb value for AWB regulation, target for AWB\n+ */\n+struct cifisp_awb_meas_config {\n+\t/*\n+\t * Note: currently the h and v offsets are mapped to grid offsets\n+\t */\n+\tstruct cifisp_window awb_wnd;\n+\t__u32 awb_mode;\n+\t__u8 max_y;\n+\t__u8 min_y;\n+\t__u8 max_csum;\n+\t__u8 min_c;\n+\t__u8 frames;\n+\t__u8 awb_ref_cr;\n+\t__u8 awb_ref_cb;\n+\t__u8 enable_ymax_cmp;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_awb_gain_config - Configuration used by auto white balance gain\n+ *\n+ * out_data_x = ( AWB_GEAIN_X * in_data + 128) >> 8\n+ */\n+struct cifisp_awb_gain_config {\n+\t__u16 gain_red;\n+\t__u16 gain_green_r;\n+\t__u16 gain_blue;\n+\t__u16 gain_green_b;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_flt_config - Configuration used by ISP filtering\n+ *\n+ * @mode: ISP_FILT_MODE register fields (from enum cifisp_flt_mode)\n+ * @grn_stage1: ISP_FILT_MODE register fields\n+ * @chr_h_mode: ISP_FILT_MODE register fields\n+ * @chr_v_mode: ISP_FILT_MODE register fields\n+ *\n+ * refer to REF_01 for details.\n+ */\n+\n+struct cifisp_flt_config {\n+\t__u32 mode;\n+\t__u8 grn_stage1;\n+\t__u8 chr_h_mode;\n+\t__u8 chr_v_mode;\n+\t__u32 thresh_bl0;\n+\t__u32 thresh_bl1;\n+\t__u32 thresh_sh0;\n+\t__u32 thresh_sh1;\n+\t__u32 lum_weight;\n+\t__u32 fac_sh1;\n+\t__u32 fac_sh0;\n+\t__u32 fac_mid;\n+\t__u32 fac_bl0;\n+\t__u32 fac_bl1;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_bdm_config - Configuration used by Bayer DeMosaic\n+ *\n+ * @demosaic_th: threshod for bayer demosaicing texture detection\n+ */\n+struct cifisp_bdm_config {\n+\t__u8 demosaic_th;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_ctk_config - Configuration used by Cross Talk correction\n+ *\n+ * @coeff: color correction matrix\n+ * @ct_offset_b: offset for the crosstalk correction matrix\n+ */\n+struct cifisp_ctk_config {\n+\t__u16 coeff0;\n+\t__u16 coeff1;\n+\t__u16 coeff2;\n+\t__u16 coeff3;\n+\t__u16 coeff4;\n+\t__u16 coeff5;\n+\t__u16 coeff6;\n+\t__u16 coeff7;\n+\t__u16 coeff8;\n+\t__u16 ct_offset_r;\n+\t__u16 ct_offset_g;\n+\t__u16 ct_offset_b;\n+} __attribute__ ((packed));\n+\n+enum cifisp_goc_mode {\n+\tCIFISP_GOC_MODE_LOGARITHMIC,\n+\tCIFISP_GOC_MODE_EQUIDISTANT\n+};\n+\n+/**\n+ * struct cifisp_goc_config - Configuration used by Gamma Out correction\n+ *\n+ * @mode: goc mode (from enum cifisp_goc_mode)\n+ * @gamma_y: gamma out curve y-axis for all color components\n+ */\n+struct cifisp_goc_config {\n+\t__u32 mode;\n+\t__u16 gamma_y[CIFISP_GAMMA_OUT_MAX_SAMPLES];\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_hst_config - Configuration used by Histogram\n+ *\n+ * @mode: histogram mode (from enum cifisp_histogram_mode)\n+ * @histogram_predivider: process every stepsize pixel, all other pixels are\n+ *\t\t\t skipped\n+ * @meas_window: coordinates of the measure window\n+ * @hist_weight: weighting factor for sub-windows\n+ */\n+struct cifisp_hst_config {\n+\t__u32 mode;\n+\t__u8 histogram_predivider;\n+\tstruct cifisp_window meas_window;\n+\t__u8 hist_weight[CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_aec_config - Configuration used by Auto Exposure Control\n+ *\n+ * @mode: Exposure measure mode (from enum cifisp_exp_meas_mode)\n+ * @autostop: stop mode (from enum cifisp_exp_ctrl_autostop)\n+ * @meas_window: coordinates of the measure window\n+ */\n+struct cifisp_aec_config {\n+\t__u32 mode;\n+\t__u32 autostop;\n+\tstruct cifisp_window meas_window;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_afc_config - Configuration used by Auto Focus Control\n+ *\n+ * @num_afm_win: max CIFISP_AFM_MAX_WINDOWS\n+ * @afm_win: coordinates of the meas window\n+ * @thres: threshold used for minimizing the influence of noise\n+ * @var_shift: the number of bits for the shift operation at the end of the\n+ *\t calculation chain.\n+ */\n+struct cifisp_afc_config {\n+\t__u8 num_afm_win;\n+\tstruct cifisp_window afm_win[CIFISP_AFM_MAX_WINDOWS];\n+\t__u32 thres;\n+\t__u32 var_shift;\n+} __attribute__ ((packed));\n+\n+/**\n+ * enum cifisp_dpf_gain_usage - dpf gain usage\n+ * @CIFISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage\n+ * @CIFISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from\n+ *\t\t\t\t registers DPF_NF_GAIN_R, ...\n+ * @CIFISP_DPF_GAIN_USAGE_LSC_GAINS: use only the gains from LSC module\n+ * @CIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the\n+ *\t\t\t\t\tgains from LSC module\n+ * @CIFISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module\n+ * @CIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module\n+ * @CIFISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation)\n+ */\n+enum cifisp_dpf_gain_usage {\n+\tCIFISP_DPF_GAIN_USAGE_DISABLED,\n+\tCIFISP_DPF_GAIN_USAGE_NF_GAINS,\n+\tCIFISP_DPF_GAIN_USAGE_LSC_GAINS,\n+\tCIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS,\n+\tCIFISP_DPF_GAIN_USAGE_AWB_GAINS,\n+\tCIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,\n+\tCIFISP_DPF_GAIN_USAGE_MAX\n+};\n+\n+/**\n+ * enum cifisp_dpf_gain_usage - dpf gain usage\n+ * @CIFISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9\n+ *\t\t\t\t (means 7x5 active pixel)\n+ * @CIFISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9\n+ *\t\t\t\t (means 5x5 active pixel)\n+ */\n+enum cifisp_dpf_rb_filtersize {\n+\tCIFISP_DPF_RB_FILTERSIZE_13x9,\n+\tCIFISP_DPF_RB_FILTERSIZE_9x9,\n+};\n+\n+/**\n+ * enum cifisp_dpf_nll_scale_mode - dpf noise level scale mode\n+ * @CIFISP_NLL_SCALE_LINEAR: use a linear scaling\n+ * @CIFISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling\n+ */\n+enum cifisp_dpf_nll_scale_mode {\n+\tCIFISP_NLL_SCALE_LINEAR,\n+\tCIFISP_NLL_SCALE_LOGARITHMIC,\n+};\n+\n+/**\n+ * struct cifisp_dpf_nll - Noise level lookup\n+ *\n+ * @coeff: Noise level Lookup coefficient\n+ * @scale_mode: dpf noise level scale mode (from enum cifisp_dpf_nll_scale_mode)\n+ */\n+struct cifisp_dpf_nll {\n+\t__u16 coeff[CIFISP_DPF_MAX_NLF_COEFFS];\n+\t__u32 scale_mode;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_dpf_rb_flt - Red blue filter config\n+ *\n+ * @fltsize: The filter size for the red and blue pixels\n+ *\t (from enum cifisp_dpf_rb_filtersize)\n+ * @spatial_coeff: Spatial weights\n+ * @r_enable: enable filter processing for red pixels\n+ * @b_enable: enable filter processing for blue pixels\n+ */\n+struct cifisp_dpf_rb_flt {\n+\t__u32 fltsize;\n+\t__u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];\n+\t__u8 r_enable;\n+\t__u8 b_enable;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_dpf_g_flt - Green filter Configuration\n+ *\n+ * @spatial_coeff: Spatial weights\n+ * @gr_enable: enable filter processing for green pixels in green/red lines\n+ * @gb_enable: enable filter processing for green pixels in green/blue lines\n+ */\n+struct cifisp_dpf_g_flt {\n+\t__u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];\n+\t__u8 gr_enable;\n+\t__u8 gb_enable;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_dpf_gain - Noise function Configuration\n+ *\n+ * @mode: dpf gain usage (from enum cifisp_dpf_gain_usage)\n+ * @nf_r_gain: Noise function Gain that replaces the AWB gain for red pixels\n+ * @nf_b_gain: Noise function Gain that replaces the AWB gain for blue pixels\n+ * @nf_gr_gain: Noise function Gain that replaces the AWB gain\n+ *\t\tfor green pixels in a red line\n+ * @nf_gb_gain: Noise function Gain that replaces the AWB gain\n+ *\t\tfor green pixels in a blue line\n+ */\n+struct cifisp_dpf_gain {\n+\t__u32 mode;\n+\t__u16 nf_r_gain;\n+\t__u16 nf_b_gain;\n+\t__u16 nf_gr_gain;\n+\t__u16 nf_gb_gain;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_dpf_config - Configuration used by De-noising pre-filter\n+ *\n+ * @gain: noise function gain\n+ * @g_flt: green filter config\n+ * @rb_flt: red blue filter config\n+ * @nll: noise level lookup\n+ */\n+struct cifisp_dpf_config {\n+\tstruct cifisp_dpf_gain gain;\n+\tstruct cifisp_dpf_g_flt g_flt;\n+\tstruct cifisp_dpf_rb_flt rb_flt;\n+\tstruct cifisp_dpf_nll nll;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_dpf_strength_config - strength of the filter\n+ *\n+ * @r: filter strength of the RED filter\n+ * @g: filter strength of the GREEN filter\n+ * @b: filter strength of the BLUE filter\n+ */\n+struct cifisp_dpf_strength_config {\n+\t__u8 r;\n+\t__u8 g;\n+\t__u8 b;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_isp_other_cfg - Parameters for some blocks in rockchip isp1\n+ *\n+ * @dpcc_config: Defect Pixel Cluster Correction config\n+ * @bls_config: Black Level Subtraction config\n+ * @sdg_config: sensor degamma config\n+ * @lsc_config: Lens Shade config\n+ * @awb_gain_config: Auto White balance gain config\n+ * @flt_config: filter config\n+ * @bdm_config: demosaic config\n+ * @ctk_config: cross talk config\n+ * @goc_config: gamma out config\n+ * @bls_config: black level subtraction config\n+ * @dpf_config: De-noising pre-filter config\n+ * @dpf_strength_config: dpf strength config\n+ * @cproc_config: color process config\n+ * @ie_config: image effects config\n+ */\n+struct cifisp_isp_other_cfg {\n+\tstruct cifisp_dpcc_config dpcc_config;\n+\tstruct cifisp_bls_config bls_config;\n+\tstruct cifisp_sdg_config sdg_config;\n+\tstruct cifisp_lsc_config lsc_config;\n+\tstruct cifisp_awb_gain_config awb_gain_config;\n+\tstruct cifisp_flt_config flt_config;\n+\tstruct cifisp_bdm_config bdm_config;\n+\tstruct cifisp_ctk_config ctk_config;\n+\tstruct cifisp_goc_config goc_config;\n+\tstruct cifisp_dpf_config dpf_config;\n+\tstruct cifisp_dpf_strength_config dpf_strength_config;\n+\tstruct cifisp_cproc_config cproc_config;\n+\tstruct cifisp_ie_config ie_config;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_isp_meas_cfg - Rockchip ISP1 Measure Parameters\n+ *\n+ * @awb_meas_config: auto white balance config\n+ * @hst_config: histogram config\n+ * @aec_config: auto exposure config\n+ * @afc_config: auto focus config\n+ */\n+struct cifisp_isp_meas_cfg {\n+\tstruct cifisp_awb_meas_config awb_meas_config;\n+\tstruct cifisp_hst_config hst_config;\n+\tstruct cifisp_aec_config aec_config;\n+\tstruct cifisp_afc_config afc_config;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct rkisp1_isp_params_cfg - Rockchip ISP1 Input Parameters Meta Data\n+ *\n+ * @module_en_update: mask the enable bits of which module should be updated\n+ * @module_ens: mask the enable value of each module, only update the module\n+ *\t\twhich correspond bit was set in module_en_update\n+ * @module_cfg_update: mask the config bits of which module should be updated\n+ * @meas: measurement config\n+ * @others: other config\n+ */\n+struct rkisp1_isp_params_cfg {\n+\t__u32 module_en_update;\n+\t__u32 module_ens;\n+\t__u32 module_cfg_update;\n+\n+\tstruct cifisp_isp_meas_cfg meas;\n+\tstruct cifisp_isp_other_cfg others;\n+} __attribute__ ((packed));\n+\n+/*---------- PART2: Measurement Statistics ------------*/\n+\n+/**\n+ * struct cifisp_bls_meas_val - AWB measured values\n+ *\n+ * @cnt: White pixel count, number of \"white pixels\" found during laster\n+ *\t measurement\n+ * @mean_y_or_g: Mean value of Y within window and frames,\n+ *\t\t Green if RGB is selected.\n+ * @mean_cb_or_b: Mean value of Cb within window and frames,\n+ *\t\t Blue if RGB is selected.\n+ * @mean_cr_or_r: Mean value of Cr within window and frames,\n+ *\t\t Red if RGB is selected.\n+ */\n+struct cifisp_awb_meas {\n+\t__u32 cnt;\n+\t__u8 mean_y_or_g;\n+\t__u8 mean_cb_or_b;\n+\t__u8 mean_cr_or_r;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_awb_stat - statistics automatic white balance data\n+ *\n+ * @awb_mean: Mean measured data\n+ */\n+struct cifisp_awb_stat {\n+\tstruct cifisp_awb_meas awb_mean[CIFISP_AWB_MAX_GRID];\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_bls_meas_val - BLS measured values\n+ *\n+ * @meas_r: Mean measured value for Bayer pattern R\n+ * @meas_gr: Mean measured value for Bayer pattern Gr\n+ * @meas_gb: Mean measured value for Bayer pattern Gb\n+ * @meas_b: Mean measured value for Bayer pattern B\n+ */\n+struct cifisp_bls_meas_val {\n+\t__u16 meas_r;\n+\t__u16 meas_gr;\n+\t__u16 meas_gb;\n+\t__u16 meas_b;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_ae_stat - statistics auto exposure data\n+ *\n+ * @exp_mean: Mean luminance value of block xx\n+ * @bls_val: BLS measured values\n+ *\n+ * Image is divided into 5x5 blocks.\n+ */\n+struct cifisp_ae_stat {\n+\t__u8 exp_mean[CIFISP_AE_MEAN_MAX];\n+\tstruct cifisp_bls_meas_val bls_val;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_af_meas_val - AF measured values\n+ *\n+ * @sum: sharpness, refer to REF_01 for definition\n+ * @lum: luminance, refer to REF_01 for definition\n+ */\n+struct cifisp_af_meas_val {\n+\t__u32 sum;\n+\t__u32 lum;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_af_stat - statistics auto focus data\n+ *\n+ * @window: AF measured value of window x\n+ *\n+ * The module measures the sharpness in 3 windows of selectable size via\n+ * register settings(ISP_AFM_*_A/B/C)\n+ */\n+struct cifisp_af_stat {\n+\tstruct cifisp_af_meas_val window[CIFISP_AFM_MAX_WINDOWS];\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct cifisp_hist_stat - statistics histogram data\n+ *\n+ * @hist_bins: measured bin counters\n+ *\n+ * Measurement window divided into 25 sub-windows, set\n+ * with ISP_HIST_XXX\n+ */\n+struct cifisp_hist_stat {\n+\t__u16 hist_bins[CIFISP_HIST_BIN_N_MAX];\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Data\n+ *\n+ * @cifisp_awb_stat: statistics data for automatic white balance\n+ * @cifisp_ae_stat: statistics data for auto exposure\n+ * @cifisp_af_stat: statistics data for auto focus\n+ * @cifisp_hist_stat: statistics histogram data\n+ */\n+struct cifisp_stat {\n+\tstruct cifisp_awb_stat awb;\n+\tstruct cifisp_ae_stat ae;\n+\tstruct cifisp_af_stat af;\n+\tstruct cifisp_hist_stat hist;\n+} __attribute__ ((packed));\n+\n+/**\n+ * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Meta Data\n+ *\n+ * @meas_type: measurement types (CIFISP_STAT_ definitions)\n+ * @frame_id: frame ID for sync\n+ * @params: statistics data\n+ */\n+struct rkisp1_stat_buffer {\n+\t__u32 meas_type;\n+\t__u32 frame_id;\n+\tstruct cifisp_stat params;\n+} __attribute__ ((packed));\n+\n+#endif /* _RKISP1_CONFIG_H */\ndiff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\nindex 5e739270116d3a21..94304bfeb4b6b9ed 100644\n--- a/include/linux/videodev2.h\n+++ b/include/linux/videodev2.h\n@@ -727,6 +727,10 @@ struct v4l2_pix_format {\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 \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+#define V4L2_META_FMT_RK_ISP1_STAT_3A\tv4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A statistics */\n+\n /* priv field value to indicates that subsequent fields are valid. */\n #define V4L2_PIX_FMT_PRIV_MAGIC\t\t0xfeedcafe\n \n", "prefixes": [ "libcamera-devel", "v3", "11/13" ] }