summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>2026-06-30 09:41:27 +0200
committerHans Verkuil <hverkuil+cisco@kernel.org>2026-07-28 11:36:46 +0200
commitbb401df68c06b13db7f1f4de97d7c588b9e22a03 (patch)
tree750c7e8482217afcb278c3aa4037ba2eeb56aa66 /include
parentf499befeb668436b67bdb2b610b34db57732703f (diff)
downloadlinux-stable-bb401df68c06b13db7f1f4de97d7c588b9e22a03.tar.gz
linux-stable-bb401df68c06b13db7f1f4de97d7c588b9e22a03.zip
media: mali-c55: Add support for CCM
Add support for the CCM (Color Correction Matrix) for the Mali C55 ISP. Define a new block in the uAPI using the extensible v4l2-isp format and implement support for configuring the CCM parameters in the mali-c55 ISP driver. Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/uapi/linux/media/arm/mali-c55-config.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/include/uapi/linux/media/arm/mali-c55-config.h b/include/uapi/linux/media/arm/mali-c55-config.h
index 3d335f950eeb..0b18863f973d 100644
--- a/include/uapi/linux/media/arm/mali-c55-config.h
+++ b/include/uapi/linux/media/arm/mali-c55-config.h
@@ -219,6 +219,7 @@ struct mali_c55_stats_buffer {
* @MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP: Auto-white balance gains for AEXP-0 tap
* @MALI_C55_PARAM_MESH_SHADING_CONFIG : Mesh shading tables configuration
* @MALI_C55_PARAM_MESH_SHADING_SELECTION: Mesh shading table selection
+ * @MALI_C55_PARAM_BLOCK_CCM: Colour correction matrix
*/
enum mali_c55_param_block_type {
MALI_C55_PARAM_BLOCK_SENSOR_OFFS,
@@ -232,6 +233,7 @@ enum mali_c55_param_block_type {
MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP,
MALI_C55_PARAM_MESH_SHADING_CONFIG,
MALI_C55_PARAM_MESH_SHADING_SELECTION,
+ MALI_C55_PARAM_BLOCK_CCM,
};
/**
@@ -758,6 +760,42 @@ struct mali_c55_params_mesh_shading_selection {
};
/**
+ * struct mali_c55_params_ccm - Coefficients, offsets and gains for the colour
+ * correction matrix
+ *
+ * The colour correction module converts images data from a sensor-specific
+ * colour space to known one.
+ *
+ * Colour correction is applied after demosaicing and each pixel is represented
+ * as a column vector of the three RGB colour channels on which the following
+ * operations take place:
+ * 1) An offset is subtracted from each colour channel
+ * 2) Each colour channel is multiplied by a gain
+ * 3) The pixel column vector is multiplied by the colour correction matrix
+ *
+ * This struct allows users to configure the coefficients for CCM and the
+ * per-channel offsets and gains. The nine matrix coefficients are expressed as
+ * 13 bits signed Q4.8 Sign/Magnitude fixed-point numbers, the three gain
+ * multipliers are expressed as 12 bits unsigned Q4.8 fixed-point numbers and
+ * the three offsets are expressed as a 12 bits unsigned integers.
+ *
+ * header.type should be set to MALI_C55_PARAM_BLOCK_CCM from
+ * :c:type:`mali_c55_param_block_type`.
+ *
+ * @header: The Mali-C55 parameters block header
+ * @coeffs: 3x3 color conversion matrix coefficients in sign/magnitude
+ * Q4.8 format
+ * @gains: Gains for red, green and blue channels in unsigned Q4.8 format
+ * @offs: Offsets for red, green and blue channels
+ */
+struct mali_c55_params_ccm {
+ struct v4l2_isp_params_block_header header;
+ __u16 coeffs[3][3];
+ __u16 gains[3];
+ __u16 offs[3];
+};
+
+/**
* define MALI_C55_PARAMS_MAX_SIZE - Maximum size of all Mali C55 Parameters
*
* Though the parameters for the Mali-C55 are passed as optional blocks, the
@@ -780,6 +818,7 @@ struct mali_c55_params_mesh_shading_selection {
sizeof(struct mali_c55_params_awb_config) + \
sizeof(struct mali_c55_params_awb_gains) + \
sizeof(struct mali_c55_params_mesh_shading_config) + \
- sizeof(struct mali_c55_params_mesh_shading_selection))
+ sizeof(struct mali_c55_params_mesh_shading_selection) + \
+ sizeof(struct mali_c55_params_ccm))
#endif /* __UAPI_MALI_C55_CONFIG_H */