drivers/media/platform/renesas/vsp1/vsp1_rwpf.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/vsp1/vsp1_rwpf.c- Extension
.c- Size
- 10945 bytes
- Lines
- 383
- 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
media/v4l2-subdev.hvsp1.hvsp1_entity.hvsp1_rwpf.hvsp1_video.h
Detected Declarations
function vsp1_rwpf_enum_mbus_codefunction vsp1_rwpf_enum_frame_sizefunction vsp1_rwpf_set_formatfunction vsp1_rwpf_get_selectionfunction vsp1_rwpf_set_selectionfunction vsp1_rwpf_s_ctrlfunction vsp1_rwpf_init_ctrls
Annotated Snippet
if (csc && (flags & V4L2_MBUS_FRAMEFMT_SET_CSC)) {
format->ycbcr_enc = fmt->format.ycbcr_enc;
format->quantization = fmt->format.quantization;
} else {
format->ycbcr_enc = sink_format->ycbcr_enc;
format->quantization = sink_format->quantization;
}
vsp1_entity_adjust_color_space(format);
fmt->format = *format;
fmt->format.flags = flags;
return 0;
}
format->code = fmt->format.code;
format->width = clamp_t(unsigned int, fmt->format.width,
RWPF_MIN_WIDTH, rwpf->entity.max_width);
format->height = clamp_t(unsigned int, fmt->format.height,
RWPF_MIN_HEIGHT, rwpf->entity.max_height);
format->field = V4L2_FIELD_NONE;
format->colorspace = fmt->format.colorspace;
format->xfer_func = fmt->format.xfer_func;
format->ycbcr_enc = fmt->format.ycbcr_enc;
format->quantization = fmt->format.quantization;
vsp1_entity_adjust_color_space(format);
fmt->format = *format;
if (rwpf->entity.type == VSP1_ENTITY_RPF) {
struct v4l2_rect *crop;
/* Update the sink crop rectangle. */
crop = v4l2_subdev_state_get_crop(state, RWPF_PAD_SINK);
crop->left = 0;
crop->top = 0;
crop->width = fmt->format.width;
crop->height = fmt->format.height;
}
/* Propagate the format to the source pad. */
format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE);
*format = fmt->format;
if (rwpf->flip.rotate) {
format->width = fmt->format.height;
format->height = fmt->format.width;
}
return 0;
}
static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{
struct vsp1_rwpf *rwpf = to_rwpf(subdev);
struct v4l2_subdev_state *state;
struct v4l2_mbus_framefmt *format;
/*
* Cropping is only supported on the RPF and is implemented on the sink
* pad.
*/
if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK)
return -EINVAL;
guard(mutex)(&rwpf->entity.lock);
state = vsp1_entity_get_state(&rwpf->entity, sd_state, sel->which);
if (!state)
return -EINVAL;
switch (sel->target) {
case V4L2_SEL_TGT_CROP:
sel->r = *v4l2_subdev_state_get_crop(state, RWPF_PAD_SINK);
break;
case V4L2_SEL_TGT_CROP_BOUNDS:
format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK);
sel->r.left = 0;
sel->r.top = 0;
sel->r.width = format->width;
sel->r.height = format->height;
break;
default:
Annotation
- Immediate include surface: `media/v4l2-subdev.h`, `vsp1.h`, `vsp1_entity.h`, `vsp1_rwpf.h`, `vsp1_video.h`.
- Detected declarations: `function vsp1_rwpf_enum_mbus_code`, `function vsp1_rwpf_enum_frame_size`, `function vsp1_rwpf_set_format`, `function vsp1_rwpf_get_selection`, `function vsp1_rwpf_set_selection`, `function vsp1_rwpf_s_ctrl`, `function vsp1_rwpf_init_ctrls`.
- 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.