xref: /linux/Documentation/userspace-api/media/v4l/metafmt-arm-mali-c55.rst (revision d7aa60d966461ca6114dc348e97889dc8850ff7f)
1.. SPDX-License-Identifier: GPL-2.0
2
3.. _v4l2-meta-fmt-mali-c55-params:
4.. _v4l2-meta-fmt-mali-c55-stats:
5
6*****************************************************************************
7V4L2_META_FMT_MALI_C55_STATS ('C55S'), V4L2_META_FMT_MALI_C55_PARAMS ('C55P')
8*****************************************************************************
9
103A Statistics
11=============
12
13The ISP device collects different statistics over an input bayer frame. Those
14statistics can be obtained by userspace from the
15:ref:`mali-c55 3a stats <mali-c55-3a-stats>` metadata capture video node, using
16the :c:type:`v4l2_meta_format` interface. The buffer contains a single instance
17of the C structure :c:type:`mali_c55_stats_buffer` defined in
18``mali-c55-config.h``, so the structure can be obtained from the buffer by:
19
20.. code-block:: C
21
22	struct mali_c55_stats_buffer *stats =
23		(struct mali_c55_stats_buffer *)buf;
24
25For details of the statistics see :c:type:`mali_c55_stats_buffer`.
26
27Configuration Parameters
28========================
29
30The configuration parameters are passed to the :ref:`mali-c55 3a params
31<mali-c55-3a-params>` metadata output video node, using the
32:c:type:`v4l2_meta_format` interface. Rather than a single struct containing
33sub-structs for each configurable area of the ISP, parameters for the Mali-C55
34use the v4l2-isp parameters system, through which groups of parameters are
35defined as distinct structs or "blocks" which may be added to the data member of
36:c:type:`v4l2_isp_params_buffer`. Userspace is responsible for populating the
37data member with the blocks that need to be configured by the driver.  Each
38block-specific struct embeds :c:type:`v4l2_isp_params_block_header` as its first
39member and userspace must populate the type member with a value from
40:c:type:`mali_c55_param_block_type`.
41
42.. code-block:: c
43
44	struct v4l2_isp_params_buffer *params =
45		(struct v4l2_isp_params_buffer *)buffer;
46
47	params->version = MALI_C55_PARAM_BUFFER_V1;
48	params->data_size = 0;
49
50	void *data = (void *)params->data;
51
52	struct mali_c55_params_awb_gains *gains =
53		(struct mali_c55_params_awb_gains *)data;
54
55	gains->header.type = MALI_C55_PARAM_BLOCK_AWB_GAINS;
56	gains->header.flags |= V4L2_ISP_PARAMS_FL_BLOCK_ENABLE;
57	gains->header.size = sizeof(struct mali_c55_params_awb_gains);
58
59	gains->gain00 = 256;
60	gains->gain00 = 256;
61	gains->gain00 = 256;
62	gains->gain00 = 256;
63
64	data += sizeof(struct mali_c55_params_awb_gains);
65	params->data_size += sizeof(struct mali_c55_params_awb_gains);
66
67	struct mali_c55_params_sensor_off_preshading *blc =
68		(struct mali_c55_params_sensor_off_preshading *)data;
69
70	blc->header.type = MALI_C55_PARAM_BLOCK_SENSOR_OFFS;
71	blc->header.flags |= V4L2_ISP_PARAMS_FL_BLOCK_ENABLE;
72	blc->header.size = sizeof(struct mali_c55_params_sensor_off_preshading);
73
74	blc->chan00 = 51200;
75	blc->chan01 = 51200;
76	blc->chan10 = 51200;
77	blc->chan11 = 51200;
78
79	params->data_size += sizeof(struct mali_c55_params_sensor_off_preshading);
80
81Arm Mali-C55 uAPI data types
82============================
83
84.. kernel-doc:: include/uapi/linux/media/arm/mali-c55-config.h
85