[PATCH RESEND 21/45] media: uapi: add Qualcomm IFE parameters
From: Gjorgji . Rosikopulos . gjorgji . rosikopulos
Date: Wed Oct 07 2026 - 05:11:19 EST
From: Atanas Filipov <atanas.filipov@xxxxxxxxxxxxxxxx>
Define the parameter buffer used to configure Qualcomm IFE image
processing modules.
Signed-off-by: Atanas Filipov <atanas.filipov@xxxxxxxxxxxxxxxx>
---
include/uapi/linux/qcom-camss-config.h | 157 +++++++++++++++++++++++--
1 file changed, 150 insertions(+), 7 deletions(-)
diff --git a/include/uapi/linux/qcom-camss-config.h b/include/uapi/linux/qcom-camss-config.h
index aa3d97cfcc78..b44f80bf850a 100644
--- a/include/uapi/linux/qcom-camss-config.h
+++ b/include/uapi/linux/qcom-camss-config.h
@@ -11,6 +11,16 @@
#include <linux/types.h>
#include <linux/media/v4l2-isp.h>
+/* Number of entries in each gamma channel LUT. */
+#define CAMSS_GAMMA_LUT_SIZE 256
+
+/* Max number of lsc blocks */
+#define CAMSS_IFE_MAX_LSC_BLOCKS (17 * 13)
+/* Gamma table size for CAMSS_IFE_PARAMS_GAMMA_64 (v10x native LUT width) */
+#define CAMSS_IFE_GAMMA_64_SIZE 64
+/* Gamma table size for CAMSS_IFE_PARAMS_GAMMA_256 (v41x native LUT width) */
+#define CAMSS_IFE_GAMMA_256_SIZE 256
+
/**
* enum camss_params_block_type - CAMSS ISP parameter block identifiers
*
@@ -25,17 +35,34 @@
* &struct camss_params_color_correct
* @CAMSS_PARAMS_GAMMA: per-channel gamma correction curves (CLC_GLUT),
* &struct camss_params_gamma
+ * @CAMSS_IFE_PARAMS_WB_GAIN: IFE per-channel white balance gains,
+ * &struct camss_ife_params_wb_gain
+ * @CAMSS_IFE_PARAMS_COLOR_CORRECT: IFE color correction matrix,
+ * &struct camss_ife_params_color_correct
+ * @CAMSS_IFE_PARAMS_LSC: IFE lens shading correction,
+ * &struct camss_ife_params_lsc
+ * @CAMSS_IFE_PARAMS_GAMMA_64: IFE 64-entry gamma correction curves, used by
+ * IFE hardware generations whose native GLUT LUT is 64 entries wide,
+ * &struct camss_ife_params_gamma_64
+ * @CAMSS_IFE_PARAMS_GAMMA_256: IFE 256-entry gamma correction curves, used
+ * by IFE hardware generations whose native GLUT LUT is 256 entries
+ * wide, &struct camss_ife_params_gamma_256
+ * @CAMSS_IFE_PARAMS_BG_STATS: enable/disable the IFE bayer grid 3A
+ * statistics engine, &struct camss_ife_params_bg_stats
*/
enum camss_params_block_type {
- CAMSS_PARAMS_WB_GAIN = 1,
- CAMSS_PARAMS_CHROMA_ENHAN = 2,
- CAMSS_PARAMS_COLOR_CORRECT = 3,
- CAMSS_PARAMS_GAMMA = 4,
+ CAMSS_PARAMS_WB_GAIN = 1,
+ CAMSS_PARAMS_CHROMA_ENHAN = 2,
+ CAMSS_PARAMS_COLOR_CORRECT = 3,
+ CAMSS_PARAMS_GAMMA = 4,
+ CAMSS_IFE_PARAMS_WB_GAIN = 5,
+ CAMSS_IFE_PARAMS_COLOR_CORRECT = 6,
+ CAMSS_IFE_PARAMS_LSC = 8,
+ CAMSS_IFE_PARAMS_GAMMA_64 = 9,
+ CAMSS_IFE_PARAMS_GAMMA_256 = 10,
+ CAMSS_IFE_PARAMS_BG_STATS = 11,
};
-/* Number of entries in each gamma channel LUT. */
-#define CAMSS_GAMMA_LUT_SIZE 256
-
/**
* struct camss_params_wb_gain - White Balance gains
*
@@ -209,4 +236,120 @@ struct camss_params_gamma {
sizeof(struct camss_params_color_correct) +\
sizeof(struct camss_params_gamma))
+/**
+ * struct camss_ife_params_wb_gain - IFE per channel gains configuration.
+ *
+ * @header: block header; @header.type = CAMSS_IFE_PARAMS_WB_GAIN
+ * @r: Red channel gain in U15Q10 format (max 0x7fff, i.e. ~31.999).
+ * @b: Blue channel gain in U15Q10 format (max 0x7fff, i.e. ~31.999).
+ * @g: Green channel gain in U15Q10 format (max 0x7fff, i.e. ~31.999).
+ * @_pad: padding for 64-bit alignment, must be zero.
+ */
+struct camss_ife_params_wb_gain {
+ struct v4l2_isp_params_block_header header;
+ __u16 r;
+ __u16 b;
+ __u16 g;
+ __u16 _pad;
+} __attribute__((aligned(8)));
+
+/**
+ * struct camss_ife_params_color_correct - IFE color correction configuration.
+ *
+ * @header: block header; @header.type = CAMSS_IFE_PARAMS_COLOR_CORRECT
+ * @coeff: 3x3 RGB to RGB matrix. Values are in S12Q8 format.
+ * @offset: Offset values in (S12Q8 format).
+ */
+struct camss_ife_params_color_correct {
+ struct v4l2_isp_params_block_header header;
+ __u16 coeff[3][3];
+ __u16 offset[3];
+} __attribute__((aligned(8)));
+
+/**
+ * struct camss_ife_params_gamma_64 - IFE gamma correction configuration
+ * (64-entry, v10x native).
+ *
+ * Each DMI table word packs two fields so the hardware can
+ * piecewise-linearly interpolate between adjacent LUT entries from a
+ * single DMI read:
+ * bits [9:0]: base - this index's curve value (10-bit unsigned)
+ * bits [19:10]: delta - signed difference to the *next* index's value
+ * (10-bit signed, two's complement)
+ *
+ * @header: block header; @header.type = CAMSS_IFE_PARAMS_GAMMA_64
+ * @table_r: Pre-calculated DMI table values for the red channel.
+ * @table_g: Pre-calculated DMI table values for the green channel.
+ * @table_b: Pre-calculated DMI table values for the blue channel.
+ */
+struct camss_ife_params_gamma_64 {
+ struct v4l2_isp_params_block_header header;
+ __u32 table_r[CAMSS_IFE_GAMMA_64_SIZE];
+ __u32 table_g[CAMSS_IFE_GAMMA_64_SIZE];
+ __u32 table_b[CAMSS_IFE_GAMMA_64_SIZE];
+} __attribute__((aligned(8)));
+
+/**
+ * struct camss_ife_params_gamma_256 - IFE gamma correction configuration
+ * (256-entry, v41x native).
+ *
+ * Same DMI table word packing as &struct camss_ife_params_gamma_64, just
+ * with a 256-entry table matching the wider GLUT DMI address field of this
+ * generation's hardware:
+ * bits [9:0]: base - this index's curve value (10-bit unsigned)
+ * bits [19:10]: delta - signed difference to the *next* index's value
+ * (10-bit signed, two's complement)
+ *
+ * @header: block header; @header.type = CAMSS_IFE_PARAMS_GAMMA_256
+ * @table_r: Pre-calculated DMI table values for the red channel.
+ * @table_g: Pre-calculated DMI table values for the green channel.
+ * @table_b: Pre-calculated DMI table values for the blue channel.
+ */
+struct camss_ife_params_gamma_256 {
+ struct v4l2_isp_params_block_header header;
+ __u32 table_r[CAMSS_IFE_GAMMA_256_SIZE];
+ __u32 table_g[CAMSS_IFE_GAMMA_256_SIZE];
+ __u32 table_b[CAMSS_IFE_GAMMA_256_SIZE];
+} __attribute__((aligned(8)));
+
+/**
+ * struct camss_ife_params_lsc - IFE lens shading configuration.
+ *
+ * @header: block header; @header.type = CAMSS_IFE_PARAMS_LSC
+ * @num_hor_blocks: Number of horizontal blocks.
+ * @num_ver_blocks: Number of vertical blocks.
+ * @_pad: padding for 64-bit alignment, must be zero.
+ * @table_r: Pre-calculated DMI table values for the red channel.
+ * @table_b: Pre-calculated DMI table values for the blue channel.
+ */
+struct camss_ife_params_lsc {
+ struct v4l2_isp_params_block_header header;
+ __u8 num_hor_blocks;
+ __u8 num_ver_blocks;
+ __u16 _pad[3];
+
+ __u32 table_r[CAMSS_IFE_MAX_LSC_BLOCKS];
+ __u32 table_b[CAMSS_IFE_MAX_LSC_BLOCKS];
+} __attribute__((aligned(8)));
+
+/**
+ * struct camss_ife_params_bg_stats - IFE bayer grid 3A statistics enable.
+ *
+ * @header: block header; @header.type = CAMSS_IFE_PARAMS_BG_STATS. Carries
+ * no payload of its own: the engine is enabled or disabled purely via
+ * V4L2_ISP_PARAMS_FL_BLOCK_ENABLE/_DISABLE in @header.flags, using the
+ * grid geometry already configured for the active stream.
+ */
+struct camss_ife_params_bg_stats {
+ struct v4l2_isp_params_block_header header;
+} __attribute__((aligned(8)));
+
+#define CAMSS_IFE_PARAMS_MAX_PAYLOAD \
+ (sizeof(struct camss_ife_params_wb_gain) +\
+ sizeof(struct camss_ife_params_color_correct) +\
+ sizeof(struct camss_ife_params_gamma_64) +\
+ sizeof(struct camss_ife_params_gamma_256) +\
+ sizeof(struct camss_ife_params_lsc) +\
+ sizeof(struct camss_ife_params_bg_stats))
+
#endif /* _UAPI_LINUX_QCOM_CAMSS_CONFIG_H */
--
2.34.1