drivers/staging/media/imx/imx-ic-prp.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/imx/imx-ic-prp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/imx/imx-ic-prp.c- Extension
.c- Size
- 11972 bytes
- Lines
- 529
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/interrupt.hlinux/module.hlinux/sched.hlinux/slab.hlinux/spinlock.hlinux/timer.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/v4l2-subdev.hmedia/imx.himx-media.himx-ic.h
Detected Declarations
struct prp_privfunction prp_startfunction prp_stopfunction prp_enum_mbus_codefunction prp_get_fmtfunction prp_set_fmtfunction prp_link_setupfunction prp_link_validatefunction prp_s_streamfunction prp_get_frame_intervalfunction prp_set_frame_intervalfunction prp_registeredfunction prp_initfunction prp_remove
Annotated Snippet
struct prp_priv {
struct imx_ic_priv *ic_priv;
struct media_pad pad[PRP_NUM_PADS];
/* lock to protect all members below */
struct mutex lock;
struct v4l2_subdev *src_sd;
struct v4l2_subdev *sink_sd_prpenc;
struct v4l2_subdev *sink_sd_prpvf;
/* the CSI id at link validate */
int csi_id;
struct v4l2_mbus_framefmt format_mbus;
struct v4l2_fract frame_interval;
int stream_count;
};
static inline struct prp_priv *sd_to_priv(struct v4l2_subdev *sd)
{
struct imx_ic_priv *ic_priv = v4l2_get_subdevdata(sd);
return ic_priv->task_priv;
}
static int prp_start(struct prp_priv *priv)
{
struct imx_ic_priv *ic_priv = priv->ic_priv;
bool src_is_vdic;
/* set IC to receive from CSI or VDI depending on source */
src_is_vdic = !!(priv->src_sd->grp_id & IMX_MEDIA_GRP_ID_IPU_VDIC);
ipu_set_ic_src_mux(ic_priv->ipu, priv->csi_id, src_is_vdic);
return 0;
}
static void prp_stop(struct prp_priv *priv)
{
}
static struct v4l2_mbus_framefmt *
__prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state,
unsigned int pad, enum v4l2_subdev_format_whence which)
{
if (which == V4L2_SUBDEV_FORMAT_TRY)
return v4l2_subdev_state_get_format(sd_state, pad);
else
return &priv->format_mbus;
}
/*
* V4L2 subdev operations.
*/
static int prp_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{
struct prp_priv *priv = sd_to_priv(sd);
struct v4l2_mbus_framefmt *infmt;
int ret = 0;
mutex_lock(&priv->lock);
switch (code->pad) {
case PRP_SINK_PAD:
ret = imx_media_enum_ipu_formats(&code->code, code->index,
PIXFMT_SEL_YUV_RGB);
break;
case PRP_SRC_PAD_PRPENC:
case PRP_SRC_PAD_PRPVF:
if (code->index != 0) {
ret = -EINVAL;
goto out;
}
infmt = __prp_get_fmt(priv, sd_state, PRP_SINK_PAD,
code->which);
code->code = infmt->code;
break;
default:
ret = -EINVAL;
}
out:
mutex_unlock(&priv->lock);
return ret;
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/interrupt.h`, `linux/module.h`, `linux/sched.h`, `linux/slab.h`, `linux/spinlock.h`, `linux/timer.h`, `media/v4l2-ctrls.h`.
- Detected declarations: `struct prp_priv`, `function prp_start`, `function prp_stop`, `function prp_enum_mbus_code`, `function prp_get_fmt`, `function prp_set_fmt`, `function prp_link_setup`, `function prp_link_validate`, `function prp_s_stream`, `function prp_get_frame_interval`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.