drivers/media/platform/renesas/vsp1/vsp1_entity.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/vsp1/vsp1_entity.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/vsp1/vsp1_entity.c- Extension
.c- Size
- 19081 bytes
- Lines
- 678
- 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/cleanup.hlinux/device.hlinux/gfp.hlinux/mutex.hmedia/media-entity.hmedia/v4l2-ctrls.hmedia/v4l2-event.hmedia/v4l2-subdev.hvsp1.hvsp1_dl.hvsp1_entity.hvsp1_pipe.hvsp1_rwpf.h
Detected Declarations
function Copyrightfunction vsp1_entity_configure_streamfunction vsp1_entity_configure_framefunction vsp1_entity_configure_partitionfunction vsp1_entity_adjust_color_spacefunction vsp1_entity_get_statefunction vsp1_subdev_get_pad_formatfunction vsp1_subdev_enum_mbus_codefunction scoped_guardfunction vsp1_subdev_enum_frame_sizefunction vsp1_subdev_set_pad_formatfunction vsp1_entity_init_statefunction media_entity_to_vsp1_entityfunction vsp1_entity_link_setup_sourcefunction vsp1_entity_link_setup_sinkfunction vsp1_entity_link_setupfunction media_pad_remote_pad_firstfunction list_for_each_entryfunction vsp1_entity_initfunction vsp1_entity_destroy
Annotated Snippet
scoped_guard(mutex, &entity->lock) {
format = v4l2_subdev_state_get_format(state, 0);
code->code = format->code;
}
}
return 0;
}
/*
* vsp1_subdev_enum_frame_size - Subdev pad enum_frame_size handler
* @subdev: V4L2 subdevice
* @sd_state: V4L2 subdev state
* @fse: Frame size enumeration
*
* This function implements the subdev enum_frame_size pad operation for
* entities that do not support scaling or cropping. It reports the given
* minimum and maximum frame width and height on the sink pad, and a fixed
* source pad size identical to the sink pad.
*/
int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{
struct vsp1_entity *entity = to_vsp1_entity(subdev);
if (fse->index)
return -EINVAL;
if (fse->pad == 0) {
unsigned int i;
for (i = 0; i < entity->num_codes; ++i) {
if (fse->code == entity->codes[i])
break;
}
if (i == entity->num_codes)
return -EINVAL;
fse->min_width = entity->min_width;
fse->max_width = entity->max_width;
fse->min_height = entity->min_height;
fse->max_height = entity->max_height;
} else {
struct v4l2_subdev_state *state;
struct v4l2_mbus_framefmt *format;
state = vsp1_entity_get_state(entity, sd_state, fse->which);
if (!state)
return -EINVAL;
/*
* The media bus code and size on the source pad are fixed and
* always identical to the sink pad.
*/
format = v4l2_subdev_state_get_format(state, 0);
guard(mutex)(&entity->lock);
if (fse->code != format->code)
return -EINVAL;
fse->min_width = format->width;
fse->max_width = format->width;
fse->min_height = format->height;
fse->max_height = format->height;
}
return 0;
}
/*
* vsp1_subdev_set_pad_format - Subdev pad set_fmt handler
* @subdev: V4L2 subdevice
* @sd_state: V4L2 subdev state
* @fmt: V4L2 subdev format
*
* This function implements the subdev set_fmt pad operation for entities that
* do not support scaling or cropping. It defaults to the first supported media
* bus code if the requested code isn't supported, clamps the size to the
* entity's limits, and propagates the sink pad format to the source pad.
*/
int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{
struct vsp1_entity *entity = to_vsp1_entity(subdev);
struct v4l2_subdev_state *state;
struct v4l2_mbus_framefmt *format;
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/device.h`, `linux/gfp.h`, `linux/mutex.h`, `media/media-entity.h`, `media/v4l2-ctrls.h`, `media/v4l2-event.h`, `media/v4l2-subdev.h`.
- Detected declarations: `function Copyright`, `function vsp1_entity_configure_stream`, `function vsp1_entity_configure_frame`, `function vsp1_entity_configure_partition`, `function vsp1_entity_adjust_color_space`, `function vsp1_entity_get_state`, `function vsp1_subdev_get_pad_format`, `function vsp1_subdev_enum_mbus_code`, `function scoped_guard`, `function vsp1_subdev_enum_frame_size`.
- 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.