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