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