1*f0d3a857SKeke Li.. SPDX-License-Identifier: (GPL-2.0-only OR MIT) 2*f0d3a857SKeke Li 3*f0d3a857SKeke Li.. _v4l2-meta-fmt-c3isp-stats: 4*f0d3a857SKeke Li.. _v4l2-meta-fmt-c3isp-params: 5*f0d3a857SKeke Li 6*f0d3a857SKeke Li*********************************************************************** 7*f0d3a857SKeke LiV4L2_META_FMT_C3ISP_STATS ('C3ST'), V4L2_META_FMT_C3ISP_PARAMS ('C3PM') 8*f0d3a857SKeke Li*********************************************************************** 9*f0d3a857SKeke Li 10*f0d3a857SKeke Li.. c3_isp_stats_info 11*f0d3a857SKeke Li 12*f0d3a857SKeke Li3A Statistics 13*f0d3a857SKeke Li============= 14*f0d3a857SKeke Li 15*f0d3a857SKeke LiThe C3 ISP can collect different statistics over an input Bayer frame. 16*f0d3a857SKeke LiThose statistics are obtained from the "c3-isp-stats" metadata capture video nodes, 17*f0d3a857SKeke Liusing the :c:type:`v4l2_meta_format` interface. 18*f0d3a857SKeke LiThey are formatted as described by the :c:type:`c3_isp_stats_info` structure. 19*f0d3a857SKeke Li 20*f0d3a857SKeke LiThe statistics collected are Auto-white balance, 21*f0d3a857SKeke LiAuto-exposure and Auto-focus information. 22*f0d3a857SKeke Li 23*f0d3a857SKeke Li.. c3_isp_params_cfg 24*f0d3a857SKeke Li 25*f0d3a857SKeke LiConfiguration Parameters 26*f0d3a857SKeke Li======================== 27*f0d3a857SKeke Li 28*f0d3a857SKeke LiThe configuration parameters are passed to the c3-isp-params metadata output video node, 29*f0d3a857SKeke Liusing the :c:type:`v4l2_meta_format` interface. Rather than a single struct containing 30*f0d3a857SKeke Lisub-structs for each configurable area of the ISP, parameters for the C3-ISP 31*f0d3a857SKeke Liare defined as distinct structs or "blocks" which may be added to the data 32*f0d3a857SKeke Limember of :c:type:`c3_isp_params_cfg`. Userspace is responsible for 33*f0d3a857SKeke Lipopulating the data member with the blocks that need to be configured by the driver, but 34*f0d3a857SKeke Lineed not populate it with **all** the blocks, or indeed with any at all if there 35*f0d3a857SKeke Liare no configuration changes to make. Populated blocks **must** be consecutive 36*f0d3a857SKeke Liin the buffer. To assist both userspace and the driver in identifying the 37*f0d3a857SKeke Liblocks each block-specific struct embeds 38*f0d3a857SKeke Li:c:type:`c3_isp_params_block_header` as its first member and userspace 39*f0d3a857SKeke Limust populate the type member with a value from 40*f0d3a857SKeke Li:c:type:`c3_isp_params_block_type`. Once the blocks have been populated 41*f0d3a857SKeke Liinto the data buffer, the combined size of all populated blocks shall be set in 42*f0d3a857SKeke Lithe data_size member of :c:type:`c3_isp_params_cfg`. For example: 43*f0d3a857SKeke Li 44*f0d3a857SKeke Li.. code-block:: c 45*f0d3a857SKeke Li 46*f0d3a857SKeke Li struct c3_isp_params_cfg *params = 47*f0d3a857SKeke Li (struct c3_isp_params_cfg *)buffer; 48*f0d3a857SKeke Li 49*f0d3a857SKeke Li params->version = C3_ISP_PARAM_BUFFER_V0; 50*f0d3a857SKeke Li params->data_size = 0; 51*f0d3a857SKeke Li 52*f0d3a857SKeke Li void *data = (void *)params->data; 53*f0d3a857SKeke Li 54*f0d3a857SKeke Li struct c3_isp_params_awb_gains *gains = 55*f0d3a857SKeke Li (struct c3_isp_params_awb_gains *)data; 56*f0d3a857SKeke Li 57*f0d3a857SKeke Li gains->header.type = C3_ISP_PARAMS_BLOCK_AWB_GAINS; 58*f0d3a857SKeke Li gains->header.flags = C3_ISP_PARAMS_BLOCK_FL_ENABLE; 59*f0d3a857SKeke Li gains->header.size = sizeof(struct c3_isp_params_awb_gains); 60*f0d3a857SKeke Li 61*f0d3a857SKeke Li gains->gr_gain = 256; 62*f0d3a857SKeke Li gains->r_gain = 256; 63*f0d3a857SKeke Li gains->b_gain = 256; 64*f0d3a857SKeke Li gains->gb_gain = 256; 65*f0d3a857SKeke Li 66*f0d3a857SKeke Li data += sizeof(struct c3_isp__params_awb_gains); 67*f0d3a857SKeke Li params->data_size += sizeof(struct c3_isp_params_awb_gains); 68*f0d3a857SKeke Li 69*f0d3a857SKeke Li struct c3_isp_params_awb_config *awb_cfg = 70*f0d3a857SKeke Li (struct c3_isp_params_awb_config *)data; 71*f0d3a857SKeke Li 72*f0d3a857SKeke Li awb_cfg->header.type = C3_ISP_PARAMS_BLOCK_AWB_CONFIG; 73*f0d3a857SKeke Li awb_cfg->header.flags = C3_ISP_PARAMS_BLOCK_FL_ENABLE; 74*f0d3a857SKeke Li awb_cfg->header.size = sizeof(struct c3_isp_params_awb_config); 75*f0d3a857SKeke Li 76*f0d3a857SKeke Li awb_cfg->tap_point = C3_ISP_AWB_STATS_TAP_BEFORE_WB; 77*f0d3a857SKeke Li awb_cfg->satur = 1; 78*f0d3a857SKeke Li awb_cfg->horiz_zones_num = 32; 79*f0d3a857SKeke Li awb_cfg->vert_zones_num = 24; 80*f0d3a857SKeke Li 81*f0d3a857SKeke Li params->data_size += sizeof(struct c3_isp_params_awb_config); 82*f0d3a857SKeke Li 83*f0d3a857SKeke LiAmlogic C3 ISP uAPI data types 84*f0d3a857SKeke Li=============================== 85*f0d3a857SKeke Li 86*f0d3a857SKeke Li.. kernel-doc:: include/uapi/linux/media/amlogic/c3-isp-config.h 87