drivers/staging/media/imx/imx-ic-prpencvf.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/imx/imx-ic-prpencvf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/imx/imx-ic-prpencvf.c- Extension
.c- Size
- 34344 bytes
- Lines
- 1387
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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-mc.hmedia/v4l2-subdev.hmedia/imx.himx-media.himx-ic.h
Detected Declarations
struct prp_privfunction prp_put_ipu_resourcesfunction prp_get_ipu_resourcesfunction prp_vb2_buf_donefunction prp_eof_interruptfunction prp_nfb4eof_interruptfunction prp_eof_timeoutfunction prp_setup_vb2_buffunction prp_unsetup_vb2_buffunction prp_setup_channelfunction prp_setup_rotationfunction prp_unsetup_rotationfunction prp_setup_norotationfunction prp_unsetup_norotationfunction prp_unsetupfunction prp_startfunction prp_stopfunction __prp_get_fmtfunction prp_bound_align_outputfunction prp_enum_mbus_codefunction prp_get_fmtfunction prp_try_fmtfunction prp_set_fmtfunction prp_enum_frame_sizefunction prp_link_setupfunction prp_s_ctrlfunction prp_init_controlsfunction prp_s_streamfunction prp_get_frame_intervalfunction prp_set_frame_intervalfunction prp_registeredfunction prp_unregisteredfunction prp_initfunction prp_remove
Annotated Snippet
struct prp_priv {
struct imx_ic_priv *ic_priv;
struct media_pad pad[PRPENCVF_NUM_PADS];
/* the video device at output pad */
struct imx_media_video_dev *vdev;
/* lock to protect all members below */
struct mutex lock;
/* IPU units we require */
struct ipu_ic *ic;
struct ipuv3_channel *out_ch;
struct ipuv3_channel *rot_in_ch;
struct ipuv3_channel *rot_out_ch;
/* active vb2 buffers to send to video dev sink */
struct imx_media_buffer *active_vb2_buf[2];
struct imx_media_dma_buf underrun_buf;
int ipu_buf_num; /* ipu double buffer index: 0-1 */
/* the sink for the captured frames */
struct media_entity *sink;
/* the source subdev */
struct v4l2_subdev *src_sd;
struct v4l2_mbus_framefmt format_mbus[PRPENCVF_NUM_PADS];
const struct imx_media_pixfmt *cc[PRPENCVF_NUM_PADS];
struct v4l2_fract frame_interval;
struct imx_media_dma_buf rot_buf[2];
/* controls */
struct v4l2_ctrl_handler ctrl_hdlr;
int rotation; /* degrees */
bool hflip;
bool vflip;
/* derived from rotation, hflip, vflip controls */
enum ipu_rotate_mode rot_mode;
spinlock_t irqlock; /* protect eof_irq handler */
struct timer_list eof_timeout_timer;
int eof_irq;
int nfb4eof_irq;
int stream_count;
u32 frame_sequence; /* frame sequence counter */
bool last_eof; /* waiting for last EOF at stream off */
bool nfb4eof; /* NFB4EOF encountered during streaming */
bool interweave_swap; /* swap top/bottom lines when interweaving */
struct completion last_eof_comp;
};
static const struct prp_channels {
u32 out_ch;
u32 rot_in_ch;
u32 rot_out_ch;
} prp_channel[] = {
[IC_TASK_ENCODER] = {
.out_ch = IPUV3_CHANNEL_IC_PRP_ENC_MEM,
.rot_in_ch = IPUV3_CHANNEL_MEM_ROT_ENC,
.rot_out_ch = IPUV3_CHANNEL_ROT_ENC_MEM,
},
[IC_TASK_VIEWFINDER] = {
.out_ch = IPUV3_CHANNEL_IC_PRP_VF_MEM,
.rot_in_ch = IPUV3_CHANNEL_MEM_ROT_VF,
.rot_out_ch = IPUV3_CHANNEL_ROT_VF_MEM,
},
};
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 void prp_put_ipu_resources(struct prp_priv *priv)
{
if (priv->ic)
ipu_ic_put(priv->ic);
priv->ic = NULL;
if (priv->out_ch)
ipu_idmac_put(priv->out_ch);
priv->out_ch = NULL;
if (priv->rot_in_ch)
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_put_ipu_resources`, `function prp_get_ipu_resources`, `function prp_vb2_buf_done`, `function prp_eof_interrupt`, `function prp_nfb4eof_interrupt`, `function prp_eof_timeout`, `function prp_setup_vb2_buf`, `function prp_unsetup_vb2_buf`, `function prp_setup_channel`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.