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.
- 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/atomic.hlinux/bitfield.hlinux/cleanup.hlinux/clk.hlinux/delay.hlinux/device.hlinux/dma-mapping.hlinux/interrupt.hlinux/jiffies.hlinux/module.hlinux/mutex.hlinux/of.hlinux/of_irq.hlinux/of_reserved_mem.hlinux/platform_device.hlinux/sched.hlinux/spinlock.hlinux/string.hlinux/v4l2-controls.hlinux/videodev2.hlinux/wait.hlinux/workqueue.hlinux/debugfs.hlinux/ktime.hlinux/reset.hlinux/regmap.hlinux/mfd/syscon.hmedia/v4l2-ctrls.hmedia/v4l2-dev.hmedia/v4l2-device.hmedia/v4l2-dv-timings.hmedia/v4l2-event.h
Detected Declarations
struct aspeed_video_addrstruct aspeed_video_bufferstruct aspeed_video_perfstruct aspeed_videostruct aspeed_video_configenum aspeed_video_formatenum aspeed_video_capture_formatfunction aspeed_video_init_jpeg_tablefunction aspeed_video_update_jpeg_tablefunction aspeed_video_updatefunction aspeed_video_readfunction aspeed_video_writefunction update_perffunction aspeed_video_start_framefunction aspeed_video_enable_mode_detectfunction aspeed_video_offfunction aspeed_video_onfunction aspeed_video_resetfunction aspeed_video_bufs_donefunction aspeed_video_irq_res_changefunction aspeed_video_swap_src_buffunction aspeed_video_irqfunction aspeed_video_check_and_set_polarityfunction aspeed_video_alloc_buffunction aspeed_video_free_buffunction aspeed_video_calc_compressed_sizefunction aspeed_video_get_timingsfunction aspeed_video_get_resolution_gfxfunction aspeed_video_get_resolution_vgafunction aspeed_video_get_resolutionfunction aspeed_video_set_resolutionfunction aspeed_video_update_timingsfunction aspeed_video_update_regsfunction aspeed_video_init_regsfunction aspeed_video_startfunction aspeed_video_stopfunction aspeed_video_querycapfunction aspeed_video_enum_formatfunction aspeed_video_get_formatfunction aspeed_video_set_formatfunction aspeed_video_enum_inputfunction aspeed_video_get_inputfunction aspeed_video_set_inputfunction aspeed_video_get_parmfunction aspeed_video_set_parmfunction aspeed_video_enum_framesizesfunction aspeed_video_enum_frameintervalsfunction aspeed_video_set_dv_timings
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
- Immediate include surface: `linux/atomic.h`, `linux/bitfield.h`, `linux/cleanup.h`, `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/interrupt.h`.
- Detected declarations: `struct aspeed_video_addr`, `struct aspeed_video_buffer`, `struct aspeed_video_perf`, `struct aspeed_video`, `struct aspeed_video_config`, `enum aspeed_video_format`, `enum aspeed_video_capture_format`, `function aspeed_video_init_jpeg_table`, `function aspeed_video_update_jpeg_table`, `function aspeed_video_update`.
- Atlas domain: Driver Families / drivers/media.
- 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.