Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'next-media-rkisp1-20240814' of git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git

Extensible parameters support for the rkisp1 driver.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

+1689 -166
+9 -2
Documentation/admin-guide/media/rkisp1.rst
··· 114 114 to dynamically modify values such as black level, cross talk corrections 115 115 and others. 116 116 117 - The buffer format is defined by struct :c:type:`rkisp1_params_cfg`, and 118 - userspace should set 117 + The ISP driver supports two different parameters configuration methods, the 118 + `fixed parameters format` or the `extensible parameters format`. 119 + 120 + When using the `fixed parameters` method the buffer format is defined by struct 121 + :c:type:`rkisp1_params_cfg`, and userspace should set 119 122 :ref:`V4L2_META_FMT_RK_ISP1_PARAMS <v4l2-meta-fmt-rk-isp1-params>` as the 120 123 dataformat. 121 124 125 + When using the `extensible parameters` method the buffer format is defined by 126 + struct :c:type:`rkisp1_ext_params_cfg`, and userspace should set 127 + :ref:`V4L2_META_FMT_RK_ISP1_EXT_PARAMS <v4l2-meta-fmt-rk-isp1-ext-params>` as 128 + the dataformat. 122 129 123 130 Capturing Video Frames Example 124 131 ==============================
+48 -9
Documentation/userspace-api/media/v4l/metafmt-rkisp1.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0 2 2 3 - .. _v4l2-meta-fmt-rk-isp1-params: 4 - 5 3 .. _v4l2-meta-fmt-rk-isp1-stat-3a: 6 4 7 - ***************************************************************************** 8 - V4L2_META_FMT_RK_ISP1_PARAMS ('rk1p'), V4L2_META_FMT_RK_ISP1_STAT_3A ('rk1s') 9 - ***************************************************************************** 5 + ************************************************************************************************************************ 6 + V4L2_META_FMT_RK_ISP1_PARAMS ('rk1p'), V4L2_META_FMT_RK_ISP1_STAT_3A ('rk1s'), V4L2_META_FMT_RK_ISP1_EXT_PARAMS ('rk1e') 7 + ************************************************************************************************************************ 10 8 9 + ======================== 11 10 Configuration parameters 12 11 ======================== 13 12 14 - The configuration parameters are passed to the 13 + The configuration of the RkISP1 ISP is performed by userspace by providing 14 + parameters for the ISP to the driver using the :c:type:`v4l2_meta_format` 15 + interface. 16 + 17 + There are two methods that allow to configure the ISP, the `fixed parameters` 18 + configuration format and the `extensible parameters` configuration 19 + format. 20 + 21 + .. _v4l2-meta-fmt-rk-isp1-params: 22 + 23 + Fixed parameters configuration format 24 + ===================================== 25 + 26 + When using the fixed configuration format, parameters are passed to the 15 27 :ref:`rkisp1_params <rkisp1_params>` metadata output video node, using 16 - the :c:type:`v4l2_meta_format` interface. The buffer contains 17 - a single instance of the C structure :c:type:`rkisp1_params_cfg` defined in 18 - ``rkisp1-config.h``. So the structure can be obtained from the buffer by: 28 + the `V4L2_META_FMT_RK_ISP1_PARAMS` meta format. 29 + 30 + The buffer contains a single instance of the C structure 31 + :c:type:`rkisp1_params_cfg` defined in ``rkisp1-config.h``. So the structure can 32 + be obtained from the buffer by: 19 33 20 34 .. code-block:: c 21 35 22 36 struct rkisp1_params_cfg *params = (struct rkisp1_params_cfg*) buffer; 23 37 38 + This method supports a subset of the ISP features only, new applications should 39 + use the extensible parameters method. 40 + 41 + .. _v4l2-meta-fmt-rk-isp1-ext-params: 42 + 43 + Extensible parameters configuration format 44 + ========================================== 45 + 46 + When using the extensible configuration format, parameters are passed to the 47 + :ref:`rkisp1_params <rkisp1_params>` metadata output video node, using 48 + the `V4L2_META_FMT_RK_ISP1_EXT_PARAMS` meta format. 49 + 50 + The buffer contains a single instance of the C structure 51 + :c:type:`rkisp1_ext_params_cfg` defined in ``rkisp1-config.h``. The 52 + :c:type:`rkisp1_ext_params_cfg` structure is designed to allow userspace to 53 + populate the data buffer with only the configuration data for the ISP blocks it 54 + intends to configure. The extensible parameters format design allows developers 55 + to define new block types to support new configuration parameters, and defines a 56 + versioning scheme so that it can be extended and versioned without breaking 57 + compatibility with existing applications. 58 + 59 + For these reasons, this configuration method is preferred over the `fixed 60 + parameters` format alternative. 61 + 24 62 .. rkisp1_stat_buffer 25 63 64 + =========================== 26 65 3A and histogram statistics 27 66 =========================== 28 67
+14
drivers/media/platform/rockchip/rkisp1/rkisp1-common.c
··· 178 178 179 179 rkisp1_sd_adjust_crop_rect(crop, &crop_bounds); 180 180 } 181 + 182 + void rkisp1_bls_swap_regs(enum rkisp1_fmt_raw_pat_type pattern, 183 + const u32 input[4], u32 output[4]) 184 + { 185 + static const unsigned int swap[4][4] = { 186 + [RKISP1_RAW_RGGB] = { 0, 1, 2, 3 }, 187 + [RKISP1_RAW_GRBG] = { 1, 0, 3, 2 }, 188 + [RKISP1_RAW_GBRG] = { 2, 3, 0, 1 }, 189 + [RKISP1_RAW_BGGR] = { 3, 2, 1, 0 }, 190 + }; 191 + 192 + for (unsigned int i = 0; i < 4; ++i) 193 + output[i] = input[swap[pattern][i]]; 194 + }
+43 -6
drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
··· 33 33 #define RKISP1_ISP_SD_SRC BIT(0) 34 34 #define RKISP1_ISP_SD_SINK BIT(1) 35 35 36 - /* min and max values for the widths and heights of the entities */ 37 - #define RKISP1_ISP_MAX_WIDTH 4032 38 - #define RKISP1_ISP_MAX_HEIGHT 3024 36 + /* 37 + * Minimum values for the width and height of entities. The maximum values are 38 + * model-specific and stored in the rkisp1_info structure. 39 + */ 39 40 #define RKISP1_ISP_MIN_WIDTH 32 40 41 #define RKISP1_ISP_MIN_HEIGHT 32 41 42 ··· 116 115 * @RKISP1_FEATURE_SELF_PATH: The ISP has a self path 117 116 * @RKISP1_FEATURE_DUAL_CROP: The ISP has the dual crop block at the resizer input 118 117 * @RKISP1_FEATURE_DMA_34BIT: The ISP uses 34-bit DMA addresses 118 + * @RKISP1_FEATURE_BLS: The ISP has a dedicated BLS block 119 + * @RKISP1_FEATURE_COMPAND: The ISP has a companding block 119 120 * 120 121 * The ISP features are stored in a bitmask in &rkisp1_info.features and allow 121 122 * the driver to implement support for features present in some ISP versions ··· 129 126 RKISP1_FEATURE_SELF_PATH = BIT(2), 130 127 RKISP1_FEATURE_DUAL_CROP = BIT(3), 131 128 RKISP1_FEATURE_DMA_34BIT = BIT(4), 129 + RKISP1_FEATURE_BLS = BIT(5), 130 + RKISP1_FEATURE_COMPAND = BIT(6), 132 131 }; 133 132 134 133 #define rkisp1_has_feature(rkisp1, feature) \ ··· 145 140 * @isr_size: number of entries in the @isrs array 146 141 * @isp_ver: ISP version 147 142 * @features: bitmask of rkisp1_feature features implemented by the ISP 143 + * @max_width: maximum input frame width 144 + * @max_height: maximum input frame height 148 145 * 149 146 * This structure contains information about the ISP specific to a particular 150 147 * ISP model, version, or integration in a particular SoC. ··· 158 151 unsigned int isr_size; 159 152 enum rkisp1_cif_isp_version isp_ver; 160 153 unsigned int features; 154 + unsigned int max_width; 155 + unsigned int max_height; 161 156 }; 162 157 163 158 /* ··· 241 232 242 233 /* 243 234 * struct rkisp1_buffer - A container for the vb2 buffers used by the video devices: 244 - * params, stats, mainpath, selfpath 235 + * stats, mainpath, selfpath 245 236 * 246 237 * @vb: vb2 buffer 247 238 * @queue: entry of the buffer in the queue ··· 252 243 struct list_head queue; 253 244 dma_addr_t buff_addr[VIDEO_MAX_PLANES]; 254 245 }; 246 + 247 + /* 248 + * struct rkisp1_params_buffer - A container for the vb2 buffers used by the 249 + * params video device 250 + * 251 + * @vb: vb2 buffer 252 + * @queue: entry of the buffer in the queue 253 + * @cfg: scratch buffer used for caching the ISP configuration parameters 254 + */ 255 + struct rkisp1_params_buffer { 256 + struct vb2_v4l2_buffer vb; 257 + struct list_head queue; 258 + void *cfg; 259 + }; 260 + 261 + static inline struct rkisp1_params_buffer * 262 + to_rkisp1_params_buffer(struct vb2_v4l2_buffer *vbuf) 263 + { 264 + return container_of(vbuf, struct rkisp1_params_buffer, vb); 265 + } 255 266 256 267 /* 257 268 * struct rkisp1_dummy_buffer - A buffer to write the next frame to in case ··· 401 372 * @ops: pointer to the variant-specific operations 402 373 * @config_lock: locks the buffer list 'params' 403 374 * @params: queue of rkisp1_buffer 404 - * @vdev_fmt: v4l2_format of the metadata format 375 + * @metafmt the currently enabled metadata format 405 376 * @quantization: the quantization configured on the isp's src pad 377 + * @ycbcr_encoding the YCbCr encoding 406 378 * @raw_type: the bayer pattern on the isp video sink pad 379 + * @enabled_blocks: bitmask of enabled ISP blocks 407 380 */ 408 381 struct rkisp1_params { 409 382 struct rkisp1_vdev_node vnode; ··· 414 383 415 384 spinlock_t config_lock; /* locks the buffers list 'params' */ 416 385 struct list_head params; 417 - struct v4l2_format vdev_fmt; 386 + 387 + const struct v4l2_meta_format *metafmt; 418 388 419 389 enum v4l2_quantization quantization; 420 390 enum v4l2_ycbcr_encoding ycbcr_encoding; 421 391 enum rkisp1_fmt_raw_pat_type raw_type; 392 + 393 + u32 enabled_blocks; 422 394 }; 423 395 424 396 /* ··· 606 572 */ 607 573 void rkisp1_sd_adjust_crop(struct v4l2_rect *crop, 608 574 const struct v4l2_mbus_framefmt *bounds); 575 + 576 + void rkisp1_bls_swap_regs(enum rkisp1_fmt_raw_pat_type pattern, 577 + const u32 input[4], u32 output[4]); 609 578 610 579 /* 611 580 * rkisp1_mbus_info_get_by_code - get the isp info of the media bus code
+3 -2
drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c
··· 307 307 struct v4l2_subdev_state *sd_state, 308 308 struct v4l2_subdev_format *fmt) 309 309 { 310 + struct rkisp1_csi *csi = to_rkisp1_csi(sd); 310 311 const struct rkisp1_mbus_info *mbus_info; 311 312 struct v4l2_mbus_framefmt *sink_fmt, *src_fmt; 312 313 ··· 327 326 328 327 sink_fmt->width = clamp_t(u32, fmt->format.width, 329 328 RKISP1_ISP_MIN_WIDTH, 330 - RKISP1_ISP_MAX_WIDTH); 329 + csi->rkisp1->info->max_width); 331 330 sink_fmt->height = clamp_t(u32, fmt->format.height, 332 331 RKISP1_ISP_MIN_HEIGHT, 333 - RKISP1_ISP_MAX_HEIGHT); 332 + csi->rkisp1->info->max_height); 334 333 335 334 fmt->format = *sink_fmt; 336 335
+12 -3
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
··· 509 509 .isp_ver = RKISP1_V12, 510 510 .features = RKISP1_FEATURE_MIPI_CSI2 511 511 | RKISP1_FEATURE_SELF_PATH 512 - | RKISP1_FEATURE_DUAL_CROP, 512 + | RKISP1_FEATURE_DUAL_CROP 513 + | RKISP1_FEATURE_BLS, 514 + .max_width = 3264, 515 + .max_height = 2448, 513 516 }; 514 517 515 518 static const char * const rk3399_isp_clks[] = { ··· 533 530 .isp_ver = RKISP1_V10, 534 531 .features = RKISP1_FEATURE_MIPI_CSI2 535 532 | RKISP1_FEATURE_SELF_PATH 536 - | RKISP1_FEATURE_DUAL_CROP, 533 + | RKISP1_FEATURE_DUAL_CROP 534 + | RKISP1_FEATURE_BLS, 535 + .max_width = 4416, 536 + .max_height = 3312, 537 537 }; 538 538 539 539 static const char * const imx8mp_isp_clks[] = { ··· 556 550 .isr_size = ARRAY_SIZE(imx8mp_isp_isrs), 557 551 .isp_ver = RKISP1_V_IMX8MP, 558 552 .features = RKISP1_FEATURE_MAIN_STRIDE 559 - | RKISP1_FEATURE_DMA_34BIT, 553 + | RKISP1_FEATURE_DMA_34BIT 554 + | RKISP1_FEATURE_COMPAND, 555 + .max_width = 4096, 556 + .max_height = 3072, 560 557 }; 561 558 562 559 static const struct of_device_id rkisp1_of_match[] = {
+5 -4
drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
··· 517 517 struct v4l2_subdev_state *sd_state, 518 518 struct v4l2_subdev_frame_size_enum *fse) 519 519 { 520 + struct rkisp1_isp *isp = to_rkisp1_isp(sd); 520 521 const struct rkisp1_mbus_info *mbus_info; 521 522 522 523 if (fse->pad == RKISP1_ISP_PAD_SINK_PARAMS || ··· 540 539 return -EINVAL; 541 540 542 541 fse->min_width = RKISP1_ISP_MIN_WIDTH; 543 - fse->max_width = RKISP1_ISP_MAX_WIDTH; 542 + fse->max_width = isp->rkisp1->info->max_width; 544 543 fse->min_height = RKISP1_ISP_MIN_HEIGHT; 545 - fse->max_height = RKISP1_ISP_MAX_HEIGHT; 544 + fse->max_height = isp->rkisp1->info->max_height; 546 545 547 546 return 0; 548 547 } ··· 773 772 774 773 sink_fmt->width = clamp_t(u32, format->width, 775 774 RKISP1_ISP_MIN_WIDTH, 776 - RKISP1_ISP_MAX_WIDTH); 775 + isp->rkisp1->info->max_width); 777 776 sink_fmt->height = clamp_t(u32, format->height, 778 777 RKISP1_ISP_MIN_HEIGHT, 779 - RKISP1_ISP_MAX_HEIGHT); 778 + isp->rkisp1->info->max_height); 780 779 781 780 /* 782 781 * Adjust the color space fields. Accept any color primaries and
+936 -101
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
··· 5 5 * Copyright (C) 2017 Rockchip Electronics Co., Ltd. 6 6 */ 7 7 8 + #include <linux/math.h> 9 + #include <linux/string.h> 10 + 8 11 #include <media/v4l2-common.h> 9 12 #include <media/v4l2-event.h> 10 13 #include <media/v4l2-ioctl.h> ··· 35 32 (RKISP1_CIF_ISP_DPCC_RG_FAC_1 + 0x14 * (n)) 36 33 #define RKISP1_ISP_CC_COEFF(n) \ 37 34 (RKISP1_CIF_ISP_CC_COEFF_0 + (n) * 4) 35 + 36 + #define RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS BIT(0) 37 + #define RKISP1_EXT_PARAMS_BLOCK_GROUP_LSC BIT(1) 38 + 39 + union rkisp1_ext_params_config { 40 + struct rkisp1_ext_params_block_header header; 41 + struct rkisp1_ext_params_bls_config bls; 42 + struct rkisp1_ext_params_dpcc_config dpcc; 43 + struct rkisp1_ext_params_sdg_config sdg; 44 + struct rkisp1_ext_params_lsc_config lsc; 45 + struct rkisp1_ext_params_awb_gain_config awbg; 46 + struct rkisp1_ext_params_flt_config flt; 47 + struct rkisp1_ext_params_bdm_config bdm; 48 + struct rkisp1_ext_params_ctk_config ctk; 49 + struct rkisp1_ext_params_goc_config goc; 50 + struct rkisp1_ext_params_dpf_config dpf; 51 + struct rkisp1_ext_params_dpf_strength_config dpfs; 52 + struct rkisp1_ext_params_cproc_config cproc; 53 + struct rkisp1_ext_params_ie_config ie; 54 + struct rkisp1_ext_params_awb_meas_config awbm; 55 + struct rkisp1_ext_params_hst_config hst; 56 + struct rkisp1_ext_params_aec_config aec; 57 + struct rkisp1_ext_params_afc_config afc; 58 + struct rkisp1_ext_params_compand_bls_config compand_bls; 59 + struct rkisp1_ext_params_compand_curve_config compand_curve; 60 + }; 61 + 62 + enum rkisp1_params_formats { 63 + RKISP1_PARAMS_FIXED, 64 + RKISP1_PARAMS_EXTENSIBLE, 65 + }; 66 + 67 + static const struct v4l2_meta_format rkisp1_params_formats[] = { 68 + [RKISP1_PARAMS_FIXED] = { 69 + .dataformat = V4L2_META_FMT_RK_ISP1_PARAMS, 70 + .buffersize = sizeof(struct rkisp1_params_cfg), 71 + }, 72 + [RKISP1_PARAMS_EXTENSIBLE] = { 73 + .dataformat = V4L2_META_FMT_RK_ISP1_EXT_PARAMS, 74 + .buffersize = sizeof(struct rkisp1_ext_params_cfg), 75 + }, 76 + }; 77 + 78 + static const struct v4l2_meta_format * 79 + rkisp1_params_get_format_info(u32 dataformat) 80 + { 81 + for (unsigned int i = 0; i < ARRAY_SIZE(rkisp1_params_formats); i++) { 82 + if (rkisp1_params_formats[i].dataformat == dataformat) 83 + return &rkisp1_params_formats[i]; 84 + } 85 + 86 + return &rkisp1_params_formats[RKISP1_PARAMS_FIXED]; 87 + } 38 88 39 89 static inline void 40 90 rkisp1_param_set_bits(struct rkisp1_params *params, u32 reg, u32 bit_mask) ··· 168 112 new_control &= RKISP1_CIF_ISP_BLS_ENA; 169 113 /* fixed subtraction values */ 170 114 if (!arg->enable_auto) { 171 - const struct rkisp1_cif_isp_bls_fixed_val *pval = 172 - &arg->fixed_val; 115 + static const u32 regs[] = { 116 + RKISP1_CIF_ISP_BLS_A_FIXED, 117 + RKISP1_CIF_ISP_BLS_B_FIXED, 118 + RKISP1_CIF_ISP_BLS_C_FIXED, 119 + RKISP1_CIF_ISP_BLS_D_FIXED, 120 + }; 121 + u32 swapped[4]; 173 122 174 - switch (params->raw_type) { 175 - case RKISP1_RAW_BGGR: 176 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_D_FIXED, 177 - pval->r); 178 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_C_FIXED, 179 - pval->gr); 180 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_B_FIXED, 181 - pval->gb); 182 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_A_FIXED, 183 - pval->b); 184 - break; 185 - case RKISP1_RAW_GBRG: 186 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_C_FIXED, 187 - pval->r); 188 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_D_FIXED, 189 - pval->gr); 190 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_A_FIXED, 191 - pval->gb); 192 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_B_FIXED, 193 - pval->b); 194 - break; 195 - case RKISP1_RAW_GRBG: 196 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_B_FIXED, 197 - pval->r); 198 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_A_FIXED, 199 - pval->gr); 200 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_D_FIXED, 201 - pval->gb); 202 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_C_FIXED, 203 - pval->b); 204 - break; 205 - case RKISP1_RAW_RGGB: 206 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_A_FIXED, 207 - pval->r); 208 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_B_FIXED, 209 - pval->gr); 210 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_C_FIXED, 211 - pval->gb); 212 - rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_D_FIXED, 213 - pval->b); 214 - break; 215 - default: 216 - break; 217 - } 123 + rkisp1_bls_swap_regs(params->raw_type, regs, swapped); 218 124 125 + rkisp1_write(params->rkisp1, swapped[0], arg->fixed_val.r); 126 + rkisp1_write(params->rkisp1, swapped[1], arg->fixed_val.gr); 127 + rkisp1_write(params->rkisp1, swapped[2], arg->fixed_val.gb); 128 + rkisp1_write(params->rkisp1, swapped[3], arg->fixed_val.b); 219 129 } else { 220 130 if (arg->en_windows & BIT(1)) { 221 131 rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_BLS_H2_START, ··· 1261 1239 rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_DPF_STRENGTH_R, arg->r); 1262 1240 } 1263 1241 1242 + static void rkisp1_compand_write_px_curve(struct rkisp1_params *params, 1243 + unsigned int addr, const u8 *curve) 1244 + { 1245 + const unsigned int points_per_reg = 6; 1246 + const unsigned int num_regs = 1247 + DIV_ROUND_UP(RKISP1_CIF_ISP_COMPAND_NUM_POINTS, 1248 + points_per_reg); 1249 + 1250 + /* 1251 + * The compand curve is specified as a piecewise linear function with 1252 + * 64 points. X coordinates are stored as a log2 of the displacement 1253 + * from the previous point, in 5 bits, with 6 values per register. The 1254 + * last register stores 4 values. 1255 + */ 1256 + for (unsigned int reg = 0; reg < num_regs; ++reg) { 1257 + unsigned int num_points = 1258 + min(RKISP1_CIF_ISP_COMPAND_NUM_POINTS - 1259 + reg * points_per_reg, points_per_reg); 1260 + u32 val = 0; 1261 + 1262 + for (unsigned int i = 0; i < num_points; i++) 1263 + val |= (*curve++ & 0x1f) << (i * 5); 1264 + 1265 + rkisp1_write(params->rkisp1, addr, val); 1266 + addr += 4; 1267 + } 1268 + } 1269 + 1270 + static void 1271 + rkisp1_compand_write_curve_mem(struct rkisp1_params *params, 1272 + unsigned int reg_addr, unsigned int reg_data, 1273 + const u32 curve[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]) 1274 + { 1275 + for (unsigned int i = 0; i < RKISP1_CIF_ISP_COMPAND_NUM_POINTS; i++) { 1276 + rkisp1_write(params->rkisp1, reg_addr, i); 1277 + rkisp1_write(params->rkisp1, reg_data, curve[i]); 1278 + } 1279 + } 1280 + 1281 + static void 1282 + rkisp1_compand_bls_config(struct rkisp1_params *params, 1283 + const struct rkisp1_cif_isp_compand_bls_config *arg) 1284 + { 1285 + static const u32 regs[] = { 1286 + RKISP1_CIF_ISP_COMPAND_BLS_A_FIXED, 1287 + RKISP1_CIF_ISP_COMPAND_BLS_B_FIXED, 1288 + RKISP1_CIF_ISP_COMPAND_BLS_C_FIXED, 1289 + RKISP1_CIF_ISP_COMPAND_BLS_D_FIXED, 1290 + }; 1291 + u32 swapped[4]; 1292 + 1293 + rkisp1_bls_swap_regs(params->raw_type, regs, swapped); 1294 + 1295 + rkisp1_write(params->rkisp1, swapped[0], arg->r); 1296 + rkisp1_write(params->rkisp1, swapped[1], arg->gr); 1297 + rkisp1_write(params->rkisp1, swapped[2], arg->gb); 1298 + rkisp1_write(params->rkisp1, swapped[3], arg->b); 1299 + } 1300 + 1301 + static void 1302 + rkisp1_compand_expand_config(struct rkisp1_params *params, 1303 + const struct rkisp1_cif_isp_compand_curve_config *arg) 1304 + { 1305 + rkisp1_compand_write_px_curve(params, RKISP1_CIF_ISP_COMPAND_EXPAND_PX_N(0), 1306 + arg->px); 1307 + rkisp1_compand_write_curve_mem(params, RKISP1_CIF_ISP_COMPAND_EXPAND_Y_ADDR, 1308 + RKISP1_CIF_ISP_COMPAND_EXPAND_Y_WRITE_DATA, 1309 + arg->y); 1310 + rkisp1_compand_write_curve_mem(params, RKISP1_CIF_ISP_COMPAND_EXPAND_X_ADDR, 1311 + RKISP1_CIF_ISP_COMPAND_EXPAND_X_WRITE_DATA, 1312 + arg->x); 1313 + } 1314 + 1315 + static void 1316 + rkisp1_compand_compress_config(struct rkisp1_params *params, 1317 + const struct rkisp1_cif_isp_compand_curve_config *arg) 1318 + { 1319 + rkisp1_compand_write_px_curve(params, RKISP1_CIF_ISP_COMPAND_COMPRESS_PX_N(0), 1320 + arg->px); 1321 + rkisp1_compand_write_curve_mem(params, RKISP1_CIF_ISP_COMPAND_COMPRESS_Y_ADDR, 1322 + RKISP1_CIF_ISP_COMPAND_COMPRESS_Y_WRITE_DATA, 1323 + arg->y); 1324 + rkisp1_compand_write_curve_mem(params, RKISP1_CIF_ISP_COMPAND_COMPRESS_X_ADDR, 1325 + RKISP1_CIF_ISP_COMPAND_COMPRESS_X_WRITE_DATA, 1326 + arg->x); 1327 + } 1328 + 1264 1329 static void 1265 1330 rkisp1_isp_isr_other_config(struct rkisp1_params *params, 1266 1331 const struct rkisp1_params_cfg *new_params) ··· 1357 1248 module_en_update = new_params->module_en_update; 1358 1249 module_cfg_update = new_params->module_cfg_update; 1359 1250 module_ens = new_params->module_ens; 1251 + 1252 + if (!rkisp1_has_feature(params->rkisp1, BLS)) { 1253 + module_en_update &= ~RKISP1_CIF_ISP_MODULE_BLS; 1254 + module_cfg_update &= ~RKISP1_CIF_ISP_MODULE_BLS; 1255 + module_ens &= ~RKISP1_CIF_ISP_MODULE_BLS; 1256 + } 1360 1257 1361 1258 /* update dpc config */ 1362 1259 if (module_cfg_update & RKISP1_CIF_ISP_MODULE_DPCC) ··· 1616 1501 } 1617 1502 } 1618 1503 1619 - static bool rkisp1_params_get_buffer(struct rkisp1_params *params, 1620 - struct rkisp1_buffer **buf, 1621 - struct rkisp1_params_cfg **cfg) 1504 + /*------------------------------------------------------------------------------ 1505 + * Extensible parameters format handling 1506 + */ 1507 + 1508 + static void 1509 + rkisp1_ext_params_bls(struct rkisp1_params *params, 1510 + const union rkisp1_ext_params_config *block) 1622 1511 { 1623 - if (list_empty(&params->params)) 1624 - return false; 1512 + const struct rkisp1_ext_params_bls_config *bls = &block->bls; 1625 1513 1626 - *buf = list_first_entry(&params->params, struct rkisp1_buffer, queue); 1627 - *cfg = vb2_plane_vaddr(&(*buf)->vb.vb2_buf, 0); 1514 + if (bls->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1515 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_BLS_CTRL, 1516 + RKISP1_CIF_ISP_BLS_ENA); 1517 + return; 1518 + } 1628 1519 1629 - return true; 1520 + rkisp1_bls_config(params, &bls->config); 1521 + 1522 + if ((bls->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1523 + !(params->enabled_blocks & BIT(bls->header.type))) 1524 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_BLS_CTRL, 1525 + RKISP1_CIF_ISP_BLS_ENA); 1526 + } 1527 + 1528 + static void 1529 + rkisp1_ext_params_dpcc(struct rkisp1_params *params, 1530 + const union rkisp1_ext_params_config *block) 1531 + { 1532 + const struct rkisp1_ext_params_dpcc_config *dpcc = &block->dpcc; 1533 + 1534 + if (dpcc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1535 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_DPCC_MODE, 1536 + RKISP1_CIF_ISP_DPCC_MODE_DPCC_ENABLE); 1537 + return; 1538 + } 1539 + 1540 + rkisp1_dpcc_config(params, &dpcc->config); 1541 + 1542 + if ((dpcc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1543 + !(params->enabled_blocks & BIT(dpcc->header.type))) 1544 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_DPCC_MODE, 1545 + RKISP1_CIF_ISP_DPCC_MODE_DPCC_ENABLE); 1546 + } 1547 + 1548 + static void 1549 + rkisp1_ext_params_sdg(struct rkisp1_params *params, 1550 + const union rkisp1_ext_params_config *block) 1551 + { 1552 + const struct rkisp1_ext_params_sdg_config *sdg = &block->sdg; 1553 + 1554 + if (sdg->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1555 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_CTRL, 1556 + RKISP1_CIF_ISP_CTRL_ISP_GAMMA_IN_ENA); 1557 + return; 1558 + } 1559 + 1560 + rkisp1_sdg_config(params, &sdg->config); 1561 + 1562 + if ((sdg->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1563 + !(params->enabled_blocks & BIT(sdg->header.type))) 1564 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL, 1565 + RKISP1_CIF_ISP_CTRL_ISP_GAMMA_IN_ENA); 1566 + } 1567 + 1568 + static void 1569 + rkisp1_ext_params_lsc(struct rkisp1_params *params, 1570 + const union rkisp1_ext_params_config *block) 1571 + { 1572 + const struct rkisp1_ext_params_lsc_config *lsc = &block->lsc; 1573 + 1574 + if (lsc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1575 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_LSC_CTRL, 1576 + RKISP1_CIF_ISP_LSC_CTRL_ENA); 1577 + return; 1578 + } 1579 + 1580 + rkisp1_lsc_config(params, &lsc->config); 1581 + 1582 + if ((lsc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1583 + !(params->enabled_blocks & BIT(lsc->header.type))) 1584 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_LSC_CTRL, 1585 + RKISP1_CIF_ISP_LSC_CTRL_ENA); 1586 + } 1587 + 1588 + static void 1589 + rkisp1_ext_params_awbg(struct rkisp1_params *params, 1590 + const union rkisp1_ext_params_config *block) 1591 + { 1592 + const struct rkisp1_ext_params_awb_gain_config *awbg = &block->awbg; 1593 + 1594 + if (awbg->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1595 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_CTRL, 1596 + RKISP1_CIF_ISP_CTRL_ISP_AWB_ENA); 1597 + return; 1598 + } 1599 + 1600 + params->ops->awb_gain_config(params, &awbg->config); 1601 + 1602 + if ((awbg->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1603 + !(params->enabled_blocks & BIT(awbg->header.type))) 1604 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL, 1605 + RKISP1_CIF_ISP_CTRL_ISP_AWB_ENA); 1606 + } 1607 + 1608 + static void 1609 + rkisp1_ext_params_flt(struct rkisp1_params *params, 1610 + const union rkisp1_ext_params_config *block) 1611 + { 1612 + const struct rkisp1_ext_params_flt_config *flt = &block->flt; 1613 + 1614 + if (flt->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1615 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_FILT_MODE, 1616 + RKISP1_CIF_ISP_FLT_ENA); 1617 + return; 1618 + } 1619 + 1620 + rkisp1_flt_config(params, &flt->config); 1621 + 1622 + if ((flt->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1623 + !(params->enabled_blocks & BIT(flt->header.type))) 1624 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_FILT_MODE, 1625 + RKISP1_CIF_ISP_FLT_ENA); 1626 + } 1627 + 1628 + static void 1629 + rkisp1_ext_params_bdm(struct rkisp1_params *params, 1630 + const union rkisp1_ext_params_config *block) 1631 + { 1632 + const struct rkisp1_ext_params_bdm_config *bdm = &block->bdm; 1633 + 1634 + if (bdm->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1635 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_DEMOSAIC, 1636 + RKISP1_CIF_ISP_DEMOSAIC_BYPASS); 1637 + return; 1638 + } 1639 + 1640 + rkisp1_bdm_config(params, &bdm->config); 1641 + 1642 + if ((bdm->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1643 + !(params->enabled_blocks & BIT(bdm->header.type))) 1644 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_DEMOSAIC, 1645 + RKISP1_CIF_ISP_DEMOSAIC_BYPASS); 1646 + } 1647 + 1648 + static void 1649 + rkisp1_ext_params_ctk(struct rkisp1_params *params, 1650 + const union rkisp1_ext_params_config *block) 1651 + { 1652 + const struct rkisp1_ext_params_ctk_config *ctk = &block->ctk; 1653 + 1654 + if (ctk->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1655 + rkisp1_ctk_enable(params, false); 1656 + return; 1657 + } 1658 + 1659 + rkisp1_ctk_config(params, &ctk->config); 1660 + 1661 + if ((ctk->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1662 + !(params->enabled_blocks & BIT(ctk->header.type))) 1663 + rkisp1_ctk_enable(params, true); 1664 + } 1665 + 1666 + static void 1667 + rkisp1_ext_params_goc(struct rkisp1_params *params, 1668 + const union rkisp1_ext_params_config *block) 1669 + { 1670 + const struct rkisp1_ext_params_goc_config *goc = &block->goc; 1671 + 1672 + if (goc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1673 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_CTRL, 1674 + RKISP1_CIF_ISP_CTRL_ISP_GAMMA_OUT_ENA); 1675 + return; 1676 + } 1677 + 1678 + params->ops->goc_config(params, &goc->config); 1679 + 1680 + /* 1681 + * Unconditionally re-enable the GOC module which gets disabled by 1682 + * goc_config(). 1683 + */ 1684 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL, 1685 + RKISP1_CIF_ISP_CTRL_ISP_GAMMA_OUT_ENA); 1686 + } 1687 + 1688 + static void 1689 + rkisp1_ext_params_dpf(struct rkisp1_params *params, 1690 + const union rkisp1_ext_params_config *block) 1691 + { 1692 + const struct rkisp1_ext_params_dpf_config *dpf = &block->dpf; 1693 + 1694 + if (dpf->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1695 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_DPF_MODE, 1696 + RKISP1_CIF_ISP_DPF_MODE_EN); 1697 + return; 1698 + } 1699 + 1700 + rkisp1_dpf_config(params, &dpf->config); 1701 + 1702 + if ((dpf->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1703 + !(params->enabled_blocks & BIT(dpf->header.type))) 1704 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_DPF_MODE, 1705 + RKISP1_CIF_ISP_DPF_MODE_EN); 1706 + } 1707 + 1708 + static void 1709 + rkisp1_ext_params_dpfs(struct rkisp1_params *params, 1710 + const union rkisp1_ext_params_config *block) 1711 + { 1712 + const struct rkisp1_ext_params_dpf_strength_config *dpfs = &block->dpfs; 1713 + 1714 + rkisp1_dpf_strength_config(params, &dpfs->config); 1715 + } 1716 + 1717 + static void 1718 + rkisp1_ext_params_cproc(struct rkisp1_params *params, 1719 + const union rkisp1_ext_params_config *block) 1720 + { 1721 + const struct rkisp1_ext_params_cproc_config *cproc = &block->cproc; 1722 + 1723 + if (cproc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1724 + rkisp1_param_clear_bits(params, RKISP1_CIF_C_PROC_CTRL, 1725 + RKISP1_CIF_C_PROC_CTR_ENABLE); 1726 + return; 1727 + } 1728 + 1729 + rkisp1_cproc_config(params, &cproc->config); 1730 + 1731 + if ((cproc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1732 + !(params->enabled_blocks & BIT(cproc->header.type))) 1733 + rkisp1_param_set_bits(params, RKISP1_CIF_C_PROC_CTRL, 1734 + RKISP1_CIF_C_PROC_CTR_ENABLE); 1735 + } 1736 + 1737 + static void 1738 + rkisp1_ext_params_ie(struct rkisp1_params *params, 1739 + const union rkisp1_ext_params_config *block) 1740 + { 1741 + const struct rkisp1_ext_params_ie_config *ie = &block->ie; 1742 + 1743 + if (ie->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1744 + rkisp1_ie_enable(params, false); 1745 + return; 1746 + } 1747 + 1748 + rkisp1_ie_config(params, &ie->config); 1749 + 1750 + if ((ie->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1751 + !(params->enabled_blocks & BIT(ie->header.type))) 1752 + rkisp1_ie_enable(params, true); 1753 + } 1754 + 1755 + static void 1756 + rkisp1_ext_params_awbm(struct rkisp1_params *params, 1757 + const union rkisp1_ext_params_config *block) 1758 + { 1759 + const struct rkisp1_ext_params_awb_meas_config *awbm = &block->awbm; 1760 + 1761 + if (awbm->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1762 + params->ops->awb_meas_enable(params, &awbm->config, 1763 + false); 1764 + return; 1765 + } 1766 + 1767 + params->ops->awb_meas_config(params, &awbm->config); 1768 + 1769 + if ((awbm->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1770 + !(params->enabled_blocks & BIT(awbm->header.type))) 1771 + params->ops->awb_meas_enable(params, &awbm->config, 1772 + true); 1773 + } 1774 + 1775 + static void 1776 + rkisp1_ext_params_hstm(struct rkisp1_params *params, 1777 + const union rkisp1_ext_params_config *block) 1778 + { 1779 + const struct rkisp1_ext_params_hst_config *hst = &block->hst; 1780 + 1781 + if (hst->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1782 + params->ops->hst_enable(params, &hst->config, false); 1783 + return; 1784 + } 1785 + 1786 + params->ops->hst_config(params, &hst->config); 1787 + 1788 + if ((hst->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1789 + !(params->enabled_blocks & BIT(hst->header.type))) 1790 + params->ops->hst_enable(params, &hst->config, true); 1791 + } 1792 + 1793 + static void 1794 + rkisp1_ext_params_aecm(struct rkisp1_params *params, 1795 + const union rkisp1_ext_params_config *block) 1796 + { 1797 + const struct rkisp1_ext_params_aec_config *aec = &block->aec; 1798 + 1799 + if (aec->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1800 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_EXP_CTRL, 1801 + RKISP1_CIF_ISP_EXP_ENA); 1802 + return; 1803 + } 1804 + 1805 + params->ops->aec_config(params, &aec->config); 1806 + 1807 + if ((aec->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1808 + !(params->enabled_blocks & BIT(aec->header.type))) 1809 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_EXP_CTRL, 1810 + RKISP1_CIF_ISP_EXP_ENA); 1811 + } 1812 + 1813 + static void 1814 + rkisp1_ext_params_afcm(struct rkisp1_params *params, 1815 + const union rkisp1_ext_params_config *block) 1816 + { 1817 + const struct rkisp1_ext_params_afc_config *afc = &block->afc; 1818 + 1819 + if (afc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1820 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_AFM_CTRL, 1821 + RKISP1_CIF_ISP_AFM_ENA); 1822 + return; 1823 + } 1824 + 1825 + params->ops->afm_config(params, &afc->config); 1826 + 1827 + if ((afc->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1828 + !(params->enabled_blocks & BIT(afc->header.type))) 1829 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_AFM_CTRL, 1830 + RKISP1_CIF_ISP_AFM_ENA); 1831 + } 1832 + 1833 + static void rkisp1_ext_params_compand_bls(struct rkisp1_params *params, 1834 + const union rkisp1_ext_params_config *block) 1835 + { 1836 + const struct rkisp1_ext_params_compand_bls_config *bls = 1837 + &block->compand_bls; 1838 + 1839 + if (bls->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1840 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_COMPAND_CTRL, 1841 + RKISP1_CIF_ISP_COMPAND_CTRL_BLS_ENABLE); 1842 + return; 1843 + } 1844 + 1845 + rkisp1_compand_bls_config(params, &bls->config); 1846 + 1847 + if ((bls->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1848 + !(params->enabled_blocks & BIT(bls->header.type))) 1849 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_COMPAND_CTRL, 1850 + RKISP1_CIF_ISP_COMPAND_CTRL_BLS_ENABLE); 1851 + } 1852 + 1853 + static void rkisp1_ext_params_compand_expand(struct rkisp1_params *params, 1854 + const union rkisp1_ext_params_config *block) 1855 + { 1856 + const struct rkisp1_ext_params_compand_curve_config *curve = 1857 + &block->compand_curve; 1858 + 1859 + if (curve->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1860 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_COMPAND_CTRL, 1861 + RKISP1_CIF_ISP_COMPAND_CTRL_EXPAND_ENABLE); 1862 + return; 1863 + } 1864 + 1865 + rkisp1_compand_expand_config(params, &curve->config); 1866 + 1867 + if ((curve->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1868 + !(params->enabled_blocks & BIT(curve->header.type))) 1869 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_COMPAND_CTRL, 1870 + RKISP1_CIF_ISP_COMPAND_CTRL_EXPAND_ENABLE); 1871 + } 1872 + 1873 + static void rkisp1_ext_params_compand_compress(struct rkisp1_params *params, 1874 + const union rkisp1_ext_params_config *block) 1875 + { 1876 + const struct rkisp1_ext_params_compand_curve_config *curve = 1877 + &block->compand_curve; 1878 + 1879 + if (curve->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) { 1880 + rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_COMPAND_CTRL, 1881 + RKISP1_CIF_ISP_COMPAND_CTRL_COMPRESS_ENABLE); 1882 + return; 1883 + } 1884 + 1885 + rkisp1_compand_compress_config(params, &curve->config); 1886 + 1887 + if ((curve->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) && 1888 + !(params->enabled_blocks & BIT(curve->header.type))) 1889 + rkisp1_param_set_bits(params, RKISP1_CIF_ISP_COMPAND_CTRL, 1890 + RKISP1_CIF_ISP_COMPAND_CTRL_COMPRESS_ENABLE); 1891 + } 1892 + 1893 + typedef void (*rkisp1_block_handler)(struct rkisp1_params *params, 1894 + const union rkisp1_ext_params_config *config); 1895 + 1896 + static const struct rkisp1_ext_params_handler { 1897 + size_t size; 1898 + rkisp1_block_handler handler; 1899 + unsigned int group; 1900 + unsigned int features; 1901 + } rkisp1_ext_params_handlers[] = { 1902 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS] = { 1903 + .size = sizeof(struct rkisp1_ext_params_bls_config), 1904 + .handler = rkisp1_ext_params_bls, 1905 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1906 + .features = RKISP1_FEATURE_BLS, 1907 + }, 1908 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC] = { 1909 + .size = sizeof(struct rkisp1_ext_params_dpcc_config), 1910 + .handler = rkisp1_ext_params_dpcc, 1911 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1912 + }, 1913 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG] = { 1914 + .size = sizeof(struct rkisp1_ext_params_sdg_config), 1915 + .handler = rkisp1_ext_params_sdg, 1916 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1917 + }, 1918 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN] = { 1919 + .size = sizeof(struct rkisp1_ext_params_awb_gain_config), 1920 + .handler = rkisp1_ext_params_awbg, 1921 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1922 + }, 1923 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT] = { 1924 + .size = sizeof(struct rkisp1_ext_params_flt_config), 1925 + .handler = rkisp1_ext_params_flt, 1926 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1927 + }, 1928 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM] = { 1929 + .size = sizeof(struct rkisp1_ext_params_bdm_config), 1930 + .handler = rkisp1_ext_params_bdm, 1931 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1932 + }, 1933 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK] = { 1934 + .size = sizeof(struct rkisp1_ext_params_ctk_config), 1935 + .handler = rkisp1_ext_params_ctk, 1936 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1937 + }, 1938 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC] = { 1939 + .size = sizeof(struct rkisp1_ext_params_goc_config), 1940 + .handler = rkisp1_ext_params_goc, 1941 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1942 + }, 1943 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF] = { 1944 + .size = sizeof(struct rkisp1_ext_params_dpf_config), 1945 + .handler = rkisp1_ext_params_dpf, 1946 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1947 + }, 1948 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH] = { 1949 + .size = sizeof(struct rkisp1_ext_params_dpf_strength_config), 1950 + .handler = rkisp1_ext_params_dpfs, 1951 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1952 + }, 1953 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC] = { 1954 + .size = sizeof(struct rkisp1_ext_params_cproc_config), 1955 + .handler = rkisp1_ext_params_cproc, 1956 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1957 + }, 1958 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_IE] = { 1959 + .size = sizeof(struct rkisp1_ext_params_ie_config), 1960 + .handler = rkisp1_ext_params_ie, 1961 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1962 + }, 1963 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC] = { 1964 + .size = sizeof(struct rkisp1_ext_params_lsc_config), 1965 + .handler = rkisp1_ext_params_lsc, 1966 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_LSC, 1967 + }, 1968 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS] = { 1969 + .size = sizeof(struct rkisp1_ext_params_awb_meas_config), 1970 + .handler = rkisp1_ext_params_awbm, 1971 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1972 + }, 1973 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS] = { 1974 + .size = sizeof(struct rkisp1_ext_params_hst_config), 1975 + .handler = rkisp1_ext_params_hstm, 1976 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1977 + }, 1978 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS] = { 1979 + .size = sizeof(struct rkisp1_ext_params_aec_config), 1980 + .handler = rkisp1_ext_params_aecm, 1981 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1982 + }, 1983 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS] = { 1984 + .size = sizeof(struct rkisp1_ext_params_afc_config), 1985 + .handler = rkisp1_ext_params_afcm, 1986 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1987 + }, 1988 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS] = { 1989 + .size = sizeof(struct rkisp1_ext_params_compand_bls_config), 1990 + .handler = rkisp1_ext_params_compand_bls, 1991 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1992 + .features = RKISP1_FEATURE_COMPAND, 1993 + }, 1994 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND] = { 1995 + .size = sizeof(struct rkisp1_ext_params_compand_curve_config), 1996 + .handler = rkisp1_ext_params_compand_expand, 1997 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 1998 + .features = RKISP1_FEATURE_COMPAND, 1999 + }, 2000 + [RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS] = { 2001 + .size = sizeof(struct rkisp1_ext_params_compand_curve_config), 2002 + .handler = rkisp1_ext_params_compand_compress, 2003 + .group = RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS, 2004 + .features = RKISP1_FEATURE_COMPAND, 2005 + }, 2006 + }; 2007 + 2008 + static void rkisp1_ext_params_config(struct rkisp1_params *params, 2009 + struct rkisp1_ext_params_cfg *cfg, 2010 + u32 block_group_mask) 2011 + { 2012 + size_t block_offset = 0; 2013 + 2014 + if (WARN_ON(!cfg)) 2015 + return; 2016 + 2017 + /* Walk the list of parameter blocks and process them. */ 2018 + while (block_offset < cfg->data_size) { 2019 + const struct rkisp1_ext_params_handler *block_handler; 2020 + const union rkisp1_ext_params_config *block; 2021 + 2022 + block = (const union rkisp1_ext_params_config *) 2023 + &cfg->data[block_offset]; 2024 + block_offset += block->header.size; 2025 + 2026 + /* 2027 + * Make sure the block is supported by the platform and in the 2028 + * list of groups to configure. 2029 + */ 2030 + block_handler = &rkisp1_ext_params_handlers[block->header.type]; 2031 + if (!(block_handler->group & block_group_mask)) 2032 + continue; 2033 + 2034 + if ((params->rkisp1->info->features & block_handler->features) != 2035 + block_handler->features) 2036 + continue; 2037 + 2038 + block_handler->handler(params, block); 2039 + 2040 + if (block->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE) 2041 + params->enabled_blocks &= ~BIT(block->header.type); 2042 + else if (block->header.flags & RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE) 2043 + params->enabled_blocks |= BIT(block->header.type); 2044 + } 1630 2045 } 1631 2046 1632 2047 static void rkisp1_params_complete_buffer(struct rkisp1_params *params, 1633 - struct rkisp1_buffer *buf, 2048 + struct rkisp1_params_buffer *buf, 1634 2049 unsigned int frame_sequence) 1635 2050 { 1636 2051 list_del(&buf->queue); ··· 2172 1527 void rkisp1_params_isr(struct rkisp1_device *rkisp1) 2173 1528 { 2174 1529 struct rkisp1_params *params = &rkisp1->params; 2175 - struct rkisp1_params_cfg *new_params; 2176 - struct rkisp1_buffer *cur_buf; 1530 + struct rkisp1_params_buffer *cur_buf; 2177 1531 2178 1532 spin_lock(&params->config_lock); 2179 1533 2180 - if (!rkisp1_params_get_buffer(params, &cur_buf, &new_params)) 1534 + cur_buf = list_first_entry_or_null(&params->params, 1535 + struct rkisp1_params_buffer, queue); 1536 + if (!cur_buf) 2181 1537 goto unlock; 2182 1538 2183 - rkisp1_isp_isr_other_config(params, new_params); 2184 - rkisp1_isp_isr_lsc_config(params, new_params); 2185 - rkisp1_isp_isr_meas_config(params, new_params); 1539 + if (params->metafmt->dataformat == V4L2_META_FMT_RK_ISP1_PARAMS) { 1540 + rkisp1_isp_isr_other_config(params, cur_buf->cfg); 1541 + rkisp1_isp_isr_lsc_config(params, cur_buf->cfg); 1542 + rkisp1_isp_isr_meas_config(params, cur_buf->cfg); 1543 + } else { 1544 + rkisp1_ext_params_config(params, cur_buf->cfg, 1545 + RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS | 1546 + RKISP1_EXT_PARAMS_BLOCK_GROUP_LSC); 1547 + } 2186 1548 2187 1549 /* update shadow register immediately */ 2188 1550 rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL, ··· 2255 1603 enum v4l2_ycbcr_encoding ycbcr_encoding) 2256 1604 { 2257 1605 struct rkisp1_cif_isp_hst_config hst = rkisp1_hst_params_default_config; 2258 - struct rkisp1_params_cfg *new_params; 2259 - struct rkisp1_buffer *cur_buf; 1606 + struct rkisp1_params_buffer *cur_buf; 2260 1607 2261 1608 params->quantization = quantization; 2262 1609 params->ycbcr_encoding = ycbcr_encoding; ··· 2284 1633 2285 1634 /* apply the first buffer if there is one already */ 2286 1635 2287 - if (!rkisp1_params_get_buffer(params, &cur_buf, &new_params)) 1636 + cur_buf = list_first_entry_or_null(&params->params, 1637 + struct rkisp1_params_buffer, queue); 1638 + if (!cur_buf) 2288 1639 goto unlock; 2289 1640 2290 - rkisp1_isp_isr_other_config(params, new_params); 2291 - rkisp1_isp_isr_meas_config(params, new_params); 1641 + if (params->metafmt->dataformat == V4L2_META_FMT_RK_ISP1_PARAMS) { 1642 + rkisp1_isp_isr_other_config(params, cur_buf->cfg); 1643 + rkisp1_isp_isr_meas_config(params, cur_buf->cfg); 1644 + } else { 1645 + rkisp1_ext_params_config(params, cur_buf->cfg, 1646 + RKISP1_EXT_PARAMS_BLOCK_GROUP_OTHERS); 1647 + } 2292 1648 2293 1649 /* update shadow register immediately */ 2294 1650 rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL, ··· 2307 1649 2308 1650 void rkisp1_params_post_configure(struct rkisp1_params *params) 2309 1651 { 2310 - struct rkisp1_params_cfg *new_params; 2311 - struct rkisp1_buffer *cur_buf; 1652 + struct rkisp1_params_buffer *cur_buf; 2312 1653 2313 1654 spin_lock_irq(&params->config_lock); 2314 1655 ··· 2319 1662 * ordering doesn't affect other ISP versions negatively, do so 2320 1663 * unconditionally. 2321 1664 */ 2322 - 2323 - if (!rkisp1_params_get_buffer(params, &cur_buf, &new_params)) 1665 + cur_buf = list_first_entry_or_null(&params->params, 1666 + struct rkisp1_params_buffer, queue); 1667 + if (!cur_buf) 2324 1668 goto unlock; 2325 1669 2326 - rkisp1_isp_isr_lsc_config(params, new_params); 1670 + if (params->metafmt->dataformat == V4L2_META_FMT_RK_ISP1_PARAMS) 1671 + rkisp1_isp_isr_lsc_config(params, cur_buf->cfg); 1672 + else 1673 + rkisp1_ext_params_config(params, cur_buf->cfg, 1674 + RKISP1_EXT_PARAMS_BLOCK_GROUP_LSC); 2327 1675 2328 1676 /* update shadow register immediately */ 2329 1677 rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL, ··· 2404 1742 struct v4l2_fmtdesc *f) 2405 1743 { 2406 1744 struct video_device *video = video_devdata(file); 2407 - struct rkisp1_params *params = video_get_drvdata(video); 2408 1745 2409 - if (f->index > 0 || f->type != video->queue->type) 1746 + if (f->index >= ARRAY_SIZE(rkisp1_params_formats) || 1747 + f->type != video->queue->type) 2410 1748 return -EINVAL; 2411 1749 2412 - f->pixelformat = params->vdev_fmt.fmt.meta.dataformat; 1750 + f->pixelformat = rkisp1_params_formats[f->index].dataformat; 2413 1751 2414 1752 return 0; 2415 1753 } ··· 2424 1762 if (f->type != video->queue->type) 2425 1763 return -EINVAL; 2426 1764 2427 - memset(meta, 0, sizeof(*meta)); 2428 - meta->dataformat = params->vdev_fmt.fmt.meta.dataformat; 2429 - meta->buffersize = params->vdev_fmt.fmt.meta.buffersize; 1765 + *meta = *params->metafmt; 1766 + 1767 + return 0; 1768 + } 1769 + 1770 + static int rkisp1_params_try_fmt_meta_out(struct file *file, void *fh, 1771 + struct v4l2_format *f) 1772 + { 1773 + struct video_device *video = video_devdata(file); 1774 + struct v4l2_meta_format *meta = &f->fmt.meta; 1775 + 1776 + if (f->type != video->queue->type) 1777 + return -EINVAL; 1778 + 1779 + *meta = *rkisp1_params_get_format_info(meta->dataformat); 1780 + 1781 + return 0; 1782 + } 1783 + 1784 + static int rkisp1_params_s_fmt_meta_out(struct file *file, void *fh, 1785 + struct v4l2_format *f) 1786 + { 1787 + struct video_device *video = video_devdata(file); 1788 + struct rkisp1_params *params = video_get_drvdata(video); 1789 + struct v4l2_meta_format *meta = &f->fmt.meta; 1790 + 1791 + if (f->type != video->queue->type) 1792 + return -EINVAL; 1793 + 1794 + if (vb2_is_busy(video->queue)) 1795 + return -EBUSY; 1796 + 1797 + params->metafmt = rkisp1_params_get_format_info(meta->dataformat); 1798 + *meta = *params->metafmt; 2430 1799 2431 1800 return 0; 2432 1801 } ··· 2487 1794 .vidioc_streamoff = vb2_ioctl_streamoff, 2488 1795 .vidioc_enum_fmt_meta_out = rkisp1_params_enum_fmt_meta_out, 2489 1796 .vidioc_g_fmt_meta_out = rkisp1_params_g_fmt_meta_out, 2490 - .vidioc_s_fmt_meta_out = rkisp1_params_g_fmt_meta_out, 2491 - .vidioc_try_fmt_meta_out = rkisp1_params_g_fmt_meta_out, 1797 + .vidioc_s_fmt_meta_out = rkisp1_params_s_fmt_meta_out, 1798 + .vidioc_try_fmt_meta_out = rkisp1_params_try_fmt_meta_out, 2492 1799 .vidioc_querycap = rkisp1_params_querycap, 2493 1800 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, 2494 1801 .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ··· 2500 1807 unsigned int sizes[], 2501 1808 struct device *alloc_devs[]) 2502 1809 { 1810 + struct rkisp1_params *params = vq->drv_priv; 1811 + 2503 1812 *num_buffers = clamp_t(u32, *num_buffers, 2504 1813 RKISP1_ISP_PARAMS_REQ_BUFS_MIN, 2505 1814 RKISP1_ISP_PARAMS_REQ_BUFS_MAX); 2506 1815 2507 1816 *num_planes = 1; 2508 1817 2509 - sizes[0] = sizeof(struct rkisp1_params_cfg); 1818 + sizes[0] = params->metafmt->buffersize; 2510 1819 2511 1820 return 0; 1821 + } 1822 + 1823 + static int rkisp1_params_vb2_buf_init(struct vb2_buffer *vb) 1824 + { 1825 + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); 1826 + struct rkisp1_params_buffer *params_buf = to_rkisp1_params_buffer(vbuf); 1827 + struct rkisp1_params *params = vb->vb2_queue->drv_priv; 1828 + 1829 + params_buf->cfg = kvmalloc(params->metafmt->buffersize, 1830 + GFP_KERNEL); 1831 + if (!params_buf->cfg) 1832 + return -ENOMEM; 1833 + 1834 + return 0; 1835 + } 1836 + 1837 + static void rkisp1_params_vb2_buf_cleanup(struct vb2_buffer *vb) 1838 + { 1839 + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); 1840 + struct rkisp1_params_buffer *params_buf = to_rkisp1_params_buffer(vbuf); 1841 + 1842 + kvfree(params_buf->cfg); 1843 + params_buf->cfg = NULL; 2512 1844 } 2513 1845 2514 1846 static void rkisp1_params_vb2_buf_queue(struct vb2_buffer *vb) 2515 1847 { 2516 1848 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); 2517 - struct rkisp1_buffer *params_buf = 2518 - container_of(vbuf, struct rkisp1_buffer, vb); 1849 + struct rkisp1_params_buffer *params_buf = to_rkisp1_params_buffer(vbuf); 2519 1850 struct vb2_queue *vq = vb->vb2_queue; 2520 1851 struct rkisp1_params *params = vq->drv_priv; 2521 1852 ··· 2548 1831 spin_unlock_irq(&params->config_lock); 2549 1832 } 2550 1833 1834 + static int rkisp1_params_prepare_ext_params(struct rkisp1_params *params, 1835 + struct vb2_buffer *vb) 1836 + { 1837 + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); 1838 + struct rkisp1_params_buffer *params_buf = to_rkisp1_params_buffer(vbuf); 1839 + size_t header_size = offsetof(struct rkisp1_ext_params_cfg, data); 1840 + struct rkisp1_ext_params_cfg *cfg = params_buf->cfg; 1841 + size_t payload_size = vb2_get_plane_payload(vb, 0); 1842 + struct rkisp1_ext_params_cfg *usr_cfg = 1843 + vb2_plane_vaddr(&vbuf->vb2_buf, 0); 1844 + size_t block_offset = 0; 1845 + size_t cfg_size; 1846 + 1847 + /* 1848 + * Validate the buffer payload size before copying the parameters. The 1849 + * payload has to be smaller than the destination buffer size and larger 1850 + * than the header size. 1851 + */ 1852 + if (payload_size > params->metafmt->buffersize) { 1853 + dev_dbg(params->rkisp1->dev, 1854 + "Too large buffer payload size %zu\n", payload_size); 1855 + return -EINVAL; 1856 + } 1857 + 1858 + if (payload_size < header_size) { 1859 + dev_dbg(params->rkisp1->dev, 1860 + "Buffer payload %zu smaller than header size %zu\n", 1861 + payload_size, header_size); 1862 + return -EINVAL; 1863 + } 1864 + 1865 + /* 1866 + * Copy the parameters buffer to the internal scratch buffer to avoid 1867 + * userspace modifying the buffer content while the driver processes it. 1868 + */ 1869 + memcpy(cfg, usr_cfg, payload_size); 1870 + 1871 + /* Only v1 is supported at the moment. */ 1872 + if (cfg->version != RKISP1_EXT_PARAM_BUFFER_V1) { 1873 + dev_dbg(params->rkisp1->dev, 1874 + "Unsupported extensible format version: %u\n", 1875 + cfg->version); 1876 + return -EINVAL; 1877 + } 1878 + 1879 + /* Validate the size reported in the parameters buffer header. */ 1880 + cfg_size = header_size + cfg->data_size; 1881 + if (cfg_size != payload_size) { 1882 + dev_dbg(params->rkisp1->dev, 1883 + "Data size %zu different than buffer payload size %zu\n", 1884 + cfg_size, payload_size); 1885 + return -EINVAL; 1886 + } 1887 + 1888 + /* Walk the list of parameter blocks and validate them. */ 1889 + cfg_size = cfg->data_size; 1890 + while (cfg_size >= sizeof(struct rkisp1_ext_params_block_header)) { 1891 + const struct rkisp1_ext_params_block_header *block; 1892 + const struct rkisp1_ext_params_handler *handler; 1893 + 1894 + block = (const struct rkisp1_ext_params_block_header *) 1895 + &cfg->data[block_offset]; 1896 + 1897 + if (block->type >= ARRAY_SIZE(rkisp1_ext_params_handlers)) { 1898 + dev_dbg(params->rkisp1->dev, 1899 + "Invalid parameters block type\n"); 1900 + return -EINVAL; 1901 + } 1902 + 1903 + if (block->size > cfg_size) { 1904 + dev_dbg(params->rkisp1->dev, 1905 + "Premature end of parameters data\n"); 1906 + return -EINVAL; 1907 + } 1908 + 1909 + if ((block->flags & (RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE | 1910 + RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE)) == 1911 + (RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE | 1912 + RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE)) { 1913 + dev_dbg(params->rkisp1->dev, 1914 + "Invalid parameters block flags\n"); 1915 + return -EINVAL; 1916 + } 1917 + 1918 + handler = &rkisp1_ext_params_handlers[block->type]; 1919 + if (block->size != handler->size) { 1920 + dev_dbg(params->rkisp1->dev, 1921 + "Invalid parameters block size\n"); 1922 + return -EINVAL; 1923 + } 1924 + 1925 + block_offset += block->size; 1926 + cfg_size -= block->size; 1927 + } 1928 + 1929 + if (cfg_size) { 1930 + dev_dbg(params->rkisp1->dev, 1931 + "Unexpected data after the parameters buffer end\n"); 1932 + return -EINVAL; 1933 + } 1934 + 1935 + return 0; 1936 + } 1937 + 2551 1938 static int rkisp1_params_vb2_buf_prepare(struct vb2_buffer *vb) 2552 1939 { 2553 - if (vb2_plane_size(vb, 0) < sizeof(struct rkisp1_params_cfg)) 1940 + struct rkisp1_params *params = vb->vb2_queue->drv_priv; 1941 + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); 1942 + struct rkisp1_params_buffer *params_buf = to_rkisp1_params_buffer(vbuf); 1943 + struct rkisp1_params_cfg *cfg = vb2_plane_vaddr(&vbuf->vb2_buf, 0); 1944 + size_t payload = vb2_get_plane_payload(vb, 0); 1945 + 1946 + if (params->metafmt->dataformat == V4L2_META_FMT_RK_ISP1_EXT_PARAMS) 1947 + return rkisp1_params_prepare_ext_params(params, vb); 1948 + 1949 + /* 1950 + * For the fixed parameters format the payload size must be exactly the 1951 + * size of the parameters structure. 1952 + */ 1953 + if (payload != sizeof(*cfg)) 2554 1954 return -EINVAL; 2555 1955 2556 - vb2_set_plane_payload(vb, 0, sizeof(struct rkisp1_params_cfg)); 1956 + /* 1957 + * Copy the parameters buffer to the internal scratch buffer to avoid 1958 + * userspace modifying the buffer content while the driver processes it. 1959 + */ 1960 + memcpy(params_buf->cfg, cfg, payload); 2557 1961 2558 1962 return 0; 2559 1963 } ··· 2682 1844 static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq) 2683 1845 { 2684 1846 struct rkisp1_params *params = vq->drv_priv; 2685 - struct rkisp1_buffer *buf; 1847 + struct rkisp1_params_buffer *buf; 2686 1848 LIST_HEAD(tmp_list); 2687 1849 2688 1850 /* ··· 2696 1858 2697 1859 list_for_each_entry(buf, &tmp_list, queue) 2698 1860 vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); 1861 + 1862 + params->enabled_blocks = 0; 2699 1863 } 2700 1864 2701 1865 static const struct vb2_ops rkisp1_params_vb2_ops = { 2702 1866 .queue_setup = rkisp1_params_vb2_queue_setup, 1867 + .buf_init = rkisp1_params_vb2_buf_init, 1868 + .buf_cleanup = rkisp1_params_vb2_buf_cleanup, 2703 1869 .wait_prepare = vb2_ops_wait_prepare, 2704 1870 .wait_finish = vb2_ops_wait_finish, 2705 1871 .buf_queue = rkisp1_params_vb2_buf_queue, 2706 1872 .buf_prepare = rkisp1_params_vb2_buf_prepare, 2707 1873 .stop_streaming = rkisp1_params_vb2_stop_streaming, 2708 - 2709 1874 }; 2710 1875 2711 1876 static const struct v4l2_file_operations rkisp1_params_fops = { ··· 2731 1890 q->drv_priv = params; 2732 1891 q->ops = &rkisp1_params_vb2_ops; 2733 1892 q->mem_ops = &vb2_vmalloc_memops; 2734 - q->buf_struct_size = sizeof(struct rkisp1_buffer); 1893 + q->buf_struct_size = sizeof(struct rkisp1_params_buffer); 2735 1894 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 2736 1895 q->lock = &node->vlock; 2737 1896 2738 1897 return vb2_queue_init(q); 2739 - } 2740 - 2741 - static void rkisp1_init_params(struct rkisp1_params *params) 2742 - { 2743 - params->vdev_fmt.fmt.meta.dataformat = 2744 - V4L2_META_FMT_RK_ISP1_PARAMS; 2745 - params->vdev_fmt.fmt.meta.buffersize = 2746 - sizeof(struct rkisp1_params_cfg); 2747 - 2748 - if (params->rkisp1->info->isp_ver == RKISP1_V12) 2749 - params->ops = &rkisp1_v12_params_ops; 2750 - else 2751 - params->ops = &rkisp1_v10_params_ops; 2752 1898 } 2753 1899 2754 1900 int rkisp1_params_register(struct rkisp1_device *rkisp1) ··· 2766 1938 vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_META_OUTPUT; 2767 1939 vdev->vfl_dir = VFL_DIR_TX; 2768 1940 rkisp1_params_init_vb2_queue(vdev->queue, params); 2769 - rkisp1_init_params(params); 1941 + 1942 + params->metafmt = &rkisp1_params_formats[RKISP1_PARAMS_FIXED]; 1943 + 1944 + if (params->rkisp1->info->isp_ver == RKISP1_V12) 1945 + params->ops = &rkisp1_v12_params_ops; 1946 + else 1947 + params->ops = &rkisp1_v10_params_ops; 1948 + 2770 1949 video_set_drvdata(vdev, params); 2771 1950 2772 1951 node->pad.flags = MEDIA_PAD_FL_SOURCE;
+23
drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
··· 704 704 #define RKISP1_CIF_ISP_DPF_SPATIAL_COEFF_MAX 0x1f 705 705 #define RKISP1_CIF_ISP_DPF_NLL_COEFF_N_MAX 0x3ff 706 706 707 + /* COMPAND */ 708 + #define RKISP1_CIF_ISP_COMPAND_CTRL_EXPAND_ENABLE BIT(0) 709 + #define RKISP1_CIF_ISP_COMPAND_CTRL_COMPRESS_ENABLE BIT(1) 710 + #define RKISP1_CIF_ISP_COMPAND_CTRL_SOFT_RESET_FLAG BIT(2) 711 + #define RKISP1_CIF_ISP_COMPAND_CTRL_BLS_ENABLE BIT(3) 712 + 707 713 /* =================================================================== */ 708 714 /* CIF Registers */ 709 715 /* =================================================================== */ ··· 1399 1393 #define RKISP1_CIF_ISP_VSM_V_SEGMENTS (RKISP1_CIF_ISP_VSM_BASE + 0x00000018) 1400 1394 #define RKISP1_CIF_ISP_VSM_DELTA_H (RKISP1_CIF_ISP_VSM_BASE + 0x0000001c) 1401 1395 #define RKISP1_CIF_ISP_VSM_DELTA_V (RKISP1_CIF_ISP_VSM_BASE + 0x00000020) 1396 + 1397 + #define RKISP1_CIF_ISP_COMPAND_BASE 0x00003200 1398 + #define RKISP1_CIF_ISP_COMPAND_CTRL (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000000) 1399 + #define RKISP1_CIF_ISP_COMPAND_BLS_A_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000004) 1400 + #define RKISP1_CIF_ISP_COMPAND_BLS_B_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000008) 1401 + #define RKISP1_CIF_ISP_COMPAND_BLS_C_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x0000000c) 1402 + #define RKISP1_CIF_ISP_COMPAND_BLS_D_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000010) 1403 + #define RKISP1_CIF_ISP_COMPAND_EXPAND_PX_N(n) (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000014 + (n) * 4) 1404 + #define RKISP1_CIF_ISP_COMPAND_COMPRESS_PX_N(n) (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000040 + (n) * 4) 1405 + #define RKISP1_CIF_ISP_COMPAND_EXPAND_Y_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x0000006c) 1406 + #define RKISP1_CIF_ISP_COMPAND_EXPAND_Y_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000070) 1407 + #define RKISP1_CIF_ISP_COMPAND_COMPRESS_Y_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000074) 1408 + #define RKISP1_CIF_ISP_COMPAND_COMPRESS_Y_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000078) 1409 + #define RKISP1_CIF_ISP_COMPAND_EXPAND_X_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x0000007c) 1410 + #define RKISP1_CIF_ISP_COMPAND_EXPAND_X_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000080) 1411 + #define RKISP1_CIF_ISP_COMPAND_COMPRESS_X_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000084) 1412 + #define RKISP1_CIF_ISP_COMPAND_COMPRESS_X_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000088) 1402 1413 1403 1414 #define RKISP1_CIF_ISP_CSI0_BASE 0x00007000 1404 1415 #define RKISP1_CIF_ISP_CSI0_CTRL0 (RKISP1_CIF_ISP_CSI0_BASE + 0x00000000)
+2 -2
drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
··· 494 494 495 495 sink_fmt->width = clamp_t(u32, format->width, 496 496 RKISP1_ISP_MIN_WIDTH, 497 - RKISP1_ISP_MAX_WIDTH); 497 + rsz->rkisp1->info->max_width); 498 498 sink_fmt->height = clamp_t(u32, format->height, 499 499 RKISP1_ISP_MIN_HEIGHT, 500 - RKISP1_ISP_MAX_HEIGHT); 500 + rsz->rkisp1->info->max_height); 501 501 502 502 /* 503 503 * Adjust the color space fields. Accept any color primaries and
+14 -37
drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
··· 304 304 static void rkisp1_stats_get_bls_meas(struct rkisp1_stats *stats, 305 305 struct rkisp1_stat_buffer *pbuf) 306 306 { 307 + static const u32 regs[] = { 308 + RKISP1_CIF_ISP_BLS_A_MEASURED, 309 + RKISP1_CIF_ISP_BLS_B_MEASURED, 310 + RKISP1_CIF_ISP_BLS_C_MEASURED, 311 + RKISP1_CIF_ISP_BLS_D_MEASURED, 312 + }; 307 313 struct rkisp1_device *rkisp1 = stats->rkisp1; 308 314 const struct rkisp1_mbus_info *in_fmt = rkisp1->isp.sink_fmt; 309 315 struct rkisp1_cif_isp_bls_meas_val *bls_val; 316 + u32 swapped[4]; 317 + 318 + rkisp1_bls_swap_regs(in_fmt->bayer_pat, regs, swapped); 310 319 311 320 bls_val = &pbuf->params.ae.bls_val; 312 - if (in_fmt->bayer_pat == RKISP1_RAW_BGGR) { 313 - bls_val->meas_b = 314 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED); 315 - bls_val->meas_gb = 316 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED); 317 - bls_val->meas_gr = 318 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED); 319 - bls_val->meas_r = 320 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED); 321 - } else if (in_fmt->bayer_pat == RKISP1_RAW_GBRG) { 322 - bls_val->meas_gb = 323 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED); 324 - bls_val->meas_b = 325 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED); 326 - bls_val->meas_r = 327 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED); 328 - bls_val->meas_gr = 329 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED); 330 - } else if (in_fmt->bayer_pat == RKISP1_RAW_GRBG) { 331 - bls_val->meas_gr = 332 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED); 333 - bls_val->meas_r = 334 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED); 335 - bls_val->meas_b = 336 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED); 337 - bls_val->meas_gb = 338 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED); 339 - } else if (in_fmt->bayer_pat == RKISP1_RAW_RGGB) { 340 - bls_val->meas_r = 341 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED); 342 - bls_val->meas_gr = 343 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED); 344 - bls_val->meas_gb = 345 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED); 346 - bls_val->meas_b = 347 - rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED); 348 - } 321 + 322 + bls_val->meas_r = rkisp1_read(rkisp1, swapped[0]); 323 + bls_val->meas_gr = rkisp1_read(rkisp1, swapped[1]); 324 + bls_val->meas_gb = rkisp1_read(rkisp1, swapped[2]); 325 + bls_val->meas_b = rkisp1_read(rkisp1, swapped[3]); 349 326 } 350 327 351 328 static const struct rkisp1_stats_ops rkisp1_v10_stats_ops = {
+1
drivers/media/v4l2-core/v4l2-ioctl.c
··· 1458 1458 case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break; 1459 1459 case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break; 1460 1460 case V4L2_META_FMT_RK_ISP1_STAT_3A: descr = "Rockchip ISP1 3A Statistics"; break; 1461 + case V4L2_META_FMT_RK_ISP1_EXT_PARAMS: descr = "Rockchip ISP1 Ext 3A Params"; break; 1461 1462 case V4L2_PIX_FMT_NV12_8L128: descr = "NV12 (8x128 Linear)"; break; 1462 1463 case V4L2_PIX_FMT_NV12M_8L128: descr = "NV12M (8x128 Linear)"; break; 1463 1464 case V4L2_PIX_FMT_NV12_10BE_8L128: descr = "10-bit NV12 (8x128 Linear, BE)"; break;
+578
include/uapi/linux/rkisp1-config.h
··· 165 165 #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6 166 166 167 167 /* 168 + * Compand 169 + */ 170 + #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS 64 171 + 172 + /* 168 173 * Measurement types 169 174 */ 170 175 #define RKISP1_CIF_ISP_STAT_AWB (1U << 0) ··· 856 851 struct rkisp1_cif_isp_isp_other_cfg others; 857 852 }; 858 853 854 + /** 855 + * struct rkisp1_cif_isp_compand_bls_config - Rockchip ISP1 Companding parameters (BLS) 856 + * @r: Fixed subtraction value for Bayer pattern R 857 + * @gr: Fixed subtraction value for Bayer pattern Gr 858 + * @gb: Fixed subtraction value for Bayer pattern Gb 859 + * @b: Fixed subtraction value for Bayer pattern B 860 + * 861 + * The values will be subtracted from the sensor values. Note that unlike the 862 + * dedicated BLS block, the BLS values in the compander are 20-bit unsigned. 863 + */ 864 + struct rkisp1_cif_isp_compand_bls_config { 865 + __u32 r; 866 + __u32 gr; 867 + __u32 gb; 868 + __u32 b; 869 + }; 870 + 871 + /** 872 + * struct rkisp1_cif_isp_compand_curve_config - Rockchip ISP1 Companding 873 + * parameters (expand and compression curves) 874 + * @px: Compand curve x-values. Each value stores the distance from the 875 + * previous x-value, expressed as log2 of the distance on 5 bits. 876 + * @x: Compand curve x-values. The functionality of these parameters are 877 + * unknown due to do a lack of hardware documentation, but these are left 878 + * here for future compatibility purposes. 879 + * @y: Compand curve y-values 880 + */ 881 + struct rkisp1_cif_isp_compand_curve_config { 882 + __u8 px[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; 883 + __u32 x[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; 884 + __u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; 885 + }; 886 + 859 887 /*---------- PART2: Measurement Statistics ------------*/ 860 888 861 889 /** ··· 1032 994 __u32 meas_type; 1033 995 __u32 frame_id; 1034 996 struct rkisp1_cif_isp_stat params; 997 + }; 998 + 999 + /*---------- PART3: Extensible Configuration Parameters ------------*/ 1000 + 1001 + /** 1002 + * enum rkisp1_ext_params_block_type - RkISP1 extensible params block type 1003 + * 1004 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS: Black level subtraction 1005 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC: Defect pixel cluster correction 1006 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG: Sensor de-gamma 1007 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN: Auto white balance gains 1008 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT: ISP filtering 1009 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM: Bayer de-mosaic 1010 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK: Cross-talk correction 1011 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC: Gamma out correction 1012 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF: De-noise pre-filter 1013 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH: De-noise pre-filter strength 1014 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC: Color processing 1015 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_IE: Image effects 1016 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC: Lens shading correction 1017 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS: Auto white balance statistics 1018 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS: Histogram statistics 1019 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS: Auto exposure statistics 1020 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS: Auto-focus statistics 1021 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block 1022 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve 1023 + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve 1024 + */ 1025 + enum rkisp1_ext_params_block_type { 1026 + RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS, 1027 + RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC, 1028 + RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG, 1029 + RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN, 1030 + RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT, 1031 + RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM, 1032 + RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK, 1033 + RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC, 1034 + RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF, 1035 + RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH, 1036 + RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC, 1037 + RKISP1_EXT_PARAMS_BLOCK_TYPE_IE, 1038 + RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC, 1039 + RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS, 1040 + RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS, 1041 + RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS, 1042 + RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS, 1043 + RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS, 1044 + RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND, 1045 + RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS, 1046 + }; 1047 + 1048 + #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE (1U << 0) 1049 + #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE (1U << 1) 1050 + 1051 + /** 1052 + * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block 1053 + * header 1054 + * 1055 + * This structure represents the common part of all the ISP configuration 1056 + * blocks. Each parameters block shall embed an instance of this structure type 1057 + * as its first member, followed by the block-specific configuration data. The 1058 + * driver inspects this common header to discern the block type and its size and 1059 + * properly handle the block content by casting it to the correct block-specific 1060 + * type. 1061 + * 1062 + * The @type field is one of the values enumerated by 1063 + * :c:type:`rkisp1_ext_params_block_type` and specifies how the data should be 1064 + * interpreted by the driver. The @size field specifies the size of the 1065 + * parameters block and is used by the driver for validation purposes. 1066 + * 1067 + * The @flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*. 1068 + * 1069 + * When userspace wants to configure and enable an ISP block it shall fully 1070 + * populate the block configuration and set the 1071 + * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE bit in the @flags field. 1072 + * 1073 + * When userspace simply wants to disable an ISP block the 1074 + * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bit should be set in @flags field. The 1075 + * driver ignores the rest of the block configuration structure in this case. 1076 + * 1077 + * If a new configuration of an ISP block has to be applied userspace shall 1078 + * fully populate the ISP block configuration and omit setting the 1079 + * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits 1080 + * in the @flags field. 1081 + * 1082 + * Setting both the RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and 1083 + * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits in the @flags field is not allowed 1084 + * and not accepted by the driver. 1085 + * 1086 + * Userspace is responsible for correctly populating the parameters block header 1087 + * fields (@type, @flags and @size) and the block-specific parameters. 1088 + * 1089 + * For example: 1090 + * 1091 + * .. code-block:: c 1092 + * 1093 + * void populate_bls(struct rkisp1_ext_params_block_header *block) { 1094 + * struct rkisp1_ext_params_bls_config *bls = 1095 + * (struct rkisp1_ext_params_bls_config *)block; 1096 + * 1097 + * bls->header.type = RKISP1_EXT_PARAMS_BLOCK_ID_BLS; 1098 + * bls->header.flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; 1099 + * bls->header.size = sizeof(*bls); 1100 + * 1101 + * bls->config.enable_auto = 0; 1102 + * bls->config.fixed_val.r = blackLevelRed_; 1103 + * bls->config.fixed_val.gr = blackLevelGreenR_; 1104 + * bls->config.fixed_val.gb = blackLevelGreenB_; 1105 + * bls->config.fixed_val.b = blackLevelBlue_; 1106 + * } 1107 + * 1108 + * @type: The parameters block type, see 1109 + * :c:type:`rkisp1_ext_params_block_type` 1110 + * @flags: A bitmask of block flags 1111 + * @size: Size (in bytes) of the parameters block, including this header 1112 + */ 1113 + struct rkisp1_ext_params_block_header { 1114 + __u16 type; 1115 + __u16 flags; 1116 + __u32 size; 1117 + }; 1118 + 1119 + /** 1120 + * struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config 1121 + * 1122 + * RkISP1 extensible parameters Black Level Subtraction configuration block. 1123 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS`. 1124 + * 1125 + * @header: The RkISP1 extensible parameters header, see 1126 + * :c:type:`rkisp1_ext_params_block_header` 1127 + * @config: Black Level Subtraction configuration, see 1128 + * :c:type:`rkisp1_cif_isp_bls_config` 1129 + */ 1130 + struct rkisp1_ext_params_bls_config { 1131 + struct rkisp1_ext_params_block_header header; 1132 + struct rkisp1_cif_isp_bls_config config; 1133 + } __attribute__((aligned(8))); 1134 + 1135 + /** 1136 + * struct rkisp1_ext_params_dpcc_config - RkISP1 extensible params DPCC config 1137 + * 1138 + * RkISP1 extensible parameters Defective Pixel Cluster Correction configuration 1139 + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC`. 1140 + * 1141 + * @header: The RkISP1 extensible parameters header, see 1142 + * :c:type:`rkisp1_ext_params_block_header` 1143 + * @config: Defective Pixel Cluster Correction configuration, see 1144 + * :c:type:`rkisp1_cif_isp_dpcc_config` 1145 + */ 1146 + struct rkisp1_ext_params_dpcc_config { 1147 + struct rkisp1_ext_params_block_header header; 1148 + struct rkisp1_cif_isp_dpcc_config config; 1149 + } __attribute__((aligned(8))); 1150 + 1151 + /** 1152 + * struct rkisp1_ext_params_sdg_config - RkISP1 extensible params SDG config 1153 + * 1154 + * RkISP1 extensible parameters Sensor Degamma configuration block. Identified 1155 + * by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG`. 1156 + * 1157 + * @header: The RkISP1 extensible parameters header, see 1158 + * :c:type:`rkisp1_ext_params_block_header` 1159 + * @config: Sensor Degamma configuration, see 1160 + * :c:type:`rkisp1_cif_isp_sdg_config` 1161 + */ 1162 + struct rkisp1_ext_params_sdg_config { 1163 + struct rkisp1_ext_params_block_header header; 1164 + struct rkisp1_cif_isp_sdg_config config; 1165 + } __attribute__((aligned(8))); 1166 + 1167 + /** 1168 + * struct rkisp1_ext_params_lsc_config - RkISP1 extensible params LSC config 1169 + * 1170 + * RkISP1 extensible parameters Lens Shading Correction configuration block. 1171 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC`. 1172 + * 1173 + * @header: The RkISP1 extensible parameters header, see 1174 + * :c:type:`rkisp1_ext_params_block_header` 1175 + * @config: Lens Shading Correction configuration, see 1176 + * :c:type:`rkisp1_cif_isp_lsc_config` 1177 + */ 1178 + struct rkisp1_ext_params_lsc_config { 1179 + struct rkisp1_ext_params_block_header header; 1180 + struct rkisp1_cif_isp_lsc_config config; 1181 + } __attribute__((aligned(8))); 1182 + 1183 + /** 1184 + * struct rkisp1_ext_params_awb_gain_config - RkISP1 extensible params AWB 1185 + * gain config 1186 + * 1187 + * RkISP1 extensible parameters Auto-White Balance Gains configuration block. 1188 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN`. 1189 + * 1190 + * @header: The RkISP1 extensible parameters header, see 1191 + * :c:type:`rkisp1_ext_params_block_header` 1192 + * @config: Auto-White Balance Gains configuration, see 1193 + * :c:type:`rkisp1_cif_isp_awb_gain_config` 1194 + */ 1195 + struct rkisp1_ext_params_awb_gain_config { 1196 + struct rkisp1_ext_params_block_header header; 1197 + struct rkisp1_cif_isp_awb_gain_config config; 1198 + } __attribute__((aligned(8))); 1199 + 1200 + /** 1201 + * struct rkisp1_ext_params_flt_config - RkISP1 extensible params FLT config 1202 + * 1203 + * RkISP1 extensible parameters Filter configuration block. Identified by 1204 + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT`. 1205 + * 1206 + * @header: The RkISP1 extensible parameters header, see 1207 + * :c:type:`rkisp1_ext_params_block_header` 1208 + * @config: Filter configuration, see :c:type:`rkisp1_cif_isp_flt_config` 1209 + */ 1210 + struct rkisp1_ext_params_flt_config { 1211 + struct rkisp1_ext_params_block_header header; 1212 + struct rkisp1_cif_isp_flt_config config; 1213 + } __attribute__((aligned(8))); 1214 + 1215 + /** 1216 + * struct rkisp1_ext_params_bdm_config - RkISP1 extensible params BDM config 1217 + * 1218 + * RkISP1 extensible parameters Demosaicing configuration block. Identified by 1219 + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM`. 1220 + * 1221 + * @header: The RkISP1 extensible parameters header, see 1222 + * :c:type:`rkisp1_ext_params_block_header` 1223 + * @config: Demosaicing configuration, see :c:type:`rkisp1_cif_isp_bdm_config` 1224 + */ 1225 + struct rkisp1_ext_params_bdm_config { 1226 + struct rkisp1_ext_params_block_header header; 1227 + struct rkisp1_cif_isp_bdm_config config; 1228 + } __attribute__((aligned(8))); 1229 + 1230 + /** 1231 + * struct rkisp1_ext_params_ctk_config - RkISP1 extensible params CTK config 1232 + * 1233 + * RkISP1 extensible parameters Cross-Talk configuration block. Identified by 1234 + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK`. 1235 + * 1236 + * @header: The RkISP1 extensible parameters header, see 1237 + * :c:type:`rkisp1_ext_params_block_header` 1238 + * @config: Cross-Talk configuration, see :c:type:`rkisp1_cif_isp_ctk_config` 1239 + */ 1240 + struct rkisp1_ext_params_ctk_config { 1241 + struct rkisp1_ext_params_block_header header; 1242 + struct rkisp1_cif_isp_ctk_config config; 1243 + } __attribute__((aligned(8))); 1244 + 1245 + /** 1246 + * struct rkisp1_ext_params_goc_config - RkISP1 extensible params GOC config 1247 + * 1248 + * RkISP1 extensible parameters Gamma-Out configuration block. Identified by 1249 + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC`. 1250 + * 1251 + * @header: The RkISP1 extensible parameters header, see 1252 + * :c:type:`rkisp1_ext_params_block_header` 1253 + * @config: Gamma-Out configuration, see :c:type:`rkisp1_cif_isp_goc_config` 1254 + */ 1255 + struct rkisp1_ext_params_goc_config { 1256 + struct rkisp1_ext_params_block_header header; 1257 + struct rkisp1_cif_isp_goc_config config; 1258 + } __attribute__((aligned(8))); 1259 + 1260 + /** 1261 + * struct rkisp1_ext_params_dpf_config - RkISP1 extensible params DPF config 1262 + * 1263 + * RkISP1 extensible parameters De-noise Pre-Filter configuration block. 1264 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF`. 1265 + * 1266 + * @header: The RkISP1 extensible parameters header, see 1267 + * :c:type:`rkisp1_ext_params_block_header` 1268 + * @config: De-noise Pre-Filter configuration, see 1269 + * :c:type:`rkisp1_cif_isp_dpf_config` 1270 + */ 1271 + struct rkisp1_ext_params_dpf_config { 1272 + struct rkisp1_ext_params_block_header header; 1273 + struct rkisp1_cif_isp_dpf_config config; 1274 + } __attribute__((aligned(8))); 1275 + 1276 + /** 1277 + * struct rkisp1_ext_params_dpf_strength_config - RkISP1 extensible params DPF 1278 + * strength config 1279 + * 1280 + * RkISP1 extensible parameters De-noise Pre-Filter strength configuration 1281 + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH`. 1282 + * 1283 + * @header: The RkISP1 extensible parameters header, see 1284 + * :c:type:`rkisp1_ext_params_block_header` 1285 + * @config: De-noise Pre-Filter strength configuration, see 1286 + * :c:type:`rkisp1_cif_isp_dpf_strength_config` 1287 + */ 1288 + struct rkisp1_ext_params_dpf_strength_config { 1289 + struct rkisp1_ext_params_block_header header; 1290 + struct rkisp1_cif_isp_dpf_strength_config config; 1291 + } __attribute__((aligned(8))); 1292 + 1293 + /** 1294 + * struct rkisp1_ext_params_cproc_config - RkISP1 extensible params CPROC config 1295 + * 1296 + * RkISP1 extensible parameters Color Processing configuration block. 1297 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC`. 1298 + * 1299 + * @header: The RkISP1 extensible parameters header, see 1300 + * :c:type:`rkisp1_ext_params_block_header` 1301 + * @config: Color processing configuration, see 1302 + * :c:type:`rkisp1_cif_isp_cproc_config` 1303 + */ 1304 + struct rkisp1_ext_params_cproc_config { 1305 + struct rkisp1_ext_params_block_header header; 1306 + struct rkisp1_cif_isp_cproc_config config; 1307 + } __attribute__((aligned(8))); 1308 + 1309 + /** 1310 + * struct rkisp1_ext_params_ie_config - RkISP1 extensible params IE config 1311 + * 1312 + * RkISP1 extensible parameters Image Effect configuration block. Identified by 1313 + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_IE`. 1314 + * 1315 + * @header: The RkISP1 extensible parameters header, see 1316 + * :c:type:`rkisp1_ext_params_block_header` 1317 + * @config: Image Effect configuration, see :c:type:`rkisp1_cif_isp_ie_config` 1318 + */ 1319 + struct rkisp1_ext_params_ie_config { 1320 + struct rkisp1_ext_params_block_header header; 1321 + struct rkisp1_cif_isp_ie_config config; 1322 + } __attribute__((aligned(8))); 1323 + 1324 + /** 1325 + * struct rkisp1_ext_params_awb_meas_config - RkISP1 extensible params AWB 1326 + * Meas config 1327 + * 1328 + * RkISP1 extensible parameters Auto-White Balance Measurement configuration 1329 + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS`. 1330 + * 1331 + * @header: The RkISP1 extensible parameters header, see 1332 + * :c:type:`rkisp1_ext_params_block_header` 1333 + * @config: Auto-White Balance measure configuration, see 1334 + * :c:type:`rkisp1_cif_isp_awb_meas_config` 1335 + */ 1336 + struct rkisp1_ext_params_awb_meas_config { 1337 + struct rkisp1_ext_params_block_header header; 1338 + struct rkisp1_cif_isp_awb_meas_config config; 1339 + } __attribute__((aligned(8))); 1340 + 1341 + /** 1342 + * struct rkisp1_ext_params_hst_config - RkISP1 extensible params Histogram config 1343 + * 1344 + * RkISP1 extensible parameters Histogram statistics configuration block. 1345 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS`. 1346 + * 1347 + * @header: The RkISP1 extensible parameters header, see 1348 + * :c:type:`rkisp1_ext_params_block_header` 1349 + * @config: Histogram statistics configuration, see 1350 + * :c:type:`rkisp1_cif_isp_hst_config` 1351 + */ 1352 + struct rkisp1_ext_params_hst_config { 1353 + struct rkisp1_ext_params_block_header header; 1354 + struct rkisp1_cif_isp_hst_config config; 1355 + } __attribute__((aligned(8))); 1356 + 1357 + /** 1358 + * struct rkisp1_ext_params_aec_config - RkISP1 extensible params AEC config 1359 + * 1360 + * RkISP1 extensible parameters Auto-Exposure statistics configuration block. 1361 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS`. 1362 + * 1363 + * @header: The RkISP1 extensible parameters header, see 1364 + * :c:type:`rkisp1_ext_params_block_header` 1365 + * @config: Auto-Exposure statistics configuration, see 1366 + * :c:type:`rkisp1_cif_isp_aec_config` 1367 + */ 1368 + struct rkisp1_ext_params_aec_config { 1369 + struct rkisp1_ext_params_block_header header; 1370 + struct rkisp1_cif_isp_aec_config config; 1371 + } __attribute__((aligned(8))); 1372 + 1373 + /** 1374 + * struct rkisp1_ext_params_afc_config - RkISP1 extensible params AFC config 1375 + * 1376 + * RkISP1 extensible parameters Auto-Focus statistics configuration block. 1377 + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS`. 1378 + * 1379 + * @header: The RkISP1 extensible parameters header, see 1380 + * :c:type:`rkisp1_ext_params_block_header` 1381 + * @config: Auto-Focus statistics configuration, see 1382 + * :c:type:`rkisp1_cif_isp_afc_config` 1383 + */ 1384 + struct rkisp1_ext_params_afc_config { 1385 + struct rkisp1_ext_params_block_header header; 1386 + struct rkisp1_cif_isp_afc_config config; 1387 + } __attribute__((aligned(8))); 1388 + 1389 + /** 1390 + * struct rkisp1_ext_params_compand_bls_config - RkISP1 extensible params 1391 + * Compand BLS config 1392 + * 1393 + * RkISP1 extensible parameters Companding configuration block (black level 1394 + * subtraction). Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS`. 1395 + * 1396 + * @header: The RkISP1 extensible parameters header, see 1397 + * :c:type:`rkisp1_ext_params_block_header` 1398 + * @config: Companding BLS configuration, see 1399 + * :c:type:`rkisp1_cif_isp_compand_bls_config` 1400 + */ 1401 + struct rkisp1_ext_params_compand_bls_config { 1402 + struct rkisp1_ext_params_block_header header; 1403 + struct rkisp1_cif_isp_compand_bls_config config; 1404 + } __attribute__((aligned(8))); 1405 + 1406 + /** 1407 + * struct rkisp1_ext_params_compand_curve_config - RkISP1 extensible params 1408 + * Compand curve config 1409 + * 1410 + * RkISP1 extensible parameters Companding configuration block (expand and 1411 + * compression curves). Identified by 1412 + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND` or 1413 + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS`. 1414 + * 1415 + * @header: The RkISP1 extensible parameters header, see 1416 + * :c:type:`rkisp1_ext_params_block_header` 1417 + * @config: Companding curve configuration, see 1418 + * :c:type:`rkisp1_cif_isp_compand_curve_config` 1419 + */ 1420 + struct rkisp1_ext_params_compand_curve_config { 1421 + struct rkisp1_ext_params_block_header header; 1422 + struct rkisp1_cif_isp_compand_curve_config config; 1423 + } __attribute__((aligned(8))); 1424 + 1425 + /* 1426 + * The rkisp1_ext_params_compand_curve_config structure is counted twice as it 1427 + * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types. 1428 + */ 1429 + #define RKISP1_EXT_PARAMS_MAX_SIZE \ 1430 + (sizeof(struct rkisp1_ext_params_bls_config) +\ 1431 + sizeof(struct rkisp1_ext_params_dpcc_config) +\ 1432 + sizeof(struct rkisp1_ext_params_sdg_config) +\ 1433 + sizeof(struct rkisp1_ext_params_lsc_config) +\ 1434 + sizeof(struct rkisp1_ext_params_awb_gain_config) +\ 1435 + sizeof(struct rkisp1_ext_params_flt_config) +\ 1436 + sizeof(struct rkisp1_ext_params_bdm_config) +\ 1437 + sizeof(struct rkisp1_ext_params_ctk_config) +\ 1438 + sizeof(struct rkisp1_ext_params_goc_config) +\ 1439 + sizeof(struct rkisp1_ext_params_dpf_config) +\ 1440 + sizeof(struct rkisp1_ext_params_dpf_strength_config) +\ 1441 + sizeof(struct rkisp1_ext_params_cproc_config) +\ 1442 + sizeof(struct rkisp1_ext_params_ie_config) +\ 1443 + sizeof(struct rkisp1_ext_params_awb_meas_config) +\ 1444 + sizeof(struct rkisp1_ext_params_hst_config) +\ 1445 + sizeof(struct rkisp1_ext_params_aec_config) +\ 1446 + sizeof(struct rkisp1_ext_params_afc_config) +\ 1447 + sizeof(struct rkisp1_ext_params_compand_bls_config) +\ 1448 + sizeof(struct rkisp1_ext_params_compand_curve_config) +\ 1449 + sizeof(struct rkisp1_ext_params_compand_curve_config)) 1450 + 1451 + /** 1452 + * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version 1453 + * 1454 + * @RKISP1_EXT_PARAM_BUFFER_V1: First version of RkISP1 extensible parameters 1455 + */ 1456 + enum rksip1_ext_param_buffer_version { 1457 + RKISP1_EXT_PARAM_BUFFER_V1 = 1, 1458 + }; 1459 + 1460 + /** 1461 + * struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration 1462 + * 1463 + * This struct contains the configuration parameters of the RkISP1 ISP 1464 + * algorithms, serialized by userspace into a data buffer. Each configuration 1465 + * parameter block is represented by a block-specific structure which contains a 1466 + * :c:type:`rkisp1_ext_params_block_header` entry as first member. Userspace 1467 + * populates the @data buffer with configuration parameters for the blocks that 1468 + * it intends to configure. As a consequence, the data buffer effective size 1469 + * changes according to the number of ISP blocks that userspace intends to 1470 + * configure and is set by userspace in the @data_size field. 1471 + * 1472 + * The parameters buffer is versioned by the @version field to allow modifying 1473 + * and extending its definition. Userspace shall populate the @version field to 1474 + * inform the driver about the version it intends to use. The driver will parse 1475 + * and handle the @data buffer according to the data layout specific to the 1476 + * indicated version and return an error if the desired version is not 1477 + * supported. 1478 + * 1479 + * Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported. 1480 + * When a new format version will be added, a mechanism for userspace to query 1481 + * the supported format versions will be implemented in the form of a read-only 1482 + * V4L2 control. If such control is not available, userspace should assume only 1483 + * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver. 1484 + * 1485 + * For each ISP block that userspace wants to configure, a block-specific 1486 + * structure is appended to the @data buffer, one after the other without gaps 1487 + * in between nor overlaps. Userspace shall populate the @data_size field with 1488 + * the effective size, in bytes, of the @data buffer. 1489 + * 1490 + * The expected memory layout of the parameters buffer is:: 1491 + * 1492 + * +-------------------- struct rkisp1_ext_params_cfg -------------------+ 1493 + * | version = RKISP_EXT_PARAMS_BUFFER_V1; | 1494 + * | data_size = sizeof(struct rkisp1_ext_params_bls_config) | 1495 + * | + sizeof(struct rkisp1_ext_params_dpcc_config); | 1496 + * | +------------------------- data ---------------------------------+ | 1497 + * | | +------------- struct rkisp1_ext_params_bls_config -----------+ | | 1498 + * | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | | 1499 + * | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS; | | | | 1500 + * | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | | 1501 + * | | | | size = sizeof(struct rkisp1_ext_params_bls_config); | | | | 1502 + * | | | +---------------------------------------------------------+ | | | 1503 + * | | | +---------- struct rkisp1_cif_isp_bls_config -------------+ | | | 1504 + * | | | | enable_auto = 0; | | | | 1505 + * | | | | fixed_val.r = 256; | | | | 1506 + * | | | | fixed_val.gr = 256; | | | | 1507 + * | | | | fixed_val.gb = 256; | | | | 1508 + * | | | | fixed_val.b = 256; | | | | 1509 + * | | | +---------------------------------------------------------+ | | | 1510 + * | | +------------ struct rkisp1_ext_params_dpcc_config -----------+ | | 1511 + * | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | | 1512 + * | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC; | | | | 1513 + * | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | | 1514 + * | | | | size = sizeof(struct rkisp1_ext_params_dpcc_config); | | | | 1515 + * | | | +---------------------------------------------------------+ | | | 1516 + * | | | +---------- struct rkisp1_cif_isp_dpcc_config ------------+ | | | 1517 + * | | | | mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE; | | | | 1518 + * | | | | output_mode = | | | | 1519 + * | | | | RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER; | | | | 1520 + * | | | | set_use = ... ; | | | | 1521 + * | | | | ... = ... ; | | | | 1522 + * | | | +---------------------------------------------------------+ | | | 1523 + * | | +-------------------------------------------------------------+ | | 1524 + * | +-----------------------------------------------------------------+ | 1525 + * +---------------------------------------------------------------------+ 1526 + * 1527 + * @version: The RkISP1 extensible parameters buffer version, see 1528 + * :c:type:`rksip1_ext_param_buffer_version` 1529 + * @data_size: The RkISP1 configuration data effective size, excluding this 1530 + * header 1531 + * @data: The RkISP1 extensible configuration data blocks 1532 + */ 1533 + struct rkisp1_ext_params_cfg { 1534 + __u32 version; 1535 + __u32 data_size; 1536 + __u8 data[RKISP1_EXT_PARAMS_MAX_SIZE]; 1035 1537 }; 1036 1538 1037 1539 #endif /* _UAPI_RKISP1_CONFIG_H */
+1
include/uapi/linux/videodev2.h
··· 854 854 /* Vendor specific - used for RK_ISP1 camera sub-system */ 855 855 #define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */ 856 856 #define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */ 857 + #define V4L2_META_FMT_RK_ISP1_EXT_PARAMS v4l2_fourcc('R', 'K', '1', 'E') /* Rockchip ISP1 3a Extensible Parameters */ 857 858 858 859 /* Vendor specific - used for RaspberryPi PiSP */ 859 860 #define V4L2_META_FMT_RPI_BE_CFG v4l2_fourcc('R', 'P', 'B', 'C') /* PiSP BE configuration */