drivers/media/platform/rockchip/rkcif/rkcif-interface.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/rockchip/rkcif/rkcif-interface.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/rockchip/rkcif/rkcif-interface.c- Extension
.c- Size
- 11537 bytes
- Lines
- 444
- 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-common.hmedia/v4l2-fwnode.hmedia/v4l2-mc.hmedia/v4l2-subdev.hrkcif-common.hrkcif-interface.h
Detected Declarations
function Interfacefunction rkcif_interface_set_fmtfunction rkcif_interface_get_selfunction rkcif_interface_set_selfunction rkcif_interface_set_routingfunction rkcif_interface_apply_cropfunction rkcif_interface_enable_streamsfunction for_each_active_routefunction rkcif_interface_disable_streamsfunction rkcif_interface_init_statefunction rkcif_interface_addfunction rkcif_interface_registerfunction rkcif_interface_unregisterfunction rkcif_interface_find_input_fmt
Annotated Snippet
for_each_active_route(&state->routing, route) {
stream = &interface->streams[route->sink_stream];
rkcif_interface_apply_crop(stream, state);
}
}
mask = v4l2_subdev_state_xlate_streams(state, RKCIF_IF_PAD_SINK,
RKCIF_IF_PAD_SRC, &streams_mask);
return v4l2_subdev_enable_streams(remote_sd, remote_pad->index, mask);
}
static int rkcif_interface_disable_streams(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
u32 pad, u64 streams_mask)
{
struct v4l2_subdev *remote_sd;
struct media_pad *remote_pad;
u64 mask;
remote_pad =
media_pad_remote_pad_first(&sd->entity.pads[RKCIF_IF_PAD_SINK]);
remote_sd = media_entity_to_v4l2_subdev(remote_pad->entity);
mask = v4l2_subdev_state_xlate_streams(state, RKCIF_IF_PAD_SINK,
RKCIF_IF_PAD_SRC, &streams_mask);
return v4l2_subdev_disable_streams(remote_sd, remote_pad->index, mask);
}
static const struct v4l2_subdev_pad_ops rkcif_interface_pad_ops = {
.get_fmt = v4l2_subdev_get_fmt,
.set_fmt = rkcif_interface_set_fmt,
.get_selection = rkcif_interface_get_sel,
.set_selection = rkcif_interface_set_sel,
.set_routing = rkcif_interface_set_routing,
.enable_streams = rkcif_interface_enable_streams,
.disable_streams = rkcif_interface_disable_streams,
};
static const struct v4l2_subdev_ops rkcif_interface_ops = {
.pad = &rkcif_interface_pad_ops,
};
static int rkcif_interface_init_state(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state)
{
struct rkcif_interface *interface = to_rkcif_interface(sd);
struct v4l2_subdev_route routes[] = {
{
.sink_pad = RKCIF_IF_PAD_SINK,
.sink_stream = 0,
.source_pad = RKCIF_IF_PAD_SRC,
.source_stream = 0,
.flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
},
};
struct v4l2_subdev_krouting routing = {
.len_routes = ARRAY_SIZE(routes),
.num_routes = ARRAY_SIZE(routes),
.routes = routes,
};
const struct v4l2_mbus_framefmt dvp_default_format = {
.width = 3840,
.height = 2160,
.code = MEDIA_BUS_FMT_YUYV8_1X16,
.field = V4L2_FIELD_NONE,
.colorspace = V4L2_COLORSPACE_REC709,
.ycbcr_enc = V4L2_YCBCR_ENC_709,
.quantization = V4L2_QUANTIZATION_LIM_RANGE,
.xfer_func = V4L2_XFER_FUNC_NONE,
};
const struct v4l2_mbus_framefmt mipi_default_format = {
.width = 3840,
.height = 2160,
.code = MEDIA_BUS_FMT_SRGGB10_1X10,
.field = V4L2_FIELD_NONE,
.colorspace = V4L2_COLORSPACE_RAW,
.ycbcr_enc = V4L2_YCBCR_ENC_601,
.quantization = V4L2_QUANTIZATION_FULL_RANGE,
.xfer_func = V4L2_XFER_FUNC_NONE,
};
const struct v4l2_mbus_framefmt *default_format;
int ret;
default_format = (interface->type == RKCIF_IF_DVP) ?
&dvp_default_format :
&mipi_default_format;
ret = v4l2_subdev_set_routing_with_fmt(sd, state, &routing,
Annotation
- Immediate include surface: `media/v4l2-common.h`, `media/v4l2-fwnode.h`, `media/v4l2-mc.h`, `media/v4l2-subdev.h`, `rkcif-common.h`, `rkcif-interface.h`.
- Detected declarations: `function Interface`, `function rkcif_interface_set_fmt`, `function rkcif_interface_get_sel`, `function rkcif_interface_set_sel`, `function rkcif_interface_set_routing`, `function rkcif_interface_apply_crop`, `function rkcif_interface_enable_streams`, `function for_each_active_route`, `function rkcif_interface_disable_streams`, `function rkcif_interface_init_state`.
- 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.