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

Configure Feed

Select the types of activity you want to include in your feed.

media: uapi: Add parameters structs to mali-c55-config.h

Add structures describing the ISP parameters to mali-c55-config.h

Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Nayden Kanchev <nayden.kanchev@arm.com>
Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Daniel Scally and committed by
Hans Verkuil
08a99369 1ab3cb23

+598
+598
include/uapi/linux/media/arm/mali-c55-config.h
··· 10 10 11 11 #include <linux/types.h> 12 12 #include <linux/v4l2-controls.h> 13 + #include <linux/media/v4l2-isp.h> 13 14 14 15 #define V4L2_CID_MALI_C55_CAPABILITIES (V4L2_CID_USER_MALI_C55_BASE + 0x0) 15 16 #define MALI_C55_GPS_PONG (1U << 0) ··· 193 192 struct mali_c55_af_statistics af_statistics[MALI_C55_MAX_ZONES]; 194 193 __u32 reserved3[15]; 195 194 } __attribute__((packed)); 195 + 196 + /** 197 + * enum mali_c55_param_buffer_version - Mali-C55 parameters block versioning 198 + * 199 + * @MALI_C55_PARAM_BUFFER_V1: First version of Mali-C55 parameters block 200 + */ 201 + enum mali_c55_param_buffer_version { 202 + MALI_C55_PARAM_BUFFER_V1, 203 + }; 204 + 205 + /** 206 + * enum mali_c55_param_block_type - Enumeration of Mali-C55 parameter blocks 207 + * 208 + * This enumeration defines the types of Mali-C55 parameters block. Each block 209 + * configures a specific processing block of the Mali-C55 ISP. The block 210 + * type allows the driver to correctly interpret the parameters block data. 211 + * 212 + * It is the responsibility of userspace to correctly set the type of each 213 + * parameters block. 214 + * 215 + * @MALI_C55_PARAM_BLOCK_SENSOR_OFFS: Sensor pre-shading black level offset 216 + * @MALI_C55_PARAM_BLOCK_AEXP_HIST: Auto-exposure 1024-bin histogram 217 + * configuration 218 + * @MALI_C55_PARAM_BLOCK_AEXP_IHIST: Post-Iridix auto-exposure 1024-bin 219 + * histogram configuration 220 + * @MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS: Auto-exposure 1024-bin histogram 221 + * weighting 222 + * @MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS: Post-Iridix auto-exposure 1024-bin 223 + * histogram weighting 224 + * @MALI_C55_PARAM_BLOCK_DIGITAL_GAIN: Digital gain 225 + * @MALI_C55_PARAM_BLOCK_AWB_GAINS: Auto-white balance gains 226 + * @MALI_C55_PARAM_BLOCK_AWB_CONFIG: Auto-white balance statistics config 227 + * @MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP: Auto-white balance gains for AEXP-0 tap 228 + * @MALI_C55_PARAM_MESH_SHADING_CONFIG : Mesh shading tables configuration 229 + * @MALI_C55_PARAM_MESH_SHADING_SELECTION: Mesh shading table selection 230 + */ 231 + enum mali_c55_param_block_type { 232 + MALI_C55_PARAM_BLOCK_SENSOR_OFFS, 233 + MALI_C55_PARAM_BLOCK_AEXP_HIST, 234 + MALI_C55_PARAM_BLOCK_AEXP_IHIST, 235 + MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS, 236 + MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS, 237 + MALI_C55_PARAM_BLOCK_DIGITAL_GAIN, 238 + MALI_C55_PARAM_BLOCK_AWB_GAINS, 239 + MALI_C55_PARAM_BLOCK_AWB_CONFIG, 240 + MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP, 241 + MALI_C55_PARAM_MESH_SHADING_CONFIG, 242 + MALI_C55_PARAM_MESH_SHADING_SELECTION, 243 + }; 244 + 245 + /** 246 + * struct mali_c55_params_sensor_off_preshading - offset subtraction for each 247 + * color channel 248 + * 249 + * Provides removal of the sensor black level from the sensor data. Separate 250 + * offsets are provided for each of the four Bayer component color channels 251 + * which are defaulted to R, Gr, Gb, B. 252 + * 253 + * header.type should be set to MALI_C55_PARAM_BLOCK_SENSOR_OFFS from 254 + * :c:type:`mali_c55_param_block_type` for this block. 255 + * 256 + * @header: The Mali-C55 parameters block header 257 + * @chan00: Offset for color channel 00 (default: R) 258 + * @chan01: Offset for color channel 01 (default: Gr) 259 + * @chan10: Offset for color channel 10 (default: Gb) 260 + * @chan11: Offset for color channel 11 (default: B) 261 + */ 262 + struct mali_c55_params_sensor_off_preshading { 263 + struct v4l2_isp_params_block_header header; 264 + __u32 chan00; 265 + __u32 chan01; 266 + __u32 chan10; 267 + __u32 chan11; 268 + }; 269 + 270 + /** 271 + * enum mali_c55_aexp_hist_tap_points - Tap points for the AEXP histogram 272 + * @MALI_C55_AEXP_HIST_TAP_WB: After static white balance 273 + * @MALI_C55_AEXP_HIST_TAP_FS: After WDR Frame Stitch 274 + * @MALI_C55_AEXP_HIST_TAP_TPG: After the test pattern generator 275 + */ 276 + enum mali_c55_aexp_hist_tap_points { 277 + MALI_C55_AEXP_HIST_TAP_WB = 0, 278 + MALI_C55_AEXP_HIST_TAP_FS, 279 + MALI_C55_AEXP_HIST_TAP_TPG, 280 + }; 281 + 282 + /** 283 + * enum mali_c55_aexp_skip_x - Horizontal pixel skipping 284 + * @MALI_C55_AEXP_SKIP_X_EVERY_2ND: Collect every 2nd pixel horizontally 285 + * @MALI_C55_AEXP_SKIP_X_EVERY_3RD: Collect every 3rd pixel horizontally 286 + * @MALI_C55_AEXP_SKIP_X_EVERY_4TH: Collect every 4th pixel horizontally 287 + * @MALI_C55_AEXP_SKIP_X_EVERY_5TH: Collect every 5th pixel horizontally 288 + * @MALI_C55_AEXP_SKIP_X_EVERY_8TH: Collect every 8th pixel horizontally 289 + * @MALI_C55_AEXP_SKIP_X_EVERY_9TH: Collect every 9th pixel horizontally 290 + */ 291 + enum mali_c55_aexp_skip_x { 292 + MALI_C55_AEXP_SKIP_X_EVERY_2ND, 293 + MALI_C55_AEXP_SKIP_X_EVERY_3RD, 294 + MALI_C55_AEXP_SKIP_X_EVERY_4TH, 295 + MALI_C55_AEXP_SKIP_X_EVERY_5TH, 296 + MALI_C55_AEXP_SKIP_X_EVERY_8TH, 297 + MALI_C55_AEXP_SKIP_X_EVERY_9TH 298 + }; 299 + 300 + /** 301 + * enum mali_c55_aexp_skip_y - Vertical pixel skipping 302 + * @MALI_C55_AEXP_SKIP_Y_ALL: Collect every single pixel vertically 303 + * @MALI_C55_AEXP_SKIP_Y_EVERY_2ND: Collect every 2nd pixel vertically 304 + * @MALI_C55_AEXP_SKIP_Y_EVERY_3RD: Collect every 3rd pixel vertically 305 + * @MALI_C55_AEXP_SKIP_Y_EVERY_4TH: Collect every 4th pixel vertically 306 + * @MALI_C55_AEXP_SKIP_Y_EVERY_5TH: Collect every 5th pixel vertically 307 + * @MALI_C55_AEXP_SKIP_Y_EVERY_8TH: Collect every 8th pixel vertically 308 + * @MALI_C55_AEXP_SKIP_Y_EVERY_9TH: Collect every 9th pixel vertically 309 + */ 310 + enum mali_c55_aexp_skip_y { 311 + MALI_C55_AEXP_SKIP_Y_ALL, 312 + MALI_C55_AEXP_SKIP_Y_EVERY_2ND, 313 + MALI_C55_AEXP_SKIP_Y_EVERY_3RD, 314 + MALI_C55_AEXP_SKIP_Y_EVERY_4TH, 315 + MALI_C55_AEXP_SKIP_Y_EVERY_5TH, 316 + MALI_C55_AEXP_SKIP_Y_EVERY_8TH, 317 + MALI_C55_AEXP_SKIP_Y_EVERY_9TH 318 + }; 319 + 320 + /** 321 + * enum mali_c55_aexp_row_column_offset - Start from the first or second row or 322 + * column 323 + * @MALI_C55_AEXP_FIRST_ROW_OR_COL: Start from the first row / column 324 + * @MALI_C55_AEXP_SECOND_ROW_OR_COL: Start from the second row / column 325 + */ 326 + enum mali_c55_aexp_row_column_offset { 327 + MALI_C55_AEXP_FIRST_ROW_OR_COL = 1, 328 + MALI_C55_AEXP_SECOND_ROW_OR_COL = 2, 329 + }; 330 + 331 + /** 332 + * enum mali_c55_aexp_hist_plane_mode - Mode for the AEXP Histograms 333 + * @MALI_C55_AEXP_HIST_COMBINED: All color planes in one 1024-bin histogram 334 + * @MALI_C55_AEXP_HIST_SEPARATE: Each color plane in one 256-bin histogram with a bin width of 16 335 + * @MALI_C55_AEXP_HIST_FOCUS_00: Top left plane in the first bank, rest in second bank 336 + * @MALI_C55_AEXP_HIST_FOCUS_01: Top right plane in the first bank, rest in second bank 337 + * @MALI_C55_AEXP_HIST_FOCUS_10: Bottom left plane in the first bank, rest in second bank 338 + * @MALI_C55_AEXP_HIST_FOCUS_11: Bottom right plane in the first bank, rest in second bank 339 + * 340 + * In the "focus" modes statistics are collected into two 512-bin histograms 341 + * with a bin width of 8. One colour plane is in the first histogram with the 342 + * remainder combined into the second. The four options represent which of the 343 + * four positions in a bayer pattern are the focused plane. 344 + */ 345 + enum mali_c55_aexp_hist_plane_mode { 346 + MALI_C55_AEXP_HIST_COMBINED = 0, 347 + MALI_C55_AEXP_HIST_SEPARATE = 1, 348 + MALI_C55_AEXP_HIST_FOCUS_00 = 4, 349 + MALI_C55_AEXP_HIST_FOCUS_01 = 5, 350 + MALI_C55_AEXP_HIST_FOCUS_10 = 6, 351 + MALI_C55_AEXP_HIST_FOCUS_11 = 7, 352 + }; 353 + 354 + /** 355 + * struct mali_c55_params_aexp_hist - configuration for AEXP metering hists 356 + * 357 + * This struct allows users to configure the 1024-bin AEXP histograms. Broadly 358 + * speaking the parameters allow you to mask particular regions of the image and 359 + * to select different kinds of histogram. 360 + * 361 + * The skip_x, offset_x, skip_y and offset_y fields allow users to ignore or 362 + * mask pixels in the frame by their position relative to the top left pixel. 363 + * First, the skip_y, offset_x and offset_y fields define which of the pixels 364 + * within each 2x2 region will be counted in the statistics. 365 + * 366 + * If skip_y == 0 then two pixels from each covered region will be counted. If 367 + * both offset_x and offset_y are zero, then the two left-most pixels in each 368 + * 2x2 pixel region will be counted. Setting offset_x = 1 will discount the top 369 + * left pixel and count the top right pixel. Setting offset_y = 1 will discount 370 + * the bottom left pixel and count the bottom right pixel. 371 + * 372 + * If skip_y != 0 then only a single pixel from each region covered by the 373 + * pattern will be counted. In this case offset_x controls whether the pixel 374 + * that's counted is in the left (if offset_x == 0) or right (if offset_x == 1) 375 + * column and offset_y controls whether the pixel that's counted is in the top 376 + * (if offset_y == 0) or bottom (if offset_y == 1) row. 377 + * 378 + * The skip_x and skip_y fields control how the 2x2 pixel region is repeated 379 + * across the image data. The first instance of the region is always in the top 380 + * left of the image data. The skip_x field controls how many pixels are ignored 381 + * in the x direction before the pixel masking region is repeated. The skip_y 382 + * field controls how many pixels are ignored in the y direction before the 383 + * pixel masking region is repeated. 384 + * 385 + * These fields can be used to reduce the number of pixels counted for the 386 + * statistics, but it's important to be careful to configure them correctly. 387 + * Some combinations of values will result in colour components from the input 388 + * data being ignored entirely, for example in the following configuration: 389 + * 390 + * skip_x = 0 391 + * offset_x = 0 392 + * skip_y = 0 393 + * offset_y = 0 394 + * 395 + * Only the R and Gb components of RGGB data that was input would be collected. 396 + * Similarly in the following configuration: 397 + * 398 + * skip_x = 0 399 + * offset_x = 0 400 + * skip_y = 1 401 + * offset_y = 1 402 + * 403 + * Only the Gb component of RGGB data that was input would be collected. To 404 + * correct things such that all 4 colour components were included it would be 405 + * necessary to set the skip_x and skip_y fields in a way that resulted in all 406 + * four colour components being collected: 407 + * 408 + * skip_x = 1 409 + * offset_x = 0 410 + * skip_y = 1 411 + * offset_y = 1 412 + * 413 + * header.type should be set to one of either MALI_C55_PARAM_BLOCK_AEXP_HIST or 414 + * MALI_C55_PARAM_BLOCK_AEXP_IHIST from :c:type:`mali_c55_param_block_type`. 415 + * 416 + * @header: The Mali-C55 parameters block header 417 + * @skip_x: Horizontal decimation. See enum mali_c55_aexp_skip_x 418 + * @offset_x: Skip the first column, or not. See enum mali_c55_aexp_row_column_offset 419 + * @skip_y: Vertical decimation. See enum mali_c55_aexp_skip_y 420 + * @offset_y: Skip the first row, or not. See enum mali_c55_aexp_row_column_offset 421 + * @scale_bottom: Scale pixels in bottom half of intensity range: 0=1x ,1=2x, 2=4x, 4=8x, 4=16x 422 + * @scale_top: scale pixels in top half of intensity range: 0=1x ,1=2x, 2=4x, 4=8x, 4=16x 423 + * @plane_mode: Plane separation mode. See enum mali_c55_aexp_hist_plane_mode 424 + * @tap_point: Tap point for histogram from enum mali_c55_aexp_hist_tap_points. 425 + * This parameter is unused for the post-Iridix Histogram 426 + */ 427 + struct mali_c55_params_aexp_hist { 428 + struct v4l2_isp_params_block_header header; 429 + __u8 skip_x; 430 + __u8 offset_x; 431 + __u8 skip_y; 432 + __u8 offset_y; 433 + __u8 scale_bottom; 434 + __u8 scale_top; 435 + __u8 plane_mode; 436 + __u8 tap_point; 437 + }; 438 + 439 + /** 440 + * struct mali_c55_params_aexp_weights - Array of weights for AEXP metering 441 + * 442 + * This struct allows users to configure the weighting for both of the 1024-bin 443 + * AEXP histograms. The pixel data collected for each zone is multiplied by the 444 + * corresponding weight from this array, which may be zero if the intention is 445 + * to mask off the zone entirely. 446 + * 447 + * header.type should be set to one of either MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS 448 + * or MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS from :c:type:`mali_c55_param_block_type`. 449 + * 450 + * @header: The Mali-C55 parameters block header 451 + * @nodes_used_horiz: Number of active zones horizontally [0..15] 452 + * @nodes_used_vert: Number of active zones vertically [0..15] 453 + * @zone_weights: Zone weighting. Index is row*col where 0,0 is the top 454 + * left zone continuing in raster order. Each zone can be 455 + * weighted in the range [0..15]. The number of rows and 456 + * columns is defined by @nodes_used_vert and 457 + * @nodes_used_horiz 458 + */ 459 + struct mali_c55_params_aexp_weights { 460 + struct v4l2_isp_params_block_header header; 461 + __u8 nodes_used_horiz; 462 + __u8 nodes_used_vert; 463 + __u8 zone_weights[MALI_C55_MAX_ZONES]; 464 + }; 465 + 466 + /** 467 + * struct mali_c55_params_digital_gain - Digital gain value 468 + * 469 + * This struct carries a digital gain value to set in the ISP. 470 + * 471 + * header.type should be set to MALI_C55_PARAM_BLOCK_DIGITAL_GAIN from 472 + * :c:type:`mali_c55_param_block_type` for this block. 473 + * 474 + * @header: The Mali-C55 parameters block header 475 + * @gain: The digital gain value to apply, in Q5.8 format. 476 + */ 477 + struct mali_c55_params_digital_gain { 478 + struct v4l2_isp_params_block_header header; 479 + __u16 gain; 480 + }; 481 + 482 + /** 483 + * enum mali_c55_awb_stats_mode - Statistics mode for AWB 484 + * @MALI_C55_AWB_MODE_GRBR: Statistics collected as Green/Red and Blue/Red ratios 485 + * @MALI_C55_AWB_MODE_RGBG: Statistics collected as Red/Green and Blue/Green ratios 486 + */ 487 + enum mali_c55_awb_stats_mode { 488 + MALI_C55_AWB_MODE_GRBR = 0, 489 + MALI_C55_AWB_MODE_RGBG, 490 + }; 491 + 492 + /** 493 + * struct mali_c55_params_awb_gains - Gain settings for auto white balance 494 + * 495 + * This struct allows users to configure the gains for auto-white balance. There 496 + * are four gain settings corresponding to each colour channel in the bayer 497 + * domain. Although named generically, the association between the gain applied 498 + * and the colour channel is done automatically within the ISP depending on the 499 + * input format, and so the following mapping always holds true:: 500 + * 501 + * gain00 = R 502 + * gain01 = Gr 503 + * gain10 = Gb 504 + * gain11 = B 505 + * 506 + * All of the gains are stored in Q4.8 format. 507 + * 508 + * header.type should be set to one of either MALI_C55_PARAM_BLOCK_AWB_GAINS or 509 + * MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP from :c:type:`mali_c55_param_block_type`. 510 + * 511 + * @header: The Mali-C55 parameters block header 512 + * @gain00: Multiplier for colour channel 00 513 + * @gain01: Multiplier for colour channel 01 514 + * @gain10: Multiplier for colour channel 10 515 + * @gain11: Multiplier for colour channel 11 516 + */ 517 + struct mali_c55_params_awb_gains { 518 + struct v4l2_isp_params_block_header header; 519 + __u16 gain00; 520 + __u16 gain01; 521 + __u16 gain10; 522 + __u16 gain11; 523 + }; 524 + 525 + /** 526 + * enum mali_c55_params_awb_tap_points - Tap points for the AWB statistics 527 + * @MALI_C55_AWB_STATS_TAP_PF: Immediately after the Purple Fringe block 528 + * @MALI_C55_AWB_STATS_TAP_CNR: Immediately after the CNR block 529 + */ 530 + enum mali_c55_params_awb_tap_points { 531 + MALI_C55_AWB_STATS_TAP_PF = 0, 532 + MALI_C55_AWB_STATS_TAP_CNR, 533 + }; 534 + 535 + /** 536 + * struct mali_c55_params_awb_config - Stats settings for auto-white balance 537 + * 538 + * This struct allows the configuration of the statistics generated for auto 539 + * white balance. Pixel intensity limits can be set to exclude overly bright or 540 + * dark regions of an image from the statistics entirely. Colour ratio minima 541 + * and maxima can be set to discount pixels who's ratios fall outside the 542 + * defined boundaries; there are two sets of registers to do this - the 543 + * "min/max" ratios which bound a region and the "high/low" ratios which further 544 + * trim the upper and lower ratios. For example with the boundaries configured 545 + * as follows, only pixels whos colour ratios falls into the region marked "A" 546 + * would be counted:: 547 + * 548 + * cr_high 549 + * 2.0 | | 550 + * | cb_max --> _________________________v_____ 551 + * 1.8 | | \ | 552 + * | | \ | 553 + * 1.6 | | \ | 554 + * | | \ | 555 + * c 1.4 | cb_low -->|\ A \|<-- cb_high 556 + * b | | \ | 557 + * 1.2 | | \ | 558 + * r | | \ | 559 + * a 1.0 | cb_min --> |____\_________________________| 560 + * t | ^ ^ ^ 561 + * i 0.8 | | | | 562 + * o | cr_min | cr_max 563 + * s 0.6 | | 564 + * | cr_low 565 + * 0.4 | 566 + * | 567 + * 0.2 | 568 + * | 569 + * 0.0 |_______________________________________________________________ 570 + * 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 571 + * cr ratios 572 + * 573 + * header.type should be set to MALI_C55_PARAM_BLOCK_AWB_CONFIG from 574 + * :c:type:`mali_c55_param_block_type` for this block. 575 + * 576 + * @header: The Mali-C55 parameters block header 577 + * @tap_point: The tap point from enum mali_c55_params_awb_tap_points 578 + * @stats_mode: AWB statistics collection mode, see :c:type:`mali_c55_awb_stats_mode` 579 + * @white_level: Upper pixel intensity (I.E. raw pixel values) limit 580 + * @black_level: Lower pixel intensity (I.E. raw pixel values) limit 581 + * @cr_max: Maximum R/G ratio (Q4.8 format) 582 + * @cr_min: Minimum R/G ratio (Q4.8 format) 583 + * @cb_max: Maximum B/G ratio (Q4.8 format) 584 + * @cb_min: Minimum B/G ratio (Q4.8 format) 585 + * @nodes_used_horiz: Number of active zones horizontally [0..15] 586 + * @nodes_used_vert: Number of active zones vertically [0..15] 587 + * @cr_high: R/G ratio trim high (Q4.8 format) 588 + * @cr_low: R/G ratio trim low (Q4.8 format) 589 + * @cb_high: B/G ratio trim high (Q4.8 format) 590 + * @cb_low: B/G ratio trim low (Q4.8 format) 591 + */ 592 + struct mali_c55_params_awb_config { 593 + struct v4l2_isp_params_block_header header; 594 + __u8 tap_point; 595 + __u8 stats_mode; 596 + __u16 white_level; 597 + __u16 black_level; 598 + __u16 cr_max; 599 + __u16 cr_min; 600 + __u16 cb_max; 601 + __u16 cb_min; 602 + __u8 nodes_used_horiz; 603 + __u8 nodes_used_vert; 604 + __u16 cr_high; 605 + __u16 cr_low; 606 + __u16 cb_high; 607 + __u16 cb_low; 608 + }; 609 + 610 + #define MALI_C55_NUM_MESH_SHADING_ELEMENTS 3072 611 + 612 + /** 613 + * struct mali_c55_params_mesh_shading_config - Mesh shading configuration 614 + * 615 + * The mesh shading correction module allows programming a separate table of 616 + * either 16x16 or 32x32 node coefficients for 3 different light sources. The 617 + * final correction coefficients applied are computed by blending the 618 + * coefficients from two tables together. 619 + * 620 + * A page of 1024 32-bit integers is associated to each colour channel, with 621 + * pages stored consecutively in memory. Each 32-bit integer packs 3 8-bit 622 + * correction coefficients for a single node, one for each of the three light 623 + * sources. The 8 most significant bits are unused. The following table 624 + * describes the layout:: 625 + * 626 + * +----------- Page (Colour Plane) 0 -------------+ 627 + * | @mesh[i] | Mesh Point | Bits | Light Source | 628 + * +-----------+------------+-------+--------------+ 629 + * | 0 | 0,0 | 16,23 | LS2 | 630 + * | | | 08-15 | LS1 | 631 + * | | | 00-07 | LS0 | 632 + * +-----------+------------+-------+--------------+ 633 + * | 1 | 0,1 | 16,23 | LS2 | 634 + * | | | 08-15 | LS1 | 635 + * | | | 00-07 | LS0 | 636 + * +-----------+------------+-------+--------------+ 637 + * | ... | ... | ... | ... | 638 + * +-----------+------------+-------+--------------+ 639 + * | 1023 | 31,31 | 16,23 | LS2 | 640 + * | | | 08-15 | LS1 | 641 + * | | | 00-07 | LS0 | 642 + * +----------- Page (Colour Plane) 1 -------------+ 643 + * | @mesh[i] | Mesh Point | Bits | Light Source | 644 + * +-----------+------------+-------+--------------+ 645 + * | 1024 | 0,0 | 16,23 | LS2 | 646 + * | | | 08-15 | LS1 | 647 + * | | | 00-07 | LS0 | 648 + * +-----------+------------+-------+--------------+ 649 + * | 1025 | 0,1 | 16,23 | LS2 | 650 + * | | | 08-15 | LS1 | 651 + * | | | 00-07 | LS0 | 652 + * +-----------+------------+-------+--------------+ 653 + * | ... | ... | ... | ... | 654 + * +-----------+------------+-------+--------------+ 655 + * | 2047 | 31,31 | 16,23 | LS2 | 656 + * | | | 08-15 | LS1 | 657 + * | | | 00-07 | LS0 | 658 + * +----------- Page (Colour Plane) 2 -------------+ 659 + * | @mesh[i] | Mesh Point | Bits | Light Source | 660 + * +-----------+------------+-------+--------------+ 661 + * | 2048 | 0,0 | 16,23 | LS2 | 662 + * | | | 08-15 | LS1 | 663 + * | | | 00-07 | LS0 | 664 + * +-----------+------------+-------+--------------+ 665 + * | 2049 | 0,1 | 16,23 | LS2 | 666 + * | | | 08-15 | LS1 | 667 + * | | | 00-07 | LS0 | 668 + * +-----------+------------+-------+--------------+ 669 + * | ... | ... | ... | ... | 670 + * +-----------+------------+-------+--------------+ 671 + * | 3071 | 31,31 | 16,23 | LS2 | 672 + * | | | 08-15 | LS1 | 673 + * | | | 00-07 | LS0 | 674 + * +-----------+------------+-------+--------------+ 675 + * 676 + * The @mesh_scale member determines the precision and minimum and maximum gain. 677 + * For example if @mesh_scale is 0 and therefore selects 0 - 2x gain, a value of 678 + * 0 in a coefficient means 0.0 gain, a value of 128 means 1.0 gain and 255 679 + * means 2.0 gain. 680 + * 681 + * header.type should be set to MALI_C55_PARAM_MESH_SHADING_CONFIG from 682 + * :c:type:`mali_c55_param_block_type` for this block. 683 + * 684 + * @header: The Mali-C55 parameters block header 685 + * @mesh_show: Output the mesh data rather than image data 686 + * @mesh_scale: Set the precision and maximum gain range of mesh shading 687 + * - 0 = 0-2x gain 688 + * - 1 = 0-4x gain 689 + * - 2 = 0-8x gain 690 + * - 3 = 0-16x gain 691 + * - 4 = 1-2x gain 692 + * - 5 = 1-3x gain 693 + * - 6 = 1-5x gain 694 + * - 7 = 1-9x gain 695 + * @mesh_page_r: Mesh page select for red colour plane [0..2] 696 + * @mesh_page_g: Mesh page select for green colour plane [0..2] 697 + * @mesh_page_b: Mesh page select for blue colour plane [0..2] 698 + * @mesh_width: Number of horizontal nodes minus 1 [15,31] 699 + * @mesh_height: Number of vertical nodes minus 1 [15,31] 700 + * @mesh: Mesh shading correction tables 701 + */ 702 + struct mali_c55_params_mesh_shading_config { 703 + struct v4l2_isp_params_block_header header; 704 + __u8 mesh_show; 705 + __u8 mesh_scale; 706 + __u8 mesh_page_r; 707 + __u8 mesh_page_g; 708 + __u8 mesh_page_b; 709 + __u8 mesh_width; 710 + __u8 mesh_height; 711 + __u32 mesh[MALI_C55_NUM_MESH_SHADING_ELEMENTS]; 712 + }; 713 + 714 + /** enum mali_c55_params_mesh_alpha_bank - Mesh shading table bank selection 715 + * @MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS1 - Select Light Sources 0 and 1 716 + * @MALI_C55_MESH_ALPHA_BANK_LS1_AND_LS2 - Select Light Sources 1 and 2 717 + * @MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS2 - Select Light Sources 0 and 2 718 + */ 719 + enum mali_c55_params_mesh_alpha_bank { 720 + MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS1 = 0, 721 + MALI_C55_MESH_ALPHA_BANK_LS1_AND_LS2 = 1, 722 + MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS2 = 4 723 + }; 724 + 725 + /** 726 + * struct mali_c55_params_mesh_shading_selection - Mesh table selection 727 + * 728 + * The module computes the final correction coefficients by blending the ones 729 + * from two light source tables, which are selected (independently for each 730 + * colour channel) by the @mesh_alpha_bank_r/g/b fields. 731 + * 732 + * The final blended coefficients for each node are calculated using the 733 + * following equation: 734 + * 735 + * Final coefficient = (a * LS\ :sub:`b`\ + (256 - a) * LS\ :sub:`a`\) / 256 736 + * 737 + * Where a is the @mesh_alpha_r/g/b value, and LS\ :sub:`a`\ and LS\ :sub:`b`\ 738 + * are the node cofficients for the two tables selected by the 739 + * @mesh_alpha_bank_r/g/b value. 740 + * 741 + * The scale of the applied correction may also be controlled by tuning the 742 + * @mesh_strength member. This is a modifier to the final coefficients which can 743 + * be used to globally reduce the gains applied. 744 + * 745 + * header.type should be set to MALI_C55_PARAM_MESH_SHADING_SELECTION from 746 + * :c:type:`mali_c55_param_block_type` for this block. 747 + * 748 + * @header: The Mali-C55 parameters block header 749 + * @mesh_alpha_bank_r: Red mesh table select (c:type:`enum mali_c55_params_mesh_alpha_bank`) 750 + * @mesh_alpha_bank_g: Green mesh table select (c:type:`enum mali_c55_params_mesh_alpha_bank`) 751 + * @mesh_alpha_bank_b: Blue mesh table select (c:type:`enum mali_c55_params_mesh_alpha_bank`) 752 + * @mesh_alpha_r: Blend coefficient for R [0..255] 753 + * @mesh_alpha_g: Blend coefficient for G [0..255] 754 + * @mesh_alpha_b: Blend coefficient for B [0..255] 755 + * @mesh_strength: Mesh strength in Q4.12 format [0..4096] 756 + */ 757 + struct mali_c55_params_mesh_shading_selection { 758 + struct v4l2_isp_params_block_header header; 759 + __u8 mesh_alpha_bank_r; 760 + __u8 mesh_alpha_bank_g; 761 + __u8 mesh_alpha_bank_b; 762 + __u8 mesh_alpha_r; 763 + __u8 mesh_alpha_g; 764 + __u8 mesh_alpha_b; 765 + __u16 mesh_strength; 766 + }; 767 + 768 + /** 769 + * define MALI_C55_PARAMS_MAX_SIZE - Maximum size of all Mali C55 Parameters 770 + * 771 + * Though the parameters for the Mali-C55 are passed as optional blocks, the 772 + * driver still needs to know the absolute maximum size so that it can allocate 773 + * a buffer sized appropriately to accommodate userspace attempting to set all 774 + * possible parameters in a single frame. 775 + * 776 + * Some structs are in this list multiple times. Where that's the case, it just 777 + * reflects the fact that the same struct can be used with multiple different 778 + * header types from :c:type:`mali_c55_param_block_type`. 779 + */ 780 + #define MALI_C55_PARAMS_MAX_SIZE \ 781 + (sizeof(struct mali_c55_params_sensor_off_preshading) + \ 782 + sizeof(struct mali_c55_params_aexp_hist) + \ 783 + sizeof(struct mali_c55_params_aexp_weights) + \ 784 + sizeof(struct mali_c55_params_aexp_hist) + \ 785 + sizeof(struct mali_c55_params_aexp_weights) + \ 786 + sizeof(struct mali_c55_params_digital_gain) + \ 787 + sizeof(struct mali_c55_params_awb_gains) + \ 788 + sizeof(struct mali_c55_params_awb_config) + \ 789 + sizeof(struct mali_c55_params_awb_gains) + \ 790 + sizeof(struct mali_c55_params_mesh_shading_config) + \ 791 + sizeof(struct mali_c55_params_mesh_shading_selection)) 196 792 197 793 #endif /* __UAPI_MALI_C55_CONFIG_H */