drivers/staging/media/imx/imx-media-vdic.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/imx/imx-media-vdic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/imx/imx-media-vdic.c- Extension
.c- Size
- 22090 bytes
- Lines
- 934
- 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
media/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/v4l2-mc.hmedia/v4l2-subdev.hmedia/imx.himx-media.h
Detected Declarations
struct vdic_privstruct vdic_pipeline_opsstruct vdic_privfunction vdic_put_ipu_resourcesfunction vdic_get_ipu_resourcesfunction setup_vdi_channelfunction vdic_setup_directfunction vdic_start_directfunction vdic_setup_indirectfunction vdic_start_indirectfunction vdic_stop_indirectfunction vdic_disable_indirectfunction vdic_startfunction vdic_stopfunction vdic_s_ctrlfunction vdic_init_controlsfunction vdic_s_streamfunction __vdic_get_fmtfunction vdic_enum_mbus_codefunction vdic_get_fmtfunction vdic_try_fmtfunction vdic_set_fmtfunction vdic_link_setupfunction vdic_link_validatefunction vdic_get_frame_intervalfunction vdic_set_frame_intervalfunction vdic_registeredfunction vdic_unregisteredfunction imx_media_vdic_unregister
Annotated Snippet
struct vdic_pipeline_ops {
int (*setup)(struct vdic_priv *priv);
void (*start)(struct vdic_priv *priv);
void (*stop)(struct vdic_priv *priv);
void (*disable)(struct vdic_priv *priv);
};
/*
* Min/Max supported width and heights.
*/
#define MIN_W 32
#define MIN_H 32
#define MAX_W_VDIC 968
#define MAX_H_VDIC 2048
#define W_ALIGN 4 /* multiple of 16 pixels */
#define H_ALIGN 1 /* multiple of 2 lines */
#define S_ALIGN 1 /* multiple of 2 */
struct vdic_priv {
struct device *ipu_dev;
struct ipu_soc *ipu;
struct v4l2_subdev sd;
struct media_pad pad[VDIC_NUM_PADS];
/* lock to protect all members below */
struct mutex lock;
/* IPU units we require */
struct ipu_vdi *vdi;
int active_input_pad;
struct ipuv3_channel *vdi_in_ch_p; /* F(n-1) transfer channel */
struct ipuv3_channel *vdi_in_ch; /* F(n) transfer channel */
struct ipuv3_channel *vdi_in_ch_n; /* F(n+1) transfer channel */
/* pipeline operations */
struct vdic_pipeline_ops *ops;
/* current and previous input buffers indirect path */
struct imx_media_buffer *curr_in_buf;
struct imx_media_buffer *prev_in_buf;
/*
* translated field type, input line stride, and field size
* for indirect path
*/
u32 fieldtype;
u32 in_stride;
u32 field_size;
/* the source (a video device or subdev) */
struct media_entity *src;
/* the sink that will receive the progressive out buffers */
struct v4l2_subdev *sink_sd;
struct v4l2_mbus_framefmt format_mbus[VDIC_NUM_PADS];
const struct imx_media_pixfmt *cc[VDIC_NUM_PADS];
struct v4l2_fract frame_interval[VDIC_NUM_PADS];
/* the video device at IDMAC input pad */
struct imx_media_video_dev *vdev;
bool csi_direct; /* using direct CSI->VDIC->IC pipeline */
/* motion select control */
struct v4l2_ctrl_handler ctrl_hdlr;
enum ipu_motion_sel motion;
int stream_count;
};
static void vdic_put_ipu_resources(struct vdic_priv *priv)
{
if (priv->vdi_in_ch_p)
ipu_idmac_put(priv->vdi_in_ch_p);
priv->vdi_in_ch_p = NULL;
if (priv->vdi_in_ch)
ipu_idmac_put(priv->vdi_in_ch);
priv->vdi_in_ch = NULL;
if (priv->vdi_in_ch_n)
ipu_idmac_put(priv->vdi_in_ch_n);
priv->vdi_in_ch_n = NULL;
if (!IS_ERR_OR_NULL(priv->vdi))
ipu_vdi_put(priv->vdi);
priv->vdi = NULL;
Annotation
- Immediate include surface: `media/v4l2-ctrls.h`, `media/v4l2-device.h`, `media/v4l2-ioctl.h`, `media/v4l2-mc.h`, `media/v4l2-subdev.h`, `media/imx.h`, `imx-media.h`.
- Detected declarations: `struct vdic_priv`, `struct vdic_pipeline_ops`, `struct vdic_priv`, `function vdic_put_ipu_resources`, `function vdic_get_ipu_resources`, `function setup_vdi_channel`, `function vdic_setup_direct`, `function vdic_start_direct`, `function vdic_setup_indirect`, `function vdic_start_indirect`.
- 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.