drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/arm/mali-c55/mali-c55-resizer.c- Extension
.c- Size
- 37952 bytes
- Lines
- 1158
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/math.hlinux/minmax.hmedia/media-entity.hmedia/v4l2-subdev.hmali-c55-common.hmali-c55-registers.h
Detected Declarations
function Copyrightfunction mali_c55_rsz_calculate_bankfunction mali_c55_resizer_program_coefficientsfunction mali_c55_rsz_program_cropfunction mali_c55_rsz_program_resizerfunction mali_c55_rsz_programfunction twofunction mali_c55_rsz_shift_mbus_codefunction __mali_c55_rsz_set_routingfunction mali_c55_rsz_enum_mbus_codefunction mali_c55_rsz_enum_frame_sizefunction mali_c55_rsz_set_sink_fmtfunction mali_c55_rsz_set_source_fmtfunction mali_c55_rsz_set_fmtfunction mali_c55_rsz_get_selectionfunction mali_c55_rsz_set_cropfunction mali_c55_rsz_set_composefunction mali_c55_rsz_set_selectionfunction mali_c55_rsz_set_routingfunction mali_c55_rsz_enable_streamsfunction mali_c55_rsz_disable_streamsfunction mali_c55_rsz_init_statefunction mali_c55_register_resizerfunction mali_c55_unregister_resizerfunction mali_c55_register_resizersfunction mali_c55_unregister_resizers
Annotated Snippet
if (++active_routes > 1) {
dev_dbg(rsz->mali_c55->dev,
"Only one route can be active");
return -EINVAL;
}
active_sink = route->sink_pad;
}
if (active_sink == UINT_MAX) {
dev_dbg(rsz->mali_c55->dev, "One route has to be active");
return -EINVAL;
}
ret = v4l2_subdev_set_routing(sd, state, routing);
if (ret) {
dev_dbg(rsz->mali_c55->dev, "Failed to set routing\n");
return ret;
}
fmt = v4l2_subdev_state_get_format(state, active_sink, 0);
fmt->width = MALI_C55_DEFAULT_WIDTH;
fmt->height = MALI_C55_DEFAULT_HEIGHT;
fmt->colorspace = V4L2_COLORSPACE_SRGB;
fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace);
fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace);
fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(false,
fmt->colorspace,
fmt->ycbcr_enc);
fmt->field = V4L2_FIELD_NONE;
if (active_sink == MALI_C55_RSZ_SINK_PAD) {
struct v4l2_rect *crop, *compose;
fmt->code = MEDIA_BUS_FMT_RGB121212_1X36;
crop = v4l2_subdev_state_get_crop(state, active_sink, 0);
compose = v4l2_subdev_state_get_compose(state, active_sink, 0);
crop->left = 0;
crop->top = 0;
crop->width = MALI_C55_DEFAULT_WIDTH;
crop->height = MALI_C55_DEFAULT_HEIGHT;
*compose = *crop;
} else {
fmt->code = MEDIA_BUS_FMT_SRGGB20_1X20;
}
/* Propagate the format to the source pad */
src_fmt = v4l2_subdev_state_get_format(state, MALI_C55_RSZ_SOURCE_PAD,
0);
*src_fmt = *fmt;
/* In the event this is the bypass pad the mbus code needs correcting */
if (active_sink == MALI_C55_RSZ_SINK_BYPASS_PAD)
src_fmt->code = mali_c55_rsz_shift_mbus_code(src_fmt->code);
return 0;
}
static int mali_c55_rsz_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
struct v4l2_subdev_mbus_code_enum *code)
{
const struct mali_c55_isp_format_info *fmt;
struct v4l2_mbus_framefmt *sink_fmt;
u32 sink_pad;
switch (code->pad) {
case MALI_C55_RSZ_SINK_PAD:
if (code->index)
return -EINVAL;
code->code = MEDIA_BUS_FMT_RGB121212_1X36;
return 0;
case MALI_C55_RSZ_SOURCE_PAD:
sink_pad = mali_c55_rsz_get_active_sink(state);
sink_fmt = v4l2_subdev_state_get_format(state, sink_pad, 0);
/*
* If the active route is from the Bypass sink pad, then the
* source pad is a simple passthrough of the sink format,
* downshifted to 16-bits.
*/
if (sink_pad == MALI_C55_RSZ_SINK_BYPASS_PAD) {
if (code->index)
return -EINVAL;
Annotation
- Immediate include surface: `linux/math.h`, `linux/minmax.h`, `media/media-entity.h`, `media/v4l2-subdev.h`, `mali-c55-common.h`, `mali-c55-registers.h`.
- Detected declarations: `function Copyright`, `function mali_c55_rsz_calculate_bank`, `function mali_c55_resizer_program_coefficients`, `function mali_c55_rsz_program_crop`, `function mali_c55_rsz_program_resizer`, `function mali_c55_rsz_program`, `function two`, `function mali_c55_rsz_shift_mbus_code`, `function __mali_c55_rsz_set_routing`, `function mali_c55_rsz_enum_mbus_code`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.