drivers/media/platform/nuvoton/npcm-video.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/nuvoton/npcm-video.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/nuvoton/npcm-video.c
Extension
.c
Size
48447 bytes
Lines
1843
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 npcm_video_addr {
	size_t size;
	dma_addr_t dma;
	void *virt;
};

struct npcm_video_buffer {
	struct vb2_v4l2_buffer vb;
	struct list_head link;
};

#define to_npcm_video_buffer(x) \
	container_of((x), struct npcm_video_buffer, vb)

/*
 * VIDEO_STREAMING:	a flag indicating if the video has started streaming
 * VIDEO_CAPTURING:	a flag indicating if the VCD is capturing a frame
 * VIDEO_RES_CHANGING:	a flag indicating if the resolution is changing
 * VIDEO_STOPPED:	a flag indicating if the video has stopped streaming
 */
enum {
	VIDEO_STREAMING,
	VIDEO_CAPTURING,
	VIDEO_RES_CHANGING,
	VIDEO_STOPPED,
};

struct rect_list {
	struct v4l2_clip clip;
	struct list_head list;
};

struct rect_list_info {
	struct rect_list *list;
	struct rect_list *first;
	struct list_head *head;
	unsigned int index;
	unsigned int tile_perline;
	unsigned int tile_perrow;
	unsigned int offset_perline;
	unsigned int tile_size;
	unsigned int tile_cnt;
};

struct npcm_ece {
	struct regmap *regmap;
	atomic_t clients;
	struct reset_control *reset;
	bool enable;
};

struct npcm_video {
	struct regmap *gcr_regmap;
	struct regmap *gfx_regmap;
	struct regmap *vcd_regmap;

	struct device *dev;
	struct v4l2_ctrl_handler ctrl_handler;
	struct v4l2_ctrl *rect_cnt_ctrl;
	struct v4l2_device v4l2_dev;
	struct v4l2_pix_format pix_fmt;
	struct v4l2_bt_timings active_timings;
	struct v4l2_bt_timings detected_timings;
	unsigned int v4l2_input_status;
	struct vb2_queue queue;
	struct video_device vdev;
	struct mutex video_lock; /* v4l2 and videobuf2 lock */

	struct list_head buffers;
	struct mutex buffer_lock; /* buffer list lock */
	unsigned long flags;
	unsigned int sequence;

	struct npcm_video_addr src;
	struct reset_control *reset;
	struct npcm_ece ece;

	unsigned int bytesperline;
	unsigned int bytesperpixel;
	unsigned int rect_cnt;
	struct list_head list[VIDEO_MAX_FRAME];
	unsigned int rect[VIDEO_MAX_FRAME];
	unsigned int ctrl_cmd;
	unsigned int op_cmd;
};

#define to_npcm_video(x) container_of((x), struct npcm_video, v4l2_dev)

struct npcm_fmt {
	unsigned int fourcc;

Annotation

Implementation Notes