Skip to content

Commit d619dd9

Browse files
Jacopo MondiHans Verkuil
authored andcommitted
media: v4l2-isp: Rename block_info to block_type_info
The v4l2_isp_params_block_info structure contains validation information that apply to a block -type- and not only to a specific ISP block implementation. Clarify this by renaming v4l2_isp_params_block_info in v4l2_isp_params_block_type_info and update the documentation and the users of v4l2-isp accordingly. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
1 parent 48ecdf2 commit d619dd9

5 files changed

Lines changed: 35 additions & 32 deletions

File tree

drivers/media/platform/amlogic/c3/isp/c3-isp-params.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ static const c3_isp_block_handler c3_isp_params_handlers[] = {
536536
.size = sizeof(struct c3_isp_params_ ## data), \
537537
}
538538

539-
static const struct v4l2_isp_params_block_info c3_isp_params_blocks_info[] = {
539+
static const struct v4l2_isp_params_block_type_info
540+
c3_isp_params_block_types_info[] = {
540541
C3_ISP_PARAMS_BLOCK_INFO(AWB_GAINS, awb_gains),
541542
C3_ISP_PARAMS_BLOCK_INFO(AWB_CONFIG, awb_config),
542543
C3_ISP_PARAMS_BLOCK_INFO(AE_CONFIG, ae_config),
@@ -548,7 +549,7 @@ static const struct v4l2_isp_params_block_info c3_isp_params_blocks_info[] = {
548549
};
549550

550551
static_assert(ARRAY_SIZE(c3_isp_params_handlers) ==
551-
ARRAY_SIZE(c3_isp_params_blocks_info));
552+
ARRAY_SIZE(c3_isp_params_block_types_info));
552553

553554
static void c3_isp_params_cfg_blocks(struct c3_isp_params *params)
554555
{
@@ -781,8 +782,8 @@ static int c3_isp_params_vb2_buf_prepare(struct vb2_buffer *vb)
781782

782783
return v4l2_isp_params_validate_buffer(params->isp->dev, vb,
783784
(struct v4l2_isp_params_buffer *)cfg,
784-
c3_isp_params_blocks_info,
785-
ARRAY_SIZE(c3_isp_params_blocks_info));
785+
c3_isp_params_block_types_info,
786+
ARRAY_SIZE(c3_isp_params_block_types_info));
786787
}
787788

788789
static int c3_isp_params_vb2_buf_init(struct vb2_buffer *vb)

drivers/media/platform/arm/mali-c55/mali-c55-params.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ static const mali_c55_params_handler mali_c55_params_handlers[] = {
428428
[MALI_C55_PARAM_MESH_SHADING_SELECTION] = &mali_c55_params_lsc_selection,
429429
};
430430

431-
static const struct v4l2_isp_params_block_info mali_c55_params_blocks_info[] = {
431+
static const struct v4l2_isp_params_block_type_info
432+
mali_c55_params_block_types_info[] = {
432433
[MALI_C55_PARAM_BLOCK_SENSOR_OFFS] = {
433434
.size = sizeof(struct mali_c55_params_sensor_off_preshading),
434435
},
@@ -599,8 +600,8 @@ static int mali_c55_params_buf_prepare(struct vb2_buffer *vb)
599600
memcpy(buf->config, config, v4l2_isp_params_buffer_size(MALI_C55_PARAMS_MAX_SIZE));
600601

601602
return v4l2_isp_params_validate_buffer(mali_c55->dev, vb, buf->config,
602-
mali_c55_params_blocks_info,
603-
ARRAY_SIZE(mali_c55_params_blocks_info));
603+
mali_c55_params_block_types_info,
604+
ARRAY_SIZE(mali_c55_params_block_types_info));
604605
}
605606

606607
static void mali_c55_params_buf_queue(struct vb2_buffer *vb)

drivers/media/platform/rockchip/rkisp1/rkisp1-params.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,8 @@ static const struct rkisp1_ext_params_handler {
21982198
.size = sizeof(struct rkisp1_ext_params_ ## data ## _config), \
21992199
}
22002200

2201-
static const struct v4l2_isp_params_block_info rkisp1_ext_params_blocks_info[] = {
2201+
static const struct v4l2_isp_params_block_type_info
2202+
rkisp1_ext_params_block_types_info[] = {
22022203
RKISP1_PARAMS_BLOCK_INFO(BLS, bls),
22032204
RKISP1_PARAMS_BLOCK_INFO(DPCC, dpcc),
22042205
RKISP1_PARAMS_BLOCK_INFO(SDG, sdg),
@@ -2223,7 +2224,7 @@ static const struct v4l2_isp_params_block_info rkisp1_ext_params_blocks_info[] =
22232224
};
22242225

22252226
static_assert(ARRAY_SIZE(rkisp1_ext_params_handlers) ==
2226-
ARRAY_SIZE(rkisp1_ext_params_blocks_info));
2227+
ARRAY_SIZE(rkisp1_ext_params_block_types_info));
22272228

22282229
static void rkisp1_ext_params_config(struct rkisp1_params *params,
22292230
struct rkisp1_ext_params_cfg *cfg,
@@ -2677,8 +2678,8 @@ static int rkisp1_params_prepare_ext_params(struct rkisp1_params *params,
26772678

26782679
return v4l2_isp_params_validate_buffer(params->rkisp1->dev, vb,
26792680
(struct v4l2_isp_params_buffer *)cfg,
2680-
rkisp1_ext_params_blocks_info,
2681-
ARRAY_SIZE(rkisp1_ext_params_blocks_info));
2681+
rkisp1_ext_params_block_types_info,
2682+
ARRAY_SIZE(rkisp1_ext_params_block_types_info));
26822683
}
26832684

26842685
static int rkisp1_params_vb2_buf_prepare(struct vb2_buffer *vb)

drivers/media/v4l2-core/v4l2-isp.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ EXPORT_SYMBOL_GPL(v4l2_isp_params_validate_buffer_size);
3838

3939
int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
4040
const struct v4l2_isp_params_buffer *buffer,
41-
const struct v4l2_isp_params_block_info *info,
42-
size_t num_blocks)
41+
const struct v4l2_isp_params_block_type_info *type_info,
42+
size_t num_block_types)
4343
{
4444
size_t header_size = offsetof(struct v4l2_isp_params_buffer, data);
4545
size_t payload_size = vb2_get_plane_payload(vb, 0);
@@ -71,13 +71,13 @@ int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
7171
/* Walk the list of ISP configuration blocks and validate them. */
7272
buffer_size = buffer->data_size;
7373
while (buffer_size >= sizeof(struct v4l2_isp_params_block_header)) {
74-
const struct v4l2_isp_params_block_info *block_info;
74+
const struct v4l2_isp_params_block_type_info *info;
7575
const struct v4l2_isp_params_block_header *block;
7676

7777
block = (const struct v4l2_isp_params_block_header *)
7878
(buffer->data + block_offset);
7979

80-
if (block->type >= num_blocks) {
80+
if (block->type >= num_block_types) {
8181
dev_dbg(dev,
8282
"Invalid block type %u at offset %zu\n",
8383
block->type, block_offset);
@@ -100,17 +100,17 @@ int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
100100
}
101101

102102
/*
103-
* Match the block reported size against the info provided
103+
* Match the block reported size against the type info provided
104104
* one, but allow the block to only contain the header in
105105
* case it is going to be disabled.
106106
*/
107-
block_info = &info[block->type];
108-
if (block->size != block_info->size &&
107+
info = &type_info[block->type];
108+
if (block->size != info->size &&
109109
(!(block->flags & V4L2_ISP_PARAMS_FL_BLOCK_DISABLE) ||
110110
block->size != sizeof(*block))) {
111111
dev_dbg(dev,
112112
"Invalid block size %u (expected %zu) at offset %zu\n",
113-
block->size, block_info->size, block_offset);
113+
block->size, info->size, block_offset);
114114
return -EINVAL;
115115
}
116116

include/media/v4l2-isp.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ int v4l2_isp_params_validate_buffer_size(struct device *dev,
4949
size_t max_size);
5050

5151
/**
52-
* struct v4l2_isp_params_block_info - V4L2 ISP per-block info
53-
* @size: the block expected size
52+
* struct v4l2_isp_params_block_type_info - V4L2 ISP per-block-type info
53+
* @size: the block type expected size
5454
*
55-
* The v4l2_isp_params_block_info collects information of the ISP configuration
56-
* blocks for validation purposes. It currently only contains the expected
57-
* block size.
55+
* The v4l2_isp_params_block_type_info collects information of the ISP
56+
* configuration block types for validation purposes. It currently only contains
57+
* the expected block type size.
5858
*
59-
* Drivers shall prepare a list of block info, indexed by block type, one for
60-
* each supported ISP block and correctly populate them with the expected block
61-
* size.
59+
* Drivers shall prepare a list of block type info, indexed by block type, one
60+
* for each supported ISP block type and correctly populate them with the
61+
* expected block type size.
6262
*/
63-
struct v4l2_isp_params_block_info {
63+
struct v4l2_isp_params_block_type_info {
6464
size_t size;
6565
};
6666

@@ -69,8 +69,8 @@ struct v4l2_isp_params_block_info {
6969
* @dev: the driver's device pointer
7070
* @vb: the videobuf2 buffer
7171
* @buffer: the V4L2 ISP parameters buffer
72-
* @info: the list of per-block validation info
73-
* @num_blocks: the number of blocks
72+
* @type_info: the array of per-block-type validation info
73+
* @num_block_types: the number of block types in the type_info array
7474
*
7575
* This function completes the validation of a V4L2 ISP parameters buffer,
7676
* verifying each configuration block correctness before the driver can use
@@ -85,7 +85,7 @@ struct v4l2_isp_params_block_info {
8585
*/
8686
int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
8787
const struct v4l2_isp_params_buffer *buffer,
88-
const struct v4l2_isp_params_block_info *info,
89-
size_t num_blocks);
88+
const struct v4l2_isp_params_block_type_info *type_info,
89+
size_t num_block_types);
9090

9191
#endif /* _V4L2_ISP_H_ */

0 commit comments

Comments
 (0)