| 1 | /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ |
| 2 | /* |
| 3 | * Copyright (C) 2024 Amlogic, Inc. All rights reserved |
| 4 | */ |
| 5 | |
| 6 | #ifndef _C3_ISP_CONFIG_H_ |
| 7 | #define _C3_ISP_CONFIG_H_ |
| 8 | |
| 9 | #include <linux/types.h> |
| 10 | |
| 11 | #include <linux/media/v4l2-isp.h> |
| 12 | |
| 13 | /* |
| 14 | * Frames are split into zones of almost equal width and height - a zone is a |
| 15 | * rectangular tile of a frame. The metering blocks within the ISP collect |
| 16 | * aggregated statistics per zone. |
| 17 | */ |
| 18 | #define C3_ISP_AE_MAX_ZONES (17 * 15) |
| 19 | #define C3_ISP_AF_MAX_ZONES (17 * 15) |
| 20 | #define C3_ISP_AWB_MAX_ZONES (32 * 24) |
| 21 | |
| 22 | /* The maximum number of point on the diagonal of the frame for statistics */ |
| 23 | #define C3_ISP_AE_MAX_PT_NUM 18 |
| 24 | #define C3_ISP_AF_MAX_PT_NUM 18 |
| 25 | #define C3_ISP_AWB_MAX_PT_NUM 33 |
| 26 | |
| 27 | /** |
| 28 | * struct c3_isp_awb_zone_stats - AWB statistics of a zone |
| 29 | * |
| 30 | * AWB zone stats is aligned with 8 bytes |
| 31 | * |
| 32 | * @rg: the ratio of R / G in a zone |
| 33 | * @bg: the ratio of B / G in a zone |
| 34 | * @pixel_sum: the total number of pixels used in a zone |
| 35 | */ |
| 36 | struct c3_isp_awb_zone_stats { |
| 37 | 	__u16 rg; |
| 38 | 	__u16 bg; |
| 39 | 	__u32 pixel_sum; |
| 40 | }; |
| 41 | |
| 42 | /** |
| 43 | * struct c3_isp_awb_stats - Auto white balance statistics information. |
| 44 | * |
| 45 | * AWB statistical information of all zones. |
| 46 | * |
| 47 | * @stats: array of auto white balance statistics |
| 48 | */ |
| 49 | struct c3_isp_awb_stats { |
| 50 | 	struct c3_isp_awb_zone_stats stats[C3_ISP_AWB_MAX_ZONES]; |
| 51 | } __attribute__((aligned(16))); |
| 52 | |
| 53 | /** |
| 54 | * struct c3_isp_ae_zone_stats - AE statistics of a zone |
| 55 | * |
| 56 | * AE zone stats is aligned with 8 bytes. |
| 57 | * This is a 5-bin histogram and the total sum is normalized to 0xffff. |
| 58 | * So hist2 = 0xffff - (hist0 + hist1 + hist3 + hist4) |
| 59 | * |
| 60 | * @hist0: the global normalized pixel count for bin 0 |
| 61 | * @hist1: the global normalized pixel count for bin 1 |
| 62 | * @hist3: the global normalized pixel count for bin 3 |
| 63 | * @hist4: the global normalized pixel count for bin 4 |
| 64 | */ |
| 65 | struct c3_isp_ae_zone_stats { |
| 66 | 	__u16 hist0; |
| 67 | 	__u16 hist1; |
| 68 | 	__u16 hist3; |
| 69 | 	__u16 hist4; |
| 70 | }; |
| 71 | |
| 72 | /** |
| 73 | * struct c3_isp_ae_stats - Exposure statistics information |
| 74 | * |
| 75 | * AE statistical information consists of all blocks information and a 1024-bin |
| 76 | * histogram. |
| 77 | * |
| 78 | * @stats: array of auto exposure block statistics |
| 79 | * @reserved: undefined buffer space |
| 80 | * @hist: a 1024-bin histogram for the entire image |
| 81 | */ |
| 82 | struct c3_isp_ae_stats { |
| 83 | 	struct c3_isp_ae_zone_stats stats[C3_ISP_AE_MAX_ZONES]; |
| 84 | 	__u32 reserved[2]; |
| 85 | 	__u32 hist[1024]; |
| 86 | } __attribute__((aligned(16))); |
| 87 | |
| 88 | /** |
| 89 | * struct c3_isp_af_zone_stats - AF statistics of a zone |
| 90 | * |
| 91 | * AF zone stats is aligned with 8 bytes. |
| 92 | * The zonal accumulated contrast metrics are stored in floating point format |
| 93 | * with 16 bits mantissa and 5 or 6 bits exponent. Apart from contrast metrics |
| 94 | * we accumulate squared image and quartic image data over the zone. |
| 95 | * |
| 96 | * @i2_mat: the mantissa of zonal squared image pixel sum |
| 97 | * @i4_mat: the mantissa of zonal quartic image pixel sum |
| 98 | * @e4_mat: the mantissa of zonal multi-directional quartic edge sum |
| 99 | * @e4_exp: the exponent of zonal multi-directional quartic edge sum |
| 100 | * @i2_exp: the exponent of zonal squared image pixel sum |
| 101 | * @i4_exp: the exponent of zonal quartic image pixel sum |
| 102 | */ |
| 103 | struct c3_isp_af_zone_stats { |
| 104 | 	__u16 i2_mat; |
| 105 | 	__u16 i4_mat; |
| 106 | 	__u16 e4_mat; |
| 107 | 	__u16 e4_exp : 5; |
| 108 | 	__u16 i2_exp : 5; |
| 109 | 	__u16 i4_exp : 6; |
| 110 | }; |
| 111 | |
| 112 | /** |
| 113 | * struct c3_isp_af_stats - Auto Focus statistics information |
| 114 | * |
| 115 | * AF statistical information of each zone |
| 116 | * |
| 117 | * @stats: array of auto focus block statistics |
| 118 | * @reserved: undefined buffer space |
| 119 | */ |
| 120 | struct c3_isp_af_stats { |
| 121 | 	struct c3_isp_af_zone_stats stats[C3_ISP_AF_MAX_ZONES]; |
| 122 | 	__u32 reserved[2]; |
| 123 | } __attribute__((aligned(16))); |
| 124 | |
| 125 | /** |
| 126 | * struct c3_isp_stats_info - V4L2_META_FMT_C3ISP_STATS |
| 127 | * |
| 128 | * Contains ISP statistics |
| 129 | * |
| 130 | * @awb: auto white balance stats |
| 131 | * @ae: auto exposure stats |
| 132 | * @af: auto focus stats |
| 133 | */ |
| 134 | struct c3_isp_stats_info { |
| 135 | 	struct c3_isp_awb_stats awb; |
| 136 | 	struct c3_isp_ae_stats ae; |
| 137 | 	struct c3_isp_af_stats af; |
| 138 | }; |
| 139 | |
| 140 | /** |
| 141 | * enum c3_isp_params_buffer_version - C3 ISP parameters block versioning |
| 142 | * |
| 143 | * @C3_ISP_PARAMS_BUFFER_V0: First version of C3 ISP parameters block |
| 144 | */ |
| 145 | enum c3_isp_params_buffer_version { |
| 146 | 	C3_ISP_PARAMS_BUFFER_V0 = V4L2_ISP_PARAMS_VERSION_V0, |
| 147 | }; |
| 148 | |
| 149 | /** |
| 150 | * enum c3_isp_params_block_type - Enumeration of C3 ISP parameter blocks |
| 151 | * |
| 152 | * Each block configures a specific processing block of the C3 ISP. |
| 153 | * The block type allows the driver to correctly interpret the parameters block |
| 154 | * data. |
| 155 | * |
| 156 | * @C3_ISP_PARAMS_BLOCK_AWB_GAINS: White balance gains |
| 157 | * @C3_ISP_PARAMS_BLOCK_AWB_CONFIG: AWB statistic format configuration for all |
| 158 | * blocks that control how stats are generated |
| 159 | * @C3_ISP_PARAMS_BLOCK_AE_CONFIG: AE statistic format configuration for all |
| 160 | * blocks that control how stats are generated |
| 161 | * @C3_ISP_PARAMS_BLOCK_AF_CONFIG: AF statistic format configuration for all |
| 162 | * blocks that control how stats are generated |
| 163 | * @C3_ISP_PARAMS_BLOCK_PST_GAMMA: post gamma parameters |
| 164 | * @C3_ISP_PARAMS_BLOCK_CCM: Color correction matrix parameters |
| 165 | * @C3_ISP_PARAMS_BLOCK_CSC: Color space conversion parameters |
| 166 | * @C3_ISP_PARAMS_BLOCK_BLC: Black level correction parameters |
| 167 | * @C3_ISP_PARAMS_BLOCK_SENTINEL: First non-valid block index |
| 168 | */ |
| 169 | enum c3_isp_params_block_type { |
| 170 | 	C3_ISP_PARAMS_BLOCK_AWB_GAINS, |
| 171 | 	C3_ISP_PARAMS_BLOCK_AWB_CONFIG, |
| 172 | 	C3_ISP_PARAMS_BLOCK_AE_CONFIG, |
| 173 | 	C3_ISP_PARAMS_BLOCK_AF_CONFIG, |
| 174 | 	C3_ISP_PARAMS_BLOCK_PST_GAMMA, |
| 175 | 	C3_ISP_PARAMS_BLOCK_CCM, |
| 176 | 	C3_ISP_PARAMS_BLOCK_CSC, |
| 177 | 	C3_ISP_PARAMS_BLOCK_BLC, |
| 178 | 	C3_ISP_PARAMS_BLOCK_SENTINEL |
| 179 | }; |
| 180 | |
| 181 | /* For backward compatibility */ |
| 182 | #define C3_ISP_PARAMS_BLOCK_FL_DISABLE	V4L2_ISP_PARAMS_FL_BLOCK_DISABLE |
| 183 | #define C3_ISP_PARAMS_BLOCK_FL_ENABLE	V4L2_ISP_PARAMS_FL_BLOCK_ENABLE |
| 184 | |
| 185 | /** |
| 186 | * c3_isp_params_block_header - C3 ISP parameter block header |
| 187 | * |
| 188 | * This structure represents the common part of all the ISP configuration |
| 189 | * blocks and is identical to :c:type:`v4l2_isp_params_block_header`. |
| 190 | * |
| 191 | * The type field is one of the values enumerated by |
| 192 | * :c:type:`c3_isp_params_block_type` and specifies how the data should be |
| 193 | * interpreted by the driver. |
| 194 | * |
| 195 | * The flags field is a bitmask of per-block flags C3_ISP_PARAMS_FL_*. |
| 196 | */ |
| 197 | #define c3_isp_params_block_header v4l2_isp_params_block_header |
| 198 | |
| 199 | /** |
| 200 | * struct c3_isp_params_awb_gains - Gains for auto-white balance |
| 201 | * |
| 202 | * This struct allows users to configure the gains for white balance. |
| 203 | * There are four gain settings corresponding to each colour channel in |
| 204 | * the bayer domain. All of the gains are stored in Q4.8 format. |
| 205 | * |
| 206 | * header.type should be set to C3_ISP_PARAMS_BLOCK_AWB_GAINS |
| 207 | * from :c:type:`c3_isp_params_block_type` |
| 208 | * |
| 209 | * @header: The C3 ISP parameters block header |
| 210 | * @gr_gain: Multiplier for Gr channel (Q4.8 format) |
| 211 | * @r_gain: Multiplier for R channel (Q4.8 format) |
| 212 | * @b_gain: Multiplier for B channel (Q4.8 format) |
| 213 | * @gb_gain: Multiplier for Gb channel (Q4.8 format) |
| 214 | */ |
| 215 | struct c3_isp_params_awb_gains { |
| 216 | 	struct c3_isp_params_block_header header; |
| 217 | 	__u16 gr_gain; |
| 218 | 	__u16 r_gain; |
| 219 | 	__u16 b_gain; |
| 220 | 	__u16 gb_gain; |
| 221 | } __attribute__((aligned(8))); |
| 222 | |
| 223 | /** |
| 224 | * enum c3_isp_params_awb_tap_points - Tap points for the AWB statistics |
| 225 | * @C3_ISP_AWB_STATS_TAP_OFE: immediately after the optical frontend block |
| 226 | * @C3_ISP_AWB_STATS_TAP_GE: immediately after the green equal block |
| 227 | * @C3_ISP_AWB_STATS_TAP_BEFORE_WB: immediately before the white balance block |
| 228 | * @C3_ISP_AWB_STATS_TAP_AFTER_WB: immediately after the white balance block |
| 229 | */ |
| 230 | enum c3_isp_params_awb_tap_points { |
| 231 | 	C3_ISP_AWB_STATS_TAP_OFE = 0, |
| 232 | 	C3_ISP_AWB_STATS_TAP_GE, |
| 233 | 	C3_ISP_AWB_STATS_TAP_BEFORE_WB, |
| 234 | 	C3_ISP_AWB_STATS_TAP_AFTER_WB, |
| 235 | }; |
| 236 | |
| 237 | /** |
| 238 | * struct c3_isp_params_awb_config - Stats settings for auto-white balance |
| 239 | * |
| 240 | * This struct allows the configuration of the statistics generated for auto |
| 241 | * white balance. |
| 242 | * |
| 243 | * header.type should be set to C3_ISP_PARAMS_BLOCK_AWB_CONFIG |
| 244 | * from :c:type:`c3_isp_params_block_type` |
| 245 | * |
| 246 | * @header: the C3 ISP parameters block header |
| 247 | * @tap_point: the tap point from enum c3_isp_params_awb_tap_point |
| 248 | * @satur_vald: AWB statistic over saturation control |
| 249 | *		value: 0: disable, 1: enable |
| 250 | * @horiz_zones_num: active number of hotizontal zones [0..32] |
| 251 | * @vert_zones_num: active number of vertical zones [0..24] |
| 252 | * @rg_min: minimum R/G ratio (Q4.8 format) |
| 253 | * @rg_max: maximum R/G ratio (Q4.8 format) |
| 254 | * @bg_min: minimum B/G ratio (Q4.8 format) |
| 255 | * @bg_max: maximum B/G ratio (Q4.8 format) |
| 256 | * @rg_low: R/G ratio trim low (Q4.8 format) |
| 257 | * @rg_high: R/G ratio trim hight (Q4.8 format) |
| 258 | * @bg_low: B/G ratio trim low (Q4.8 format) |
| 259 | * @bg_high: B/G ratio trim high (Q4.8 format) |
| 260 | * @zone_weight: array of weights for AWB statistics zones [0..15] |
| 261 | * @horiz_coord: the horizontal coordinate of points on the diagonal [0..2888] |
| 262 | * @vert_coord: the vertical coordinate of points on the diagonal [0..2240] |
| 263 | */ |
| 264 | struct c3_isp_params_awb_config { |
| 265 | 	struct c3_isp_params_block_header header; |
| 266 | 	__u8 tap_point; |
| 267 | 	__u8 satur_vald; |
| 268 | 	__u8 horiz_zones_num; |
| 269 | 	__u8 vert_zones_num; |
| 270 | 	__u16 rg_min; |
| 271 | 	__u16 rg_max; |
| 272 | 	__u16 bg_min; |
| 273 | 	__u16 bg_max; |
| 274 | 	__u16 rg_low; |
| 275 | 	__u16 rg_high; |
| 276 | 	__u16 bg_low; |
| 277 | 	__u16 bg_high; |
| 278 | 	__u8 zone_weight[C3_ISP_AWB_MAX_ZONES]; |
| 279 | 	__u16 horiz_coord[C3_ISP_AWB_MAX_PT_NUM]; |
| 280 | 	__u16 vert_coord[C3_ISP_AWB_MAX_PT_NUM]; |
| 281 | } __attribute__((aligned(8))); |
| 282 | |
| 283 | /** |
| 284 | * enum c3_isp_params_ae_tap_points - Tap points for the AE statistics |
| 285 | * @C3_ISP_AE_STATS_TAP_GE: immediately after the green equal block |
| 286 | * @C3_ISP_AE_STATS_TAP_MLS: immediately after the mesh lens shading block |
| 287 | */ |
| 288 | enum c3_isp_params_ae_tap_points { |
| 289 | 	C3_ISP_AE_STATS_TAP_GE = 0, |
| 290 | 	C3_ISP_AE_STATS_TAP_MLS, |
| 291 | }; |
| 292 | |
| 293 | /** |
| 294 | * struct c3_isp_params_ae_config - Stats settings for auto-exposure |
| 295 | * |
| 296 | * This struct allows the configuration of the statistics generated for |
| 297 | * auto exposure. |
| 298 | * |
| 299 | * header.type should be set to C3_ISP_PARAMS_BLOCK_AE_CONFIG |
| 300 | * from :c:type:`c3_isp_params_block_type` |
| 301 | * |
| 302 | * @header: the C3 ISP parameters block header |
| 303 | * @horiz_zones_num: active number of horizontal zones [0..17] |
| 304 | * @vert_zones_num: active number of vertical zones [0..15] |
| 305 | * @tap_point: the tap point from enum c3_isp_params_ae_tap_point |
| 306 | * @zone_weight: array of weights for AE statistics zones [0..15] |
| 307 | * @horiz_coord: the horizontal coordinate of points on the diagonal [0..2888] |
| 308 | * @vert_coord: the vertical coordinate of points on the diagonal [0..2240] |
| 309 | * @reserved: applications must zero this array |
| 310 | */ |
| 311 | struct c3_isp_params_ae_config { |
| 312 | 	struct c3_isp_params_block_header header; |
| 313 | 	__u8 tap_point; |
| 314 | 	__u8 horiz_zones_num; |
| 315 | 	__u8 vert_zones_num; |
| 316 | 	__u8 zone_weight[C3_ISP_AE_MAX_ZONES]; |
| 317 | 	__u16 horiz_coord[C3_ISP_AE_MAX_PT_NUM]; |
| 318 | 	__u16 vert_coord[C3_ISP_AE_MAX_PT_NUM]; |
| 319 | 	__u16 reserved[3]; |
| 320 | } __attribute__((aligned(8))); |
| 321 | |
| 322 | /** |
| 323 | * enum c3_isp_params_af_tap_points - Tap points for the AF statistics |
| 324 | * @C3_ISP_AF_STATS_TAP_SNR: immediately after the spatial noise reduce block |
| 325 | * @C3_ISP_AF_STATS_TAP_DMS: immediately after the demosaic block |
| 326 | */ |
| 327 | enum c3_isp_params_af_tap_points { |
| 328 | 	C3_ISP_AF_STATS_TAP_SNR = 0, |
| 329 | 	C3_ISP_AF_STATS_TAP_DMS, |
| 330 | }; |
| 331 | |
| 332 | /** |
| 333 | * struct c3_isp_params_af_config - Stats settings for auto-focus |
| 334 | * |
| 335 | * This struct allows the configuration of the statistics generated for |
| 336 | * auto focus. |
| 337 | * |
| 338 | * header.type should be set to C3_ISP_PARAMS_BLOCK_AF_CONFIG |
| 339 | * from :c:type:`c3_isp_params_block_type` |
| 340 | * |
| 341 | * @header: the C3 ISP parameters block header |
| 342 | * @tap_point: the tap point from enum c3_isp_params_af_tap_point |
| 343 | * @horiz_zones_num: active number of hotizontal zones [0..17] |
| 344 | * @vert_zones_num: active number of vertical zones [0..15] |
| 345 | * @reserved: applications must zero this array |
| 346 | * @horiz_coord: the horizontal coordinate of points on the diagonal [0..2888] |
| 347 | * @vert_coord: the vertical coordinate of points on the diagonal [0..2240] |
| 348 | */ |
| 349 | struct c3_isp_params_af_config { |
| 350 | 	struct c3_isp_params_block_header header; |
| 351 | 	__u8 tap_point; |
| 352 | 	__u8 horiz_zones_num; |
| 353 | 	__u8 vert_zones_num; |
| 354 | 	__u8 reserved[5]; |
| 355 | 	__u16 horiz_coord[C3_ISP_AF_MAX_PT_NUM]; |
| 356 | 	__u16 vert_coord[C3_ISP_AF_MAX_PT_NUM]; |
| 357 | } __attribute__((aligned(8))); |
| 358 | |
| 359 | /** |
| 360 | * struct c3_isp_params_pst_gamma - Post gamma configuration |
| 361 | * |
| 362 | * This struct allows the configuration of the look up table for |
| 363 | * post gamma. The gamma curve consists of 129 points, so need to |
| 364 | * set lut[129]. |
| 365 | * |
| 366 | * header.type should be set to C3_ISP_PARAMS_BLOCK_PST_GAMMA |
| 367 | * from :c:type:`c3_isp_params_block_type` |
| 368 | * |
| 369 | * @header: the C3 ISP parameters block header |
| 370 | * @lut: lookup table for P-Stitch gamma [0..1023] |
| 371 | * @reserved: applications must zero this array |
| 372 | */ |
| 373 | struct c3_isp_params_pst_gamma { |
| 374 | 	struct c3_isp_params_block_header header; |
| 375 | 	__u16 lut[129]; |
| 376 | 	__u16 reserved[3]; |
| 377 | } __attribute__((aligned(8))); |
| 378 | |
| 379 | /** |
| 380 | * struct c3_isp_params_ccm - ISP CCM configuration |
| 381 | * |
| 382 | * This struct allows the configuration of the matrix for |
| 383 | * color correction. The matrix consists of 3 x 3 points, |
| 384 | * so need to set matrix[3][3]. |
| 385 | * |
| 386 | * header.type should be set to C3_ISP_PARAMS_BLOCK_CCM |
| 387 | * from :c:type:`c3_isp_params_block_type` |
| 388 | * |
| 389 | * @header: the C3 ISP parameters block header |
| 390 | * @matrix: a 3 x 3 matrix used for color correction, |
| 391 | * the value of matrix[x][y] is orig_value x 256. [-4096..4095] |
| 392 | * @reserved: applications must zero this array |
| 393 | */ |
| 394 | struct c3_isp_params_ccm { |
| 395 | 	struct c3_isp_params_block_header header; |
| 396 | 	__s16 matrix[3][3]; |
| 397 | 	__u16 reserved[3]; |
| 398 | } __attribute__((aligned(8))); |
| 399 | |
| 400 | /** |
| 401 | * struct c3_isp_params_csc - ISP Color Space Conversion configuration |
| 402 | * |
| 403 | * This struct allows the configuration of the matrix for color space |
| 404 | * conversion. The matrix consists of 3 x 3 points, so need to set matrix[3][3]. |
| 405 | * |
| 406 | * header.type should be set to C3_ISP_PARAMS_BLOCK_CSC |
| 407 | * from :c:type:`c3_isp_params_block_type` |
| 408 | * |
| 409 | * @header: the C3 ISP parameters block header |
| 410 | * @matrix: a 3x3 matrix used for the color space conversion, |
| 411 | * the value of matrix[x][y] is orig_value x 256. [-4096..4095] |
| 412 | * @reserved: applications must zero this array |
| 413 | */ |
| 414 | struct c3_isp_params_csc { |
| 415 | 	struct c3_isp_params_block_header header; |
| 416 | 	__s16 matrix[3][3]; |
| 417 | 	__u16 reserved[3]; |
| 418 | } __attribute__((aligned(8))); |
| 419 | |
| 420 | /** |
| 421 | * struct c3_isp_params_blc - ISP Black Level Correction configuration |
| 422 | * |
| 423 | * This struct allows the configuration of the block level offset for each |
| 424 | * color channel. |
| 425 | * |
| 426 | * header.type should be set to C3_ISP_PARAMS_BLOCK_BLC |
| 427 | * from :c:type:`c3_isp_params_block_type` |
| 428 | * |
| 429 | * @header: the C3 ISP parameters block header |
| 430 | * @gr_ofst: Gr blc offset (Q4.12 format) |
| 431 | * @r_ofst: R blc offset (Q4.12 format) |
| 432 | * @b_ofst: B blc offset (Q4.12 format) |
| 433 | * @gb_ofst: Gb blc offset(Q4.12 format) |
| 434 | */ |
| 435 | struct c3_isp_params_blc { |
| 436 | 	struct c3_isp_params_block_header header; |
| 437 | 	__u16 gr_ofst; |
| 438 | 	__u16 r_ofst; |
| 439 | 	__u16 b_ofst; |
| 440 | 	__u16 gb_ofst; |
| 441 | }; |
| 442 | |
| 443 | /** |
| 444 | * define C3_ISP_PARAMS_MAX_SIZE - Maximum size of all C3 ISP Parameters |
| 445 | * |
| 446 | * Though the parameters for the C3 ISP are passed as optional blocks, the |
| 447 | * driver still needs to know the absolute maximum size so that it can allocate |
| 448 | * a buffer sized appropriately to accommodate userspace attempting to set all |
| 449 | * possible parameters in a single frame. |
| 450 | */ |
| 451 | #define C3_ISP_PARAMS_MAX_SIZE \ |
| 452 | 	(sizeof(struct c3_isp_params_awb_gains) + \ |
| 453 | 	 sizeof(struct c3_isp_params_awb_config) + \ |
| 454 | 	 sizeof(struct c3_isp_params_ae_config) + \ |
| 455 | 	 sizeof(struct c3_isp_params_af_config) + \ |
| 456 | 	 sizeof(struct c3_isp_params_pst_gamma) + \ |
| 457 | 	 sizeof(struct c3_isp_params_ccm) + \ |
| 458 | 	 sizeof(struct c3_isp_params_csc) + \ |
| 459 | 	 sizeof(struct c3_isp_params_blc)) |
| 460 | |
| 461 | /** |
| 462 | * struct c3_isp_params_cfg - C3 ISP configuration parameters |
| 463 | * |
| 464 | * This is the driver-specific implementation of |
| 465 | * :c:type:`v4l2_isp_params_buffer`. |
| 466 | * |
| 467 | * Currently only C3_ISP_PARAM_BUFFER_V0 is supported. |
| 468 | * |
| 469 | * The expected memory layout of the parameters buffer is:: |
| 470 | * |
| 471 | *	+-------------------- struct c3_isp_params_cfg ---- ------------------+ |
| 472 | *	| version = C3_ISP_PARAM_BUFFER_V0; | |
| 473 | *	| data_size = sizeof(struct c3_isp_params_awb_gains) + | |
| 474 | *	| sizeof(struct c3_isp_params_awb_config); | |
| 475 | *	| +------------------------- data ---------------------------------+ | |
| 476 | *	| | +------------ struct c3_isp_params_awb_gains) ------------------+ | |
| 477 | *	| | | +--------- struct c3_isp_params_block_header header -----+ | | | |
| 478 | *	| | | | type = C3_ISP_PARAMS_BLOCK_AWB_GAINS; | | | | |
| 479 | *	| | | | flags = C3_ISP_PARAMS_BLOCK_FL_NONE; | | | | |
| 480 | *	| | | | size = sizeof(struct c3_isp_params_awb_gains); | | | | |
| 481 | *	| | | +---------------------------------------------------------+ | | | |
| 482 | *	| | | gr_gain = ...; | | | |
| 483 | *	| | | r_gain = ...; | | | |
| 484 | *	| | | b_gain = ...; | | | |
| 485 | *	| | | gb_gain = ...; | | | |
| 486 | *	| | +------------------ struct c3_isp_params_awb_config ----------+ | | |
| 487 | *	| | | +---------- struct c3_isp_param_block_header header ------+ | | | |
| 488 | *	| | | | type = C3_ISP_PARAMS_BLOCK_AWB_CONFIG; | | | | |
| 489 | *	| | | | flags = C3_ISP_PARAMS_BLOCK_FL_NONE; | | | | |
| 490 | *	| | | | size = sizeof(struct c3_isp_params_awb_config) | | | | |
| 491 | *	| | | +---------------------------------------------------------+ | | | |
| 492 | *	| | | tap_point = ...; | | | |
| 493 | *	| | | satur_vald = ...; | | | |
| 494 | *	| | | horiz_zones_num = ...; | | | |
| 495 | *	| | | vert_zones_num = ...; | | | |
| 496 | *	| | +-------------------------------------------------------------+ | | |
| 497 | *	| +-----------------------------------------------------------------+ | |
| 498 | *	+---------------------------------------------------------------------+ |
| 499 | * |
| 500 | * @version: The C3 ISP parameters buffer version |
| 501 | * @data_size: The C3 ISP configuration data effective size, excluding this |
| 502 | * header |
| 503 | * @data: The C3 ISP configuration blocks data |
| 504 | */ |
| 505 | struct c3_isp_params_cfg { |
| 506 | 	__u32 version; |
| 507 | 	__u32 data_size; |
| 508 | 	__u8 data[C3_ISP_PARAMS_MAX_SIZE]; |
| 509 | }; |
| 510 | |
| 511 | |
| 512 | #endif |