[{"id":31654,"web_url":"https://patchwork.libcamera.org/comment/31654/","msgid":"<172848708501.532453.2512160569905119356@ping.linuxembedded.co.uk>","date":"2024-10-09T15:18:05","subject":"Re: [PATCH v2 01/10] include: linux: Add mali-c55-config.h","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Daniel Scally (2024-07-09 15:49:41)\n> Add the header file describing the Mali C55's 3A statistics and\n> parameters structures so that they can be used by the new IPA module.\n> \n> The header has been taken from the v6 of the patchset for the Mali\n> C55 ISP driver submitted to linux-media, found at the link below:\n> \n> https://lore.kernel.org/linux-media/20240709132906.3198927-1-dan.scally@ideasonboard.com/\n> \n> Acked-by: Nayden Kanchev  <nayden.kanchev@arm.com>\n> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  include/linux/mali-c55-config.h | 945 ++++++++++++++++++++++++++++++++\n>  1 file changed, 945 insertions(+)\n>  create mode 100644 include/linux/mali-c55-config.h\n> \n> diff --git a/include/linux/mali-c55-config.h b/include/linux/mali-c55-config.h\n> new file mode 100644\n> index 00000000..ea9872e9\n> --- /dev/null\n> +++ b/include/linux/mali-c55-config.h\n\nI understand that this isn't yet available to merge from the kernel, so\nwe can't update the kernel script.\n\nSo given we'll do that when it's merged...\n\n\nAcked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> @@ -0,0 +1,945 @@\n> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */\n> +/*\n> + * ARM Mali-C55 ISP Driver - Userspace API\n> + *\n> + * Copyright (C) 2023 Ideas on Board Oy\n> + */\n> +\n> +#ifndef __UAPI_MALI_C55_CONFIG_H\n> +#define __UAPI_MALI_C55_CONFIG_H\n> +\n> +#include <linux/types.h>\n> +\n> +/*\n> + * Frames are split into zones of almost equal width and height - a zone is a\n> + * rectangular tile of a frame. The metering blocks within the ISP collect\n> + * aggregated statistics per zone. A maximum of 15x15 zones can be configured,\n> + * and so the statistics buffer within the hardware is sized to accommodate\n> + * that.\n> + *\n> + * The utilised number of zones is runtime configurable.\n> + */\n> +#define MALI_C55_MAX_ZONES     (15 * 15)\n> +\n> +/**\n> + * struct mali_c55_ae_1024bin_hist - Auto Exposure 1024-bin histogram statistics\n> + *\n> + * @bins:      1024 element array of 16-bit pixel counts.\n> + *\n> + * The 1024-bin histogram module collects image-global but zone-weighted\n> + * intensity distributions of pixels in fixed-width bins. The modules can be\n> + * configured into different \"plane modes\" which affect the contents of the\n> + * collected statistics. In plane mode 0, pixel intensities are taken regardless\n> + * of colour plane into a single 1024-bin histogram with a bin width of 4. In\n> + * plane mode 1, four 256-bin histograms with a bin width of 16 are collected -\n> + * one for each CFA colour plane. In plane modes 4, 5, 6 and 7 two 512-bin\n> + * histograms with a bin width of 8 are collected - in each mode one of the\n> + * colour planes is collected into the first histogram and all the others are\n> + * combined into the second. The histograms are stored consecutively in the bins\n> + * array.\n> + *\n> + * The 16-bit pixel counts are stored as a 4-bit exponent in the most\n> + * significant bits followed by a 12-bit mantissa. Conversion to a usable\n> + * format can be done according to the following pseudo-code::\n> + *\n> + *     if (e == 0) {\n> + *             bin = m * 2;\n> + *     } else {\n> + *             bin = (m + 4096) * 2^e\n> + *     }\n> + *\n> + * where\n> + *     e is the exponent value in range 0..15\n> + *     m is the mantissa value in range 0..4095\n> + *\n> + * The pixels used in calculating the statistics can be masked using three\n> + * methods:\n> + *\n> + * 1. Pixels can be skipped in X and Y directions independently.\n> + * 2. Minimum/Maximum intensities can be configured\n> + * 3. Zones can be differentially weighted, including 0 weighted to mask them\n> + *\n> + * The data for this histogram can be collected from different tap points in the\n> + * ISP depending on configuration - after the white balance or digital gain\n> + * blocks, or immediately after the input crossbar.\n> + */\n> +struct mali_c55_ae_1024bin_hist {\n> +       __u16 bins[1024];\n> +} __attribute__((packed));\n> +\n> +/**\n> + * struct mali_c55_ae_5bin_hist - Auto Exposure 5-bin histogram statistics\n> + *\n> + * @hist0:     16-bit normalised pixel count for the 0th intensity bin\n> + * @hist1:     16-bit normalised pixel count for the 1st intensity bin\n> + * @hist3:     16-bit normalised pixel count for the 3rd intensity bin\n> + * @hist4:     16-bit normalised pixel count for the 4th intensity bin\n> + *\n> + * The ISP generates a 5-bin histogram of normalised pixel counts within bins of\n> + * pixel intensity for each of 225 possible zones within a frame. The centre bin\n> + * of the histogram for each zone is not available from the hardware and must be\n> + * calculated by subtracting the values of hist0, hist1, hist3 and hist4 from\n> + * 0xffff as in the following equation:\n> + *\n> + *     hist2 = 0xffff - (hist0 + hist1 + hist3 + hist4)\n> + */\n> +struct mali_c55_ae_5bin_hist {\n> +       __u16 hist0;\n> +       __u16 hist1;\n> +       __u16 hist3;\n> +       __u16 hist4;\n> +} __attribute__((packed));\n> +\n> +/**\n> + * struct mali_c55_awb_average_ratios - Auto White Balance colour ratios\n> + *\n> + * @avg_rg_gr: Average R/G or G/R ratio in Q4.8 format.\n> + * @avg_bg_br: Average B/G or B/R ratio in Q4.8 format.\n> + * @num_pixels:        The number of pixels used in the AWB calculation\n> + *\n> + * The ISP calculates and collects average colour ratios for each zone in an\n> + * image and stores them in Q4.8 format (the lowest 8 bits are fractional, with\n> + * bits [11:8] representing the integer). The exact ratios collected (either\n> + * R/G, B/G or G/R, B/R) are configurable through the parameters buffer. The\n> + * value of the 4 high bits is undefined.\n> + */\n> +struct mali_c55_awb_average_ratios {\n> +       __u16 avg_rg_gr;\n> +       __u16 avg_bg_br;\n> +       __u32 num_pixels;\n> +} __attribute__((packed));\n> +\n> +/**\n> + * struct mali_c55_af_statistics - Auto Focus edge and intensity statistics\n> + *\n> + * @intensity_stats:   Packed mantissa and exponent value for pixel intensity\n> + * @edge_stats:                Packed mantissa and exponent values for edge intensity\n> + *\n> + * The ISP collects the squared sum of pixel intensities for each zone within a\n> + * configurable Region of Interest on the frame. Additionally, the same data are\n> + * collected after being passed through a bandpass filter which removes high and\n> + * low frequency components - these are referred to as the edge statistics.\n> + *\n> + * The intensity and edge statistics for a zone can be used to calculate the\n> + * contrast information for a zone\n> + *\n> + *     C = E2 / I2\n> + *\n> + * Where I2 is the intensity statistic for a zone and E2 is the edge statistic\n> + * for that zone. Optimum focus is reached when C is at its maximum.\n> + *\n> + * The intensity and edge statistics are stored packed into a non-standard 16\n> + * bit floating point format, where the 7 most significant bits represent the\n> + * exponent and the 9 least significant bits the mantissa. This format can be\n> + * unpacked with the following pseudocode::\n> + *\n> + *     if (e == 0) {\n> + *             x = m;\n> + *     } else {\n> + *             x = 2^e-1 * (m + 2^9)\n> + *     }\n> + *\n> + * where\n> + *     e is the exponent value in range 0..127\n> + *     m is the mantissa value in range 0..511\n> + */\n> +struct mali_c55_af_statistics {\n> +       __u16 intensity_stats;\n> +       __u16 edge_stats;\n> +} __attribute__((packed));\n> +\n> +/**\n> + * struct mali_c55_stats_buffer - 3A statistics for the mali-c55 ISP\n> + *\n> + * @ae_1024bin_hist:           1024-bin frame-global pixel intensity histogram\n> + * @iridix_1024bin_hist:       Post-Iridix block 1024-bin histogram\n> + * @ae_5bin_hists:             5-bin pixel intensity histograms for AEC\n> + * @reserved1:                 Undefined buffer space\n> + * @awb_ratios:                        Color balance ratios for Auto White Balance\n> + * @reserved2:                 Undefined buffer space\n> + * @af_statistics:             Pixel intensity statistics for Auto Focus\n> + * @reserved3:                 Undefined buffer space\n> + *\n> + * This struct describes the metering statistics space in the Mali-C55 ISP's\n> + * hardware in its entirety. The space between each defined area is marked as\n> + * \"unknown\" and may not be 0, but should not be used. The @ae_5bin_hists,\n> + * @awb_ratios and @af_statistics members are arrays of statistics per-zone.\n> + * The zones are arranged in the array in raster order starting from the top\n> + * left corner of the image.\n> + */\n> +\n> +struct mali_c55_stats_buffer {\n> +       struct mali_c55_ae_1024bin_hist ae_1024bin_hist;\n> +       struct mali_c55_ae_1024bin_hist iridix_1024bin_hist;\n> +       struct mali_c55_ae_5bin_hist ae_5bin_hists[MALI_C55_MAX_ZONES];\n> +       __u32 reserved1[14];\n> +       struct mali_c55_awb_average_ratios awb_ratios[MALI_C55_MAX_ZONES];\n> +       __u32 reserved2[14];\n> +       struct mali_c55_af_statistics af_statistics[MALI_C55_MAX_ZONES];\n> +       __u32 reserved3[15];\n> +} __attribute__((packed));\n> +\n> +/**\n> + * enum mali_c55_param_buffer_version - Mali-C55 parameters block versioning\n> + *\n> + * @MALI_C55_PARAM_BUFFER_V1: First version of Mali-C55 parameters block\n> + */\n> +enum mali_c55_param_buffer_version {\n> +       MALI_C55_PARAM_BUFFER_V1,\n> +};\n> +\n> +/**\n> + * enum mali_c55_param_block_type - Enumeration of Mali-C55 parameter blocks\n> + *\n> + * This enumeration defines the types of Mali-C55 parameters block. Each block\n> + * configures a specific processing block of the Mali-C55 ISP. The block\n> + * type allows the driver to correctly interpret the parameters block data.\n> + *\n> + * It is the responsibility of userspace to correctly set the type of each\n> + * parameters block.\n> + *\n> + * @MALI_C55_PARAM_BLOCK_SENSOR_OFFS: Sensor pre-shading black level offset\n> + * @MALI_C55_PARAM_BLOCK_AEXP_HIST: Auto-exposure 1024-bin histogram\n> + *                                 configuration\n> + * @MALI_C55_PARAM_BLOCK_AEXP_IHIST: Post-Iridix auto-exposure 1024-bin\n> + *                                  histogram configuration\n> + * @MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS: Auto-exposure 1024-bin histogram\n> + *                                         weighting\n> + * @MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS: Post-Iridix auto-exposure 1024-bin\n> + *                                          histogram weighting\n> + * @MALI_C55_PARAM_BLOCK_DIGITAL_GAIN: Digital gain\n> + * @MALI_C55_PARAM_BLOCK_AWB_GAINS: Auto-white balance gains\n> + * @MALI_C55_PARAM_BLOCK_AWB_CONFIG: Auto-white balance statistics config\n> + * @MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP: Auto-white balance gains for AEXP-0 tap\n> + * @MALI_C55_PARAM_MESH_SHADING_CONFIG : Mesh shading tables configuration\n> + * @MALI_C55_PARAM_MESH_SHADING_SELECTION: Mesh shading table selection\n> + * @MALI_C55_PARAM_BLOCK_SENTINEL: First non-valid block index\n> + */\n> +enum mali_c55_param_block_type {\n> +       MALI_C55_PARAM_BLOCK_SENSOR_OFFS,\n> +       MALI_C55_PARAM_BLOCK_AEXP_HIST,\n> +       MALI_C55_PARAM_BLOCK_AEXP_IHIST,\n> +       MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS,\n> +       MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS,\n> +       MALI_C55_PARAM_BLOCK_DIGITAL_GAIN,\n> +       MALI_C55_PARAM_BLOCK_AWB_GAINS,\n> +       MALI_C55_PARAM_BLOCK_AWB_CONFIG,\n> +       MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP,\n> +       MALI_C55_PARAM_MESH_SHADING_CONFIG,\n> +       MALI_C55_PARAM_MESH_SHADING_SELECTION,\n> +       MALI_C55_PARAM_BLOCK_SENTINEL,\n> +};\n> +\n> +/**\n> + * struct mali_c55_params_block_header - Mali-C55 parameter block header\n> + *\n> + * This structure represents the common part of all the ISP configuration\n> + * blocks. Each parameters block embeds an instance of this structure type\n> + * as its first member, followed by the block-specific configuration data. The\n> + * driver inspects this common header to discern the block type and its size and\n> + * properly handle the block content by casting it to the correct block-specific\n> + * type.\n> + *\n> + * The @type field is one of the values enumerated by\n> + * :c:type:`mali_c55_param_block_type` and specifies how the data should be\n> + * interpreted by the driver. The @size field specifies the size of the\n> + * parameters block and is used by the driver for validation purposes. The\n> + * @enabled field specifies if the ISP block should be enabled (and configured\n> + * according to the provided parameters) or disabled.\n> + *\n> + * Userspace is responsible for correctly populating the parameters block header\n> + * fields (@type, @enabled and @size) and correctly populate the block-specific\n> + * parameters.\n> + *\n> + * For example:\n> + *\n> + * .. code-block:: c\n> + *\n> + *     void populate_sensor_offs(struct mali_c55_params_block_header *block) {\n> + *             block->type = MALI_C55_PARAM_BLOCK_SENSOR_OFFS;\n> + *             block->enabled = true;\n> + *             block->size = sizeof(struct mali_c55_params_sensor_off_preshading);\n> + *\n> + *             struct mali_c55_params_sensor_off_preshading *sensor_offs =\n> + *                     (struct mali_c55_params_sensor_off_preshading *)block;\n> + *\n> + *             sensor_offs->chan00 = offset00;\n> + *             sensor_offs->chan01 = offset01;\n> + *             sensor_offs->chan10 = offset10;\n> + *             sensor_offs->chan11 = offset11;\n> + *     }\n> + *\n> + * @type: The parameters block type from :c:type:`mali_c55_param_block_type`\n> + * @enabled: Block enabled/disabled flag\n> + * @size: Size (in bytes) of the parameters block\n> + */\n> +struct mali_c55_params_block_header {\n> +       __u8 type;\n> +       __u8 enabled;\n> +       __u32 size;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct mali_c55_params_sensor_off_preshading - offset subtraction for each\n> + *                                               color channel\n> + *\n> + * Provides removal of the sensor black level from the sensor data. Separate\n> + * offsets are provided for each of the four Bayer component color channels\n> + * which are defaulted to R, Gr, Gb, B.\n> + *\n> + * header.type should be set to MALI_C55_PARAM_BLOCK_SENSOR_OFFS from\n> + * :c:type:`mali_c55_param_block_type` for this block.\n> + *\n> + * @header: The Mali-C55 parameters block header\n> + * @chan00: Offset for color channel 00 (default: R)\n> + * @chan01: Offset for color channel 01 (default: Gr)\n> + * @chan10: Offset for color channel 10 (default: Gb)\n> + * @chan11: Offset for color channel 11 (default: B)\n> + */\n> +struct mali_c55_params_sensor_off_preshading {\n> +       struct mali_c55_params_block_header header;\n> +       __u32 chan00;\n> +       __u32 chan01;\n> +       __u32 chan10;\n> +       __u32 chan11;\n> +};\n> +\n> +/**\n> + * enum mali_c55_aexp_hist_tap_points - Tap points for the AEXP histogram\n> + * @MALI_C55_AEXP_HIST_TAP_WB: After static white balance\n> + * @MALI_C55_AEXP_HIST_TAP_FS: After WDR Frame Stitch\n> + * @MALI_C55_AEXP_HIST_TAP_TPG: After the test pattern generator\n> + */\n> +enum mali_c55_aexp_hist_tap_points {\n> +       MALI_C55_AEXP_HIST_TAP_WB = 0,\n> +       MALI_C55_AEXP_HIST_TAP_FS,\n> +       MALI_C55_AEXP_HIST_TAP_TPG,\n> +};\n> +\n> +/**\n> + * enum mali_c55_aexp_skip_x - Horizontal pixel skipping\n> + * @MALI_C55_AEXP_SKIP_X_EVERY_2ND: Collect every 2nd pixel horizontally\n> + * @MALI_C55_AEXP_SKIP_X_EVERY_3RD: Collect every 3rd pixel horizontally\n> + * @MALI_C55_AEXP_SKIP_X_EVERY_4TH: Collect every 4th pixel horizontally\n> + * @MALI_C55_AEXP_SKIP_X_EVERY_5TH: Collect every 5th pixel horizontally\n> + * @MALI_C55_AEXP_SKIP_X_EVERY_8TH: Collect every 8th pixel horizontally\n> + * @MALI_C55_AEXP_SKIP_X_EVERY_9TH: Collect every 9th pixel horizontally\n> + */\n> +enum mali_c55_aexp_skip_x {\n> +       MALI_C55_AEXP_SKIP_X_EVERY_2ND,\n> +       MALI_C55_AEXP_SKIP_X_EVERY_3RD,\n> +       MALI_C55_AEXP_SKIP_X_EVERY_4TH,\n> +       MALI_C55_AEXP_SKIP_X_EVERY_5TH,\n> +       MALI_C55_AEXP_SKIP_X_EVERY_8TH,\n> +       MALI_C55_AEXP_SKIP_X_EVERY_9TH\n> +};\n> +\n> +/**\n> + * enum mali_c55_aexp_skip_y - Vertical pixel skipping\n> + * @MALI_C55_AEXP_SKIP_Y_ALL: Collect every single pixel vertically\n> + * @MALI_C55_AEXP_SKIP_Y_EVERY_2ND: Collect every 2nd pixel vertically\n> + * @MALI_C55_AEXP_SKIP_Y_EVERY_3RD: Collect every 3rd pixel vertically\n> + * @MALI_C55_AEXP_SKIP_Y_EVERY_4TH: Collect every 4th pixel vertically\n> + * @MALI_C55_AEXP_SKIP_Y_EVERY_5TH: Collect every 5th pixel vertically\n> + * @MALI_C55_AEXP_SKIP_Y_EVERY_8TH: Collect every 8th pixel vertically\n> + * @MALI_C55_AEXP_SKIP_Y_EVERY_9TH: Collect every 9th pixel vertically\n> + */\n> +enum mali_c55_aexp_skip_y {\n> +       MALI_C55_AEXP_SKIP_Y_ALL,\n> +       MALI_C55_AEXP_SKIP_Y_EVERY_2ND,\n> +       MALI_C55_AEXP_SKIP_Y_EVERY_3RD,\n> +       MALI_C55_AEXP_SKIP_Y_EVERY_4TH,\n> +       MALI_C55_AEXP_SKIP_Y_EVERY_5TH,\n> +       MALI_C55_AEXP_SKIP_Y_EVERY_8TH,\n> +       MALI_C55_AEXP_SKIP_Y_EVERY_9TH\n> +};\n> +\n> +/**\n> + * enum mali_c55_aexp_row_column_offset - Start from the first or second row or\n> + *                                       column\n> + * @MALI_C55_AEXP_FIRST_ROW_OR_COL:    Start from the first row / column\n> + * @MALI_C55_AEXP_SECOND_ROW_OR_COL:   Start from the second row / column\n> + */\n> +enum mali_c55_aexp_row_column_offset {\n> +       MALI_C55_AEXP_FIRST_ROW_OR_COL = 1,\n> +       MALI_C55_AEXP_SECOND_ROW_OR_COL = 2,\n> +};\n> +\n> +/**\n> + * enum mali_c55_aexp_hist_plane_mode - Mode for the AEXP Histograms\n> + * @MALI_C55_AEXP_HIST_COMBINED: All color planes in one 1024-bin histogram\n> + * @MALI_C55_AEXP_HIST_SEPARATE: Each color plane in one 256-bin histogram with a bin width of 16\n> + * @MALI_C55_AEXP_HIST_FOCUS_00: Top left plane in the first bank, rest in second bank\n> + * @MALI_C55_AEXP_HIST_FOCUS_01: Top right plane in the first bank, rest in second bank\n> + * @MALI_C55_AEXP_HIST_FOCUS_10: Bottom left plane in the first bank, rest in second bank\n> + * @MALI_C55_AEXP_HIST_FOCUS_11: Bottom right plane in the first bank, rest in second bank\n> + *\n> + * In the \"focus\" modes statistics are collected into two 512-bin histograms\n> + * with a bin width of 8. One colour plane is in the first histogram with the\n> + * remainder combined into the second. The four options represent which of the\n> + * four positions in a bayer pattern are the focused plane.\n> + */\n> +enum mali_c55_aexp_hist_plane_mode {\n> +       MALI_C55_AEXP_HIST_COMBINED = 0,\n> +       MALI_C55_AEXP_HIST_SEPARATE = 1,\n> +       MALI_C55_AEXP_HIST_FOCUS_00 = 4,\n> +       MALI_C55_AEXP_HIST_FOCUS_01 = 5,\n> +       MALI_C55_AEXP_HIST_FOCUS_10 = 6,\n> +       MALI_C55_AEXP_HIST_FOCUS_11 = 7,\n> +};\n> +\n> +/**\n> + * struct mali_c55_params_aexp_hist - configuration for AEXP metering hists\n> + *\n> + * This struct allows users to configure the 1024-bin AEXP histograms. Broadly\n> + * speaking the parameters allow you to mask particular regions of the image and\n> + * to select different kinds of histogram.\n> + *\n> + * The skip_x, offset_x, skip_y and offset_y fields allow users to ignore or\n> + * mask pixels in the frame by their position relative to the top left pixel.\n> + * First, the skip_y, offset_x and offset_y fields define a 2x2 pixel pattern of\n> + * which pixels covered by the pattern will be counted in the statistics.\n> + *\n> + * If skip_y == 0 then two pixels from each coveredregion will be counted. If\n> + * both offset_x and offset_y are zero, then the two left-most pixels in each\n> + * 2x2 pixel region covered by the pattern will be counted. Setting offset_x = 1\n> + * will discount the top left pixel and count the top right pixel. Setting\n> + * offset_y = 1 will discount the bottom left pixel and count the bottom right\n> + * pixel.\n> + *\n> + * If skip_y != 0 then only a single pixel from each region covered by the\n> + * pattern will be counted. In this case offset_x controls whether the pixel\n> + * that's counted is in the left (if offset_x == 0) or right (if offset_x == 1)\n> + * column and offset_y controls whether the pixel that's counted is in the top\n> + * (if offset_y == 0) or bottom (if offset_y == 1) row.\n> + *\n> + * The skip_x and skip_y fields control how the pixel masking pattern is\n> + * repeated across the image data. The first instance of the pattern is always\n> + * in the top left of the image data. The skip_x field controls how many pixels\n> + * are ignored in the x direction before the pixel masking pattern is repeated.\n> + * The skip_y field controls how many pixels are ignored in the y direction\n> + * before the pixel masking pattern is repeated.\n> + *\n> + * These fields can be used to reduce the number of pixels counted for the\n> + * statistics, but it's important to be careful to configure them correctly.\n> + * Some combinations of values will result in colour components from the input\n> + * data being ignored entirely, for example in the following configuration:\n> + *\n> + * skip_x = 0\n> + * offset_x = 0\n> + * skip_y = 0\n> + * offset_y = 0\n> + *\n> + * Only the R and Gb components of RGGB data that was input would be collected.\n> + * Similarly in the following configuration:\n> + *\n> + * skip_x = 0\n> + * offset_x = 0\n> + * skip_y = 1\n> + * offset_y = 1\n> + *\n> + * Only the Gb component of RGGB data that was input would be collected. To\n> + * correct things such that all 4 colour components were included it would be\n> + * necessary to set the skip_x and skip_y fields in a way that resulted in all\n> + * four colour components being collected:\n> + *\n> + * skip_x = 1\n> + * offset_x = 0\n> + * skip_y = 1\n> + * offset_y = 1\n> + *\n> + * header.type should be set to one of either MALI_C55_PARAM_BLOCK_AEXP_HIST or\n> + * MALI_C55_PARAM_BLOCK_AEXP_IHIST from :c:type:`mali_c55_param_block_type`.\n> + *\n> + * @header:            The Mali-C55 parameters block header\n> + * @skip_x:            Horizontal decimation. See enum mali_c55_aexp_skip_x\n> + * @offset_x:          Skip the first column, or not. See enum mali_c55_aexp_row_column_offset\n> + * @skip_y:            Vertical decimation. See enum mali_c55_aexp_skip_y\n> + * @offset_y:          Skip the first row, or not. See enum mali_c55_aexp_row_column_offset\n> + * @scale_bottom:      Scale pixels in bottom half of intensity range: 0=1x ,1=2x, 2=4x, 4=8x, 4=16x\n> + * @scale_top:         scale pixels in top half of intensity range: 0=1x ,1=2x, 2=4x, 4=8x, 4=16x\n> + * @plane_mode:                Plane separation mode. See enum mali_c55_aexp_hist_plane_mode\n> + * @tap_point:         Tap point for histogram from enum mali_c55_aexp_hist_tap_points.\n> + *                     This parameter is unused for the post-Iridix Histogram\n> + */\n> +struct mali_c55_params_aexp_hist {\n> +       struct mali_c55_params_block_header header;\n> +       __u8 skip_x;\n> +       __u8 offset_x;\n> +       __u8 skip_y;\n> +       __u8 offset_y;\n> +       __u8 scale_bottom;\n> +       __u8 scale_top;\n> +       __u8 plane_mode;\n> +       __u8 tap_point;\n> +};\n> +\n> +/**\n> + * struct mali_c55_params_aexp_weights - Array of weights for AEXP metering\n> + *\n> + * This struct allows users to configure the weighting for both of the 1024-bin\n> + * AEXP histograms. The pixel data collected for each zone is multiplied by the\n> + * corresponding weight from this array, which may be zero if the intention is\n> + * to mask off the zone entirely.\n> + *\n> + * header.type should be set to one of either MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS\n> + * or MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS from :c:type:`mali_c55_param_block_type`.\n> + *\n> + * @header:            The Mali-C55 parameters block header\n> + * @nodes_used_horiz:  Number of active zones horizontally [0..15]\n> + * @nodes_used_vert:   Number of active zones vertically [0..15]\n> + * @zone_weights:      Zone weighting. Index is row*col where 0,0 is the top\n> + *                     left zone continuing in raster order. Each zone can be\n> + *                     weighted in the range [0..15]. The number of rows and\n> + *                     columns is defined by @nodes_used_vert and\n> + *                     @nodes_used_horiz\n> + */\n> +struct mali_c55_params_aexp_weights {\n> +       struct mali_c55_params_block_header header;\n> +       __u8 nodes_used_horiz;\n> +       __u8 nodes_used_vert;\n> +       __u8 zone_weights[MALI_C55_MAX_ZONES];\n> +};\n> +\n> +/**\n> + * struct mali_c55_params_digital_gain - Digital gain value\n> + *\n> + * This struct carries a digital gain value to set in the ISP.\n> + *\n> + * header.type should be set to MALI_C55_PARAM_BLOCK_DIGITAL_GAIN from\n> + * :c:type:`mali_c55_param_block_type` for this block.\n> + *\n> + * @header:    The Mali-C55 parameters block header\n> + * @gain:      The digital gain value to apply, in Q5.8 format.\n> + */\n> +struct mali_c55_params_digital_gain {\n> +       struct mali_c55_params_block_header header;\n> +       __u16 gain;\n> +};\n> +\n> +/**\n> + * enum mali_c55_awb_stats_mode - Statistics mode for AWB\n> + * @MALI_C55_AWB_MODE_GRBR: Statistics collected as Green/Red and Blue/Red ratios\n> + * @MALI_C55_AWB_MODE_RGBG: Statistics collected as Red/Green and Blue/Green ratios\n> + */\n> +enum mali_c55_awb_stats_mode {\n> +       MALI_C55_AWB_MODE_GRBR = 0,\n> +       MALI_C55_AWB_MODE_RGBG,\n> +};\n> +\n> +/**\n> + * struct mali_c55_params_awb_gains - Gain settings for auto white balance\n> + *\n> + * This struct allows users to configure the gains for auto-white balance. There\n> + * are four gain settings corresponding to each colour channel in the bayer\n> + * domain. Although named generically, the association between the gain applied\n> + * and the colour channel is done automatically within the ISP depending on the\n> + * input format, and so the following mapping always holds true::\n> + *\n> + *     gain00 = R\n> + *     gain01 = Gr\n> + *     gain10 = Gb\n> + *     gain11 = B\n> + *\n> + * All of the gains are stored in Q4.8 format.\n> + *\n> + * header.type should be set to one of either MALI_C55_PARAM_BLOCK_AWB_GAINS or\n> + * MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP from :c:type:`mali_c55_param_block_type`.\n> + *\n> + * @header:    The Mali-C55 parameters block header\n> + * @gain00:    Multiplier for colour channel 00\n> + * @gain01:    Multiplier for colour channel 01\n> + * @gain10:    Multiplier for colour channel 10\n> + * @gain11:    Multiplier for colour channel 11\n> + */\n> +struct mali_c55_params_awb_gains {\n> +       struct mali_c55_params_block_header header;\n> +       __u16 gain00;\n> +       __u16 gain01;\n> +       __u16 gain10;\n> +       __u16 gain11;\n> +};\n> +\n> +/**\n> + * enum mali_c55_params_awb_tap_points - Tap points for the AWB statistics\n> + * @MALI_C55_AWB_STATS_TAP_PF: Immediately after the Purple Fringe block\n> + * @MALI_C55_AWB_STATS_TAP_CNR: Immediately after the CNR block\n> + */\n> +enum mali_c55_params_awb_tap_points {\n> +       MALI_C55_AWB_STATS_TAP_PF = 0,\n> +       MALI_C55_AWB_STATS_TAP_CNR,\n> +};\n> +\n> +/**\n> + * struct mali_c55_params_awb_config - Stats settings for auto-white balance\n> + *\n> + * This struct allows the configuration of the statistics generated for auto\n> + * white balance. Pixel intensity limits can be set to exclude overly bright or\n> + * dark regions of an image from the statistics entirely. Colour ratio minima\n> + * and maxima can be set to discount pixels who's ratios fall outside the\n> + * defined boundaries; there are two sets of registers to do this - the\n> + * \"min/max\" ratios which bound a region and the \"high/low\" ratios which further\n> + * trim the upper and lower ratios. For example with the boundaries configured\n> + * as follows, only pixels whos colour ratios falls into the region marked \"A\"\n> + * would be counted::\n> + *\n> + *                                                               cr_high\n> + *         2.0 |                                                   |\n> + *             |               cb_max --> _________________________v_____\n> + *         1.8 |                         |                         \\    |\n> + *             |                         |                          \\   |\n> + *         1.6 |                         |                           \\  |\n> + *             |                         |                            \\ |\n> + *      c  1.4 |               cb_low -->|\\              A             \\|<--  cb_high\n> + *      b      |                         | \\                            |\n> + *         1.2 |                         |  \\                           |\n> + *      r      |                         |   \\                          |\n> + *      a  1.0 |              cb_min --> |____\\_________________________|\n> + *      t      |                         ^    ^                         ^\n> + *      i  0.8 |                         |    |                         |\n> + *      o      |                      cr_min  |                       cr_max\n> + *      s  0.6 |                              |\n> + *             |                             cr_low\n> + *         0.4 |\n> + *             |\n> + *         0.2 |\n> + *             |\n> + *         0.0 |_______________________________________________________________\n> + *             0.0   0.2   0.4   0.6   0.8   1.0   1.2   1.4   1.6   1.8   2.0\n> + *                                        cr ratios\n> + *\n> + * header.type should be set to MALI_C55_PARAM_BLOCK_AWB_CONFIG from\n> + * :c:type:`mali_c55_param_block_type` for this block.\n> + *\n> + * @header:            The Mali-C55 parameters block header\n> + * @tap_point:         The tap point from enum mali_c55_params_awb_tap_points\n> + * @stats_mode:                AWB statistics collection mode, see :c:type:`mali_c55_awb_stats_mode`\n> + * @white_level:       Upper pixel intensity (I.E. raw pixel values) limit\n> + * @black_level:       Lower pixel intensity (I.E. raw pixel values) limit\n> + * @cr_max:            Maximum R/G ratio (Q4.8 format)\n> + * @cr_min:            Minimum R/G ratio (Q4.8 format)\n> + * @cb_max:            Maximum B/G ratio (Q4.8 format)\n> + * @cb_min:            Minimum B/G ratio (Q4.8 format)\n> + * @nodes_used_horiz:  Number of active zones horizontally [0..15]\n> + * @nodes_used_vert:   Number of active zones vertically [0..15]\n> + * @cr_high:           R/G ratio trim high (Q4.8 format)\n> + * @cr_low:            R/G ratio trim low (Q4.8 format)\n> + * @cb_high:           B/G ratio trim high (Q4.8 format)\n> + * @cb_low:            B/G ratio trim low (Q4.8 format)\n> + */\n> +struct mali_c55_params_awb_config {\n> +       struct mali_c55_params_block_header header;\n> +       __u8 tap_point;\n> +       __u8 stats_mode;\n> +       __u16 white_level;\n> +       __u16 black_level;\n> +       __u16 cr_max;\n> +       __u16 cr_min;\n> +       __u16 cb_max;\n> +       __u16 cb_min;\n> +       __u8 nodes_used_horiz;\n> +       __u8 nodes_used_vert;\n> +       __u16 cr_high;\n> +       __u16 cr_low;\n> +       __u16 cb_high;\n> +       __u16 cb_low;\n> +};\n> +\n> +#define MALI_C55_NUM_MESH_SHADING_ELEMENTS 3072\n> +\n> +/**\n> + * struct mali_c55_params_mesh_shading_config - Mesh shading configuration\n> + *\n> + * The mesh shading correction module allows programming a separate table of\n> + * either 16x16 or 32x32 node coefficients for 3 different light sources. The\n> + * final correction coefficients applied are computed by blending the\n> + * coefficients from two tables together.\n> + *\n> + * A page of 1024 32-bit integers is associated to each colour channel, with\n> + * pages stored consecutively in memory. Each 32-bit integer packs 3 8-bit\n> + * correction coefficients for a single node, one for each of the three light\n> + * sources. The 8 most significant bits are unused. The following table\n> + * describes the layout::\n> + *\n> + *     +----------- Page (Colour Plane) 0 -------------+\n> + *     | @mesh[i]  | Mesh Point | Bits  | Light Source |\n> + *     +-----------+------------+-------+--------------+\n> + *     |         0 |        0,0 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |         1 |        0,1 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |       ... |        ... | ...   | ...          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |      1023 |      31,31 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +----------- Page (Colour Plane) 1 -------------+\n> + *     | @mesh[i]  | Mesh Point | Bits  | Light Source |\n> + *     +-----------+------------+-------+--------------+\n> + *     |      1024 |        0,0 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |      1025 |        0,1 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |       ... |        ... | ...   | ...          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |      2047 |      31,31 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +----------- Page (Colour Plane) 2 -------------+\n> + *     | @mesh[i]  | Mesh Point | Bits  | Light Source |\n> + *     +-----------+------------+-------+--------------+\n> + *     |      2048 |        0,0 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |      2049 |        0,1 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |       ... |        ... | ...   | ...          |\n> + *     +-----------+------------+-------+--------------+\n> + *     |      3071 |      31,31 | 16,23 | LS2          |\n> + *     |           |            | 08-15 | LS1          |\n> + *     |           |            | 00-07 | LS0          |\n> + *     +-----------+------------+-------+--------------+\n> + *\n> + * The @mesh_scale member determines the precision and minimum and maximum gain.\n> + * For example if @mesh_scale is 0 and therefore selects 0 - 2x gain, a value of\n> + * 0 in a coefficient means 0.0 gain, a value of 128 means 1.0 gain and 255\n> + * means 2.0 gain.\n> + *\n> + * header.type should be set to MALI_C55_PARAM_MESH_SHADING_CONFIG from\n> + * :c:type:`mali_c55_param_block_type` for this block.\n> + *\n> + * @header:            The Mali-C55 parameters block header\n> + * @mesh_show:         Output the mesh data rather than image data\n> + * @mesh_scale:                Set the precision and maximum gain range of mesh shading\n> + *                             - 0 = 0-2x gain\n> + *                             - 1 = 0-4x gain\n> + *                             - 2 = 0-8x gain\n> + *                             - 3 = 0-16x gain\n> + *                             - 4 = 1-2x gain\n> + *                             - 5 = 1-3x gain\n> + *                             - 6 = 1-5x gain\n> + *                             - 7 = 1-9x gain\n> + * @mesh_page_r:       Mesh page select for red colour plane [0..2]\n> + * @mesh_page_g:       Mesh page select for green colour plane [0..2]\n> + * @mesh_page_b:       Mesh page select for blue colour plane [0..2]\n> + * @mesh_width:                Number of horizontal nodes minus 1 [15,31]\n> + * @mesh_height:       Number of vertical nodes minus 1 [15,31]\n> + * @mesh:              Mesh shading correction tables\n> + */\n> +struct mali_c55_params_mesh_shading_config {\n> +       struct mali_c55_params_block_header header;\n> +       __u8 mesh_show;\n> +       __u8 mesh_scale;\n> +       __u8 mesh_page_r;\n> +       __u8 mesh_page_g;\n> +       __u8 mesh_page_b;\n> +       __u8 mesh_width;\n> +       __u8 mesh_height;\n> +       __u32 mesh[MALI_C55_NUM_MESH_SHADING_ELEMENTS];\n> +};\n> +\n> +/** enum mali_c55_params_mesh_alpha_bank - Mesh shading table bank selection\n> + * @MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS1 - Select Light Sources 0 and 1\n> + * @MALI_C55_MESH_ALPHA_BANK_LS1_AND_LS2 - Select Light Sources 1 and 2\n> + * @MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS2 - Select Light Sources 0 and 2\n> + */\n> +enum mali_c55_params_mesh_alpha_bank {\n> +       MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS1 = 0,\n> +       MALI_C55_MESH_ALPHA_BANK_LS1_AND_LS2 = 1,\n> +       MALI_C55_MESH_ALPHA_BANK_LS0_AND_LS2 = 4\n> +};\n> +\n> +/**\n> + * struct mali_c55_params_mesh_shading_selection - Mesh table selection\n> + *\n> + * The module computes the final correction coefficients by blending the ones\n> + * from two light source tables, which are selected (independently for each\n> + * colour channel) by the @mesh_alpha_bank_r/g/b fields.\n> + *\n> + * The final blended coefficients for each node are calculated using the\n> + * following equation:\n> + *\n> + *     Final coefficient = (a * LS\\ :sub:`b`\\ + (256 - a) * LS\\ :sub:`a`\\) / 256\n> + *\n> + * Where a is the @mesh_alpha_r/g/b value, and LS\\ :sub:`a`\\ and LS\\ :sub:`b`\\\n> + * are the node cofficients for the two tables selected by the\n> + * @mesh_alpha_bank_r/g/b value.\n> + *\n> + * The scale of the applied correction may also be controlled by tuning the\n> + * @mesh_strength member. This is a modifier to the final coefficients which can\n> + * be used to globally reduce the gains applied.\n> + *\n> + * header.type should be set to MALI_C55_PARAM_MESH_SHADING_SELECTION from\n> + * :c:type:`mali_c55_param_block_type` for this block.\n> + *\n> + * @header:            The Mali-C55 parameters block header\n> + * @mesh_alpha_bank_r: Red mesh table select (c:type:`enum mali_c55_params_mesh_alpha_bank`)\n> + * @mesh_alpha_bank_g: Green mesh table select (c:type:`enum mali_c55_params_mesh_alpha_bank`)\n> + * @mesh_alpha_bank_b: Blue mesh table select (c:type:`enum mali_c55_params_mesh_alpha_bank`)\n> + * @mesh_alpha_r:      Blend coefficient for R [0..255]\n> + * @mesh_alpha_g:      Blend coefficient for G [0..255]\n> + * @mesh_alpha_b:      Blend coefficient for B [0..255]\n> + * @mesh_strength:     Mesh strength in Q4.12 format [0..4096]\n> + */\n> +struct mali_c55_params_mesh_shading_selection {\n> +       struct mali_c55_params_block_header header;\n> +       __u8 mesh_alpha_bank_r;\n> +       __u8 mesh_alpha_bank_g;\n> +       __u8 mesh_alpha_bank_b;\n> +       __u8 mesh_alpha_r;\n> +       __u8 mesh_alpha_g;\n> +       __u8 mesh_alpha_b;\n> +       __u16 mesh_strength;\n> +};\n> +\n> +/**\n> + * union mali_c55_params_block - Generalisation of a parameter block\n> + *\n> + * This union allows the driver to treat a block as a generic pointer to this\n> + * union and safely access the header and block-specific struct without having\n> + * to resort to casting. The header member is accessed first, and the type field\n> + * checked which allows the driver to determine which of the other members\n> + * should be used. The data member at the end allows a pointer to an address\n> + * within the data member of :c:type:`mali_c55_params_buffer` to initialise a\n> + * union variable.\n> + *\n> + * @header:            Pointer to the shared header struct embedded as the\n> + *                     first member of all the possible other members (except\n> + *                     @data). This member would be accessed first and the type\n> + *                     field checked to determine which of the other members\n> + *                     should be accessed.\n> + * @sensor_offs:       For header->type == MALI_C55_PARAM_BLOCK_SENSOR_OFFS\n> + * @aexp_hist:         For header->type == MALI_C55_PARAM_BLOCK_AEXP_HIST and\n> + *                     header->type == MALI_C55_PARAM_BLOCK_AEXP_IHIST\n> + * @aexp_weights:      For header->type == MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS\n> + *                     and header->type =  MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS\n> + * @digital_gain:      For header->type == MALI_C55_PARAM_BLOCK_DIGITAL_GAIN\n> + * @awb_gains:         For header->type == MALI_C55_PARAM_BLOCK_AWB_GAINS and\n> + *                     header->type = MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP\n> + * @awb_config:                For header->type == MALI_C55_PARAM_MESH_SHADING_CONFIG\n> + * @shading_config:    For header->type == MALI_C55_PARAM_MESH_SHADING_SELECTION\n> + * @shading_selection: For header->type == MALI_C55_PARAM_BLOCK_SENSOR_OFFS\n> + * @data:              Allows easy initialisation of a union variable with a\n> + *                     pointer into a __u8 array.\n> + */\n> +union mali_c55_params_block {\n> +       struct mali_c55_params_block_header *header;\n> +       struct mali_c55_params_sensor_off_preshading *sensor_offs;\n> +       struct mali_c55_params_aexp_hist *aexp_hist;\n> +       struct mali_c55_params_aexp_weights *aexp_weights;\n> +       struct mali_c55_params_digital_gain *digital_gain;\n> +       struct mali_c55_params_awb_gains *awb_gains;\n> +       struct mali_c55_params_awb_config *awb_config;\n> +       struct mali_c55_params_mesh_shading_config *shading_config;\n> +       struct mali_c55_params_mesh_shading_selection *shading_selection;\n> +       __u8 *data;\n> +};\n> +\n> +/**\n> + * define MALI_C55_PARAMS_MAX_SIZE - Maximum size of all Mali C55 Parameters\n> + *\n> + * Though the parameters for the Mali-C55 are passed as optional blocks, the\n> + * driver still needs to know the absolute maximum size so that it can allocate\n> + * a buffer sized appropriately to accommodate userspace attempting to set all\n> + * possible parameters in a single frame.\n> + *\n> + * Some structs are in this list multiple times. Where that's the case, it just\n> + * reflects the fact that the same struct can be used with multiple different\n> + * header types from :c:type:`mali_c55_param_block_type`.\n> + */\n> +#define MALI_C55_PARAMS_MAX_SIZE                               \\\n> +       (sizeof(struct mali_c55_params_sensor_off_preshading) + \\\n> +       sizeof(struct mali_c55_params_aexp_hist) +              \\\n> +       sizeof(struct mali_c55_params_aexp_weights) +           \\\n> +       sizeof(struct mali_c55_params_aexp_hist) +              \\\n> +       sizeof(struct mali_c55_params_aexp_weights) +           \\\n> +       sizeof(struct mali_c55_params_digital_gain) +           \\\n> +       sizeof(struct mali_c55_params_awb_gains) +              \\\n> +       sizeof(struct mali_c55_params_awb_config) +             \\\n> +       sizeof(struct mali_c55_params_awb_gains) +              \\\n> +       sizeof(struct mali_c55_params_mesh_shading_config) +    \\\n> +       sizeof(struct mali_c55_params_mesh_shading_selection))\n> +\n> +/**\n> + * struct mali_c55_params_buffer - 3A configuration parameters\n> + *\n> + * This struct contains the configuration parameters of the Mali-C55 ISP\n> + * algorithms, serialized by userspace into a data buffer. Each configuration\n> + * parameter block is represented by a block-specific structure which contains a\n> + * :c:type:`mali_c55_params_block_header` entry as first member. Userspace\n> + * populates the @data buffer with configuration parameters for the blocks that\n> + * it intends to configure. As a consequence, the data buffer effective size\n> + * changes according to the number of ISP blocks that userspace intends to\n> + * configure.\n> + *\n> + * The parameters buffer is versioned by the @version field to allow modifying\n> + * and extending its definition. Userspace shall populate the @version field to\n> + * inform the driver about the version it intends to use. The driver will parse\n> + * and handle the @data buffer according to the data layout specific to the\n> + * indicated version and return an error if the desired version is not\n> + * supported.\n> + *\n> + * For each ISP block that userspace wants to configure, a block-specific\n> + * structure is appended to the @data buffer, one after the other without gaps\n> + * in between nor overlaps. Userspace shall populate the @total_size field with\n> + * the effective size, in bytes, of the @data buffer.\n> + *\n> + * The expected memory layout of the parameters buffer is::\n> + *\n> + *     +-------------------- struct mali_c55_params_buffer ------------------+\n> + *     | version = MALI_C55_PARAM_BUFFER_V1;                                 |\n> + *     | total_size = sizeof(struct mali_c55_params_sensor_off_preshading)   |\n> + *     |              sizeof(struct mali_c55_params_aexp_hist);              |\n> + *     | +------------------------- data  ---------------------------------+ |\n> + *     | | +--------- struct mali_c55_params_sensor_off_preshading ------+ | |\n> + *     | | | +-------- struct mali_c55_params_block_header header -----+ | | |\n> + *     | | | | type = MALI_C55_PARAM_BLOCK_SENSOR_OFFS;                | | | |\n> + *     | | | | enabled = 1;                                            | | | |\n> + *     | | | | size =                                                  | | | |\n> + *     | | | |    sizeof(struct mali_c55_params_sensor_off_preshading);| | | |\n> + *     | | | +---------------------------------------------------------+ | | |\n> + *     | | | chan00 = ...;                                               | | |\n> + *     | | | chan01 = ...;                                               | | |\n> + *     | | | chan10 = ...;                                               | | |\n> + *     | | | chan11 = ...;                                               | | |\n> + *     | | +------------ struct mali_c55_params_aexp_hist ---------------+ | |\n> + *     | | | +-------- struct mali_c55_params_block_header header -----+ | | |\n> + *     | | | | type = MALI_C55_PARAM_BLOCK_AEXP_HIST;                  | | | |\n> + *     | | | | enabled = 1;                                            | | | |\n> + *     | | | | size = sizeof(struct mali_c55_params_aexp_hist);        | | | |\n> + *     | | | +---------------------------------------------------------+ | | |\n> + *     | | | skip_x = ...;                                               | | |\n> + *     | | | offset_x = ...;                                             | | |\n> + *     | | | skip_y = ...;                                               | | |\n> + *     | | | offset_y = ...;                                             | | |\n> + *     | | | scale_bottom = ...;                                         | | |\n> + *     | | | scale_top = ...;                                            | | |\n> + *     | | | plane_mode = ...;                                           | | |\n> + *     | | | tap_point = ...;                                            | | |\n> + *     | | +-------------------------------------------------------------+ | |\n> + *     | +-----------------------------------------------------------------+ |\n> + *     +---------------------------------------------------------------------+\n> + *\n> + * @version: The version from :c:type:`mali_c55_param_buffer_version`\n> + * @total_size: The Mali-C55 configuration data effective size, excluding this\n> + *             header\n> + * @data: The Mali-C55 configuration blocks data\n> + */\n> +struct mali_c55_params_buffer {\n> +       __u8 version;\n> +       __u32 total_size;\n> +       __u8 data[MALI_C55_PARAMS_MAX_SIZE];\n> +};\n> +\n> +#endif /* __UAPI_MALI_C55_CONFIG_H */\n> -- \n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 68503C32DE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Oct 2024 15:18:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 13DDA65369;\n\tWed,  9 Oct 2024 17:18:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96F6A618C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Oct 2024 17:18:07 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1674F594;\n\tWed,  9 Oct 2024 17:16:30 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"B3z3i1Av\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728486990;\n\tbh=K4TenTUX1peT92D2SVFdBs5F0/S3vlsSmVILAISdKf0=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=B3z3i1Av7p/FSZUM22xeFnNCFiP7h/Rc7ePFYZObraKb6chTneVoF27vNFBlRvlTG\n\t/OxzabrpmfQf/KvYE/UPKd/7tbIR3CeZLnFPYdjqASYRctPKswzlCwj68gRU67i2il\n\tghEHieOTch5Xmd0Pkkvf+sUpi+juQqPOkUnfBvkg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240709144950.3277837-2-dan.scally@ideasonboard.com>","References":"<20240709144950.3277837-1-dan.scally@ideasonboard.com>\n\t<20240709144950.3277837-2-dan.scally@ideasonboard.com>","Subject":"Re: [PATCH v2 01/10] include: linux: Add mali-c55-config.h","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tNayden Kanchev <nayden.kanchev@arm.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 09 Oct 2024 16:18:05 +0100","Message-ID":"<172848708501.532453.2512160569905119356@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]