drivers/media/platform/rockchip/rkcif/rkcif-common.h

Source file repositories/reference/linux-study-clean/drivers/media/platform/rockchip/rkcif/rkcif-common.h

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/rockchip/rkcif/rkcif-common.h
Extension
.h
Size
5222 bytes
Lines
251
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rkcif_buffer {
	struct vb2_v4l2_buffer vb;
	struct list_head queue;
	dma_addr_t buff_addr[VIDEO_MAX_PLANES];
	bool is_dummy;
};

struct rkcif_dummy_buffer {
	struct rkcif_buffer buffer;
	void *vaddr;
	u32 size;
};

enum rkcif_plane_index {
	RKCIF_PLANE_Y,
	RKCIF_PLANE_UV,
	RKCIF_PLANE_MAX
};

struct rkcif_input_fmt {
	u32 mbus_code;

	enum rkcif_format_type fmt_type;
	enum v4l2_field field;

	union {
		u32 dvp_fmt_val;
	};
};

struct rkcif_output_fmt {
	u32 fourcc;
	u32 mbus_code;
	u8 cplanes;
	u8 depth;

	union {
		u32 dvp_fmt_val;
		struct {
			u8 dt;
			bool compact;
			enum rkcif_mipi_format_type type;
		} mipi;
	};
};

struct rkcif_interface;

struct rkcif_remote {
	struct v4l2_async_connection async_conn;
	struct v4l2_subdev *sd;

	struct rkcif_interface *interface;
};

struct rkcif_stream {
	enum rkcif_id_index id;
	struct rkcif_device *rkcif;
	struct rkcif_interface *interface;
	const struct rkcif_output_fmt *out_fmts;
	unsigned int out_fmts_num;

	/* in ping-pong mode, two buffers can be provided to the HW */
	struct rkcif_buffer *buffers[2];
	int frame_idx;
	int frame_phase;

	/* in case of no available buffer, HW can write to the dummy buffer */
	struct rkcif_dummy_buffer dummy;

	bool stopping;
	wait_queue_head_t wq_stopped;

	/* queue of available buffers plus spinlock that protects it */
	spinlock_t driver_queue_lock;
	struct list_head driver_queue;

	/* lock used by the V4L2 core */
	struct mutex vlock;

	struct media_pad pad;
	struct media_pipeline pipeline;
	struct v4l2_pix_format_mplane pix;
	struct vb2_queue buf_queue;
	struct video_device vdev;

	void (*queue_buffer)(struct rkcif_stream *stream, unsigned int index);
	int (*start_streaming)(struct rkcif_stream *stream);
	void (*stop_streaming)(struct rkcif_stream *stream);
};

Annotation

Implementation Notes