Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: uapi: Convert RkISP1 to V4L2 extensible params

With the introduction of common types for extensible parameters
format, convert the rkisp1-config.h header to use the new types.

Factor out the documentation that is now part of the common header
and only keep the driver-specific on in place.

The conversion to use common types doesn't impact userspace as the
new types are either identical to the ones already existing in the
RkISP1 uAPI or are 1-to-1 type convertible.

Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Michael Riesch <michael.riesch@collabora.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Jacopo Mondi and committed by
Hans Verkuil
1e8152db e36dbd1c

+24 -83
+24 -83
include/uapi/linux/rkisp1-config.h
··· 7 7 #ifndef _UAPI_RKISP1_CONFIG_H 8 8 #define _UAPI_RKISP1_CONFIG_H 9 9 10 + #ifdef __KERNEL__ 11 + #include <linux/build_bug.h> 12 + #endif /* __KERNEL__ */ 10 13 #include <linux/types.h> 14 + 15 + #include <linux/media/v4l2-isp.h> 11 16 12 17 /* Defect Pixel Cluster Detection */ 13 18 #define RKISP1_CIF_ISP_MODULE_DPCC (1U << 0) ··· 1163 1158 RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR, 1164 1159 }; 1165 1160 1166 - #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE (1U << 0) 1167 - #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE (1U << 1) 1161 + /* For backward compatibility */ 1162 + #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE V4L2_ISP_PARAMS_FL_BLOCK_DISABLE 1163 + #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE V4L2_ISP_PARAMS_FL_BLOCK_ENABLE 1168 1164 1169 1165 /* A bitmask of parameters blocks supported on the current hardware. */ 1170 1166 #define RKISP1_CID_SUPPORTED_PARAMS_BLOCKS (V4L2_CID_USER_RKISP1_BASE + 0x01) 1171 1167 1172 1168 /** 1173 - * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block 1174 - * header 1169 + * rkisp1_ext_params_block_header - RkISP1 extensible parameters block header 1175 1170 * 1176 1171 * This structure represents the common part of all the ISP configuration 1177 - * blocks. Each parameters block shall embed an instance of this structure type 1178 - * as its first member, followed by the block-specific configuration data. The 1179 - * driver inspects this common header to discern the block type and its size and 1180 - * properly handle the block content by casting it to the correct block-specific 1181 - * type. 1172 + * blocks and is identical to :c:type:`v4l2_isp_params_block_header`. 1182 1173 * 1183 - * The @type field is one of the values enumerated by 1174 + * The type field is one of the values enumerated by 1184 1175 * :c:type:`rkisp1_ext_params_block_type` and specifies how the data should be 1185 - * interpreted by the driver. The @size field specifies the size of the 1186 - * parameters block and is used by the driver for validation purposes. 1176 + * interpreted by the driver. 1187 1177 * 1188 - * The @flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*. 1189 - * 1190 - * When userspace wants to configure and enable an ISP block it shall fully 1191 - * populate the block configuration and set the 1192 - * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE bit in the @flags field. 1193 - * 1194 - * When userspace simply wants to disable an ISP block the 1195 - * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bit should be set in @flags field. The 1196 - * driver ignores the rest of the block configuration structure in this case. 1197 - * 1198 - * If a new configuration of an ISP block has to be applied userspace shall 1199 - * fully populate the ISP block configuration and omit setting the 1200 - * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits 1201 - * in the @flags field. 1202 - * 1203 - * Setting both the RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and 1204 - * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits in the @flags field is not allowed 1205 - * and not accepted by the driver. 1206 - * 1207 - * Userspace is responsible for correctly populating the parameters block header 1208 - * fields (@type, @flags and @size) and the block-specific parameters. 1209 - * 1210 - * For example: 1211 - * 1212 - * .. code-block:: c 1213 - * 1214 - * void populate_bls(struct rkisp1_ext_params_block_header *block) { 1215 - * struct rkisp1_ext_params_bls_config *bls = 1216 - * (struct rkisp1_ext_params_bls_config *)block; 1217 - * 1218 - * bls->header.type = RKISP1_EXT_PARAMS_BLOCK_ID_BLS; 1219 - * bls->header.flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; 1220 - * bls->header.size = sizeof(*bls); 1221 - * 1222 - * bls->config.enable_auto = 0; 1223 - * bls->config.fixed_val.r = blackLevelRed_; 1224 - * bls->config.fixed_val.gr = blackLevelGreenR_; 1225 - * bls->config.fixed_val.gb = blackLevelGreenB_; 1226 - * bls->config.fixed_val.b = blackLevelBlue_; 1227 - * } 1228 - * 1229 - * @type: The parameters block type, see 1230 - * :c:type:`rkisp1_ext_params_block_type` 1231 - * @flags: A bitmask of block flags 1232 - * @size: Size (in bytes) of the parameters block, including this header 1178 + * The flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*. 1233 1179 */ 1234 - struct rkisp1_ext_params_block_header { 1235 - __u16 type; 1236 - __u16 flags; 1237 - __u32 size; 1238 - }; 1180 + #define rkisp1_ext_params_block_header v4l2_isp_params_block_header 1239 1181 1240 1182 /** 1241 1183 * struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config ··· 1540 1588 * @RKISP1_EXT_PARAM_BUFFER_V1: First version of RkISP1 extensible parameters 1541 1589 */ 1542 1590 enum rksip1_ext_param_buffer_version { 1543 - RKISP1_EXT_PARAM_BUFFER_V1 = 1, 1591 + RKISP1_EXT_PARAM_BUFFER_V1 = V4L2_ISP_PARAMS_VERSION_V1, 1544 1592 }; 1545 1593 1546 1594 /** 1547 1595 * struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration 1548 1596 * 1549 - * This struct contains the configuration parameters of the RkISP1 ISP 1550 - * algorithms, serialized by userspace into a data buffer. Each configuration 1551 - * parameter block is represented by a block-specific structure which contains a 1552 - * :c:type:`rkisp1_ext_params_block_header` entry as first member. Userspace 1553 - * populates the @data buffer with configuration parameters for the blocks that 1554 - * it intends to configure. As a consequence, the data buffer effective size 1555 - * changes according to the number of ISP blocks that userspace intends to 1556 - * configure and is set by userspace in the @data_size field. 1557 - * 1558 - * The parameters buffer is versioned by the @version field to allow modifying 1559 - * and extending its definition. Userspace shall populate the @version field to 1560 - * inform the driver about the version it intends to use. The driver will parse 1561 - * and handle the @data buffer according to the data layout specific to the 1562 - * indicated version and return an error if the desired version is not 1563 - * supported. 1597 + * This is the driver-specific implementation of 1598 + * :c:type:`v4l2_isp_params_buffer`. 1564 1599 * 1565 1600 * Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported. 1566 1601 * When a new format version will be added, a mechanism for userspace to query ··· 1562 1623 * of the control represents the blocks supported by the device instance, while 1563 1624 * the maximum value represents the blocks supported by the kernel driver, 1564 1625 * independently of the device instance. 1565 - * 1566 - * For each ISP block that userspace wants to configure, a block-specific 1567 - * structure is appended to the @data buffer, one after the other without gaps 1568 - * in between nor overlaps. Userspace shall populate the @data_size field with 1569 - * the effective size, in bytes, of the @data buffer. 1570 1626 * 1571 1627 * The expected memory layout of the parameters buffer is:: 1572 1628 * ··· 1611 1677 __u32 data_size; 1612 1678 __u8 data[RKISP1_EXT_PARAMS_MAX_SIZE]; 1613 1679 }; 1680 + 1681 + #ifdef __KERNEL__ 1682 + /* Make sure the header is type-convertible to the generic v4l2 params one */ 1683 + static_assert((sizeof(struct rkisp1_ext_params_cfg) - 1684 + RKISP1_EXT_PARAMS_MAX_SIZE) == 1685 + sizeof(struct v4l2_isp_params_buffer)); 1686 + #endif /* __KERNEL__ */ 1614 1687 1615 1688 #endif /* _UAPI_RKISP1_CONFIG_H */