drivers/media/platform/aspeed/aspeed-video.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/aspeed/aspeed-video.c
Extension
.c
Size
72275 bytes
Lines
2398
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 aspeed_video_addr {
	unsigned int size;
	dma_addr_t dma;
	void *virt;
};

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

struct aspeed_video_perf {
	ktime_t last_sample;
	u32 totaltime;
	u32 duration;
	u32 duration_min;
	u32 duration_max;
};

#define to_aspeed_video_buffer(x) \
	container_of((x), struct aspeed_video_buffer, vb)

/*
 * struct aspeed_video - driver data
 *
 * version:		holds the version of aspeed SoC
 * res_work:		holds the delayed_work for res-detection if unlock
 * buffers:		holds the list of buffer queued from user
 * flags:		holds the state of video
 * sequence:		holds the last number of frame completed
 * max_compressed_size:	holds max compressed stream's size
 * srcs:		holds the buffer information for srcs
 * jpeg:		holds the buffer information for jpeg header
 * bcd:			holds the buffer information for bcd work
 * yuv420:		a flag raised if JPEG subsampling is 420
 * format:		holds the video format
 * hq_mode:		a flag raised if HQ is enabled. Only for VIDEO_FMT_ASPEED
 * input:		holds the video input
 * frame_rate:		holds the frame_rate
 * jpeg_quality:	holds jpeq's quality (0~11)
 * jpeg_hq_quality:	holds hq's quality (1~12) only if hq_mode enabled
 * frame_bottom:	end position of video data in vertical direction
 * frame_left:		start position of video data in horizontal direction
 * frame_right:		end position of video data in horizontal direction
 * frame_top:		start position of video data in vertical direction
 * perf:		holds the statistics primary for debugfs
 */
struct aspeed_video {
	void __iomem *base;
	struct clk *eclk;
	struct clk *vclk;
	struct reset_control *reset;

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

	struct regmap *scu;
	struct regmap *gfx;
	u32 version;
	u32 jpeg_mode;
	u32 comp_size_read;

	wait_queue_head_t wait;
	spinlock_t lock;		/* buffer list lock */
	struct delayed_work res_work;
	struct list_head buffers;
	unsigned long flags;
	unsigned int sequence;

	unsigned int max_compressed_size;
	struct aspeed_video_addr srcs[2];
	struct aspeed_video_addr jpeg;
	struct aspeed_video_addr bcd;

	bool yuv420;
	enum aspeed_video_format format;
	bool hq_mode;
	enum aspeed_video_input input;
	unsigned int frame_rate;
	unsigned int jpeg_quality;
	unsigned int jpeg_hq_quality;

Annotation

Implementation Notes