drivers/media/platform/ti/vpe/vpe.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/vpe/vpe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/ti/vpe/vpe.c- Extension
.c- Size
- 69125 bytes
- Lines
- 2659
- 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/delay.hlinux/dma-mapping.hlinux/err.hlinux/fs.hlinux/interrupt.hlinux/io.hlinux/ioctl.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hlinux/sched.hlinux/slab.hlinux/videodev2.hlinux/log2.hlinux/sizes.hmedia/v4l2-common.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/v4l2-mem2mem.hmedia/videobuf2-v4l2.hmedia/videobuf2-dma-contig.hvpdma.hvpdma_priv.hvpe_regs.hsc.hcsc.h
Detected Declarations
struct vpe_us_coeffsstruct vpe_dei_regsstruct vpe_port_datastruct vpe_fmtstruct vpe_q_datastruct vpe_devstruct vpe_ctxstruct vpe_mmr_adbfunction read_regfunction write_regfunction get_fieldfunction read_field_regfunction write_fieldfunction write_field_regfunction init_adb_hdrsfunction outputfunction free_mv_buffersfunction free_vbsfunction vpe_set_clock_enablefunction vpe_top_resetfunction vpe_top_vpdma_resetfunction set_us_coefficientsfunction set_cfg_modesfunction set_line_modesfunction set_src_registersfunction set_dst_registersfunction set_dei_regsfunction set_dei_shadow_registersfunction config_edi_input_modefunction set_srcdst_paramsfunction job_readyfunction job_abortfunction vpe_dump_regsfunction add_out_dtdfunction add_in_dtdfunction enable_irqsfunction disable_irqsfunction device_runfunction dei_errorfunction ds1_uv_errorfunction vpe_irqfunction vpe_querycapfunction __enum_fmtfunction vpe_enum_fmtfunction vpe_g_fmtfunction __vpe_try_fmtfunction vpe_try_fmtfunction __vpe_s_fmt
Annotated Snippet
struct vpe_us_coeffs {
unsigned short anchor_fid0_c0;
unsigned short anchor_fid0_c1;
unsigned short anchor_fid0_c2;
unsigned short anchor_fid0_c3;
unsigned short interp_fid0_c0;
unsigned short interp_fid0_c1;
unsigned short interp_fid0_c2;
unsigned short interp_fid0_c3;
unsigned short anchor_fid1_c0;
unsigned short anchor_fid1_c1;
unsigned short anchor_fid1_c2;
unsigned short anchor_fid1_c3;
unsigned short interp_fid1_c0;
unsigned short interp_fid1_c1;
unsigned short interp_fid1_c2;
unsigned short interp_fid1_c3;
};
/*
* Default upsampler coefficients
*/
static const struct vpe_us_coeffs us_coeffs[] = {
{
/* Coefficients for progressive input */
0x00C8, 0x0348, 0x0018, 0x3FD8, 0x3FB8, 0x0378, 0x00E8, 0x3FE8,
0x00C8, 0x0348, 0x0018, 0x3FD8, 0x3FB8, 0x0378, 0x00E8, 0x3FE8,
},
{
/* Coefficients for Top Field Interlaced input */
0x0051, 0x03D5, 0x3FE3, 0x3FF7, 0x3FB5, 0x02E9, 0x018F, 0x3FD3,
/* Coefficients for Bottom Field Interlaced input */
0x016B, 0x0247, 0x00B1, 0x3F9D, 0x3FCF, 0x03DB, 0x005D, 0x3FF9,
},
};
/*
* the following registers are for configuring some of the parameters of the
* motion and edge detection blocks inside DEI, these generally remain the same,
* these could be passed later via userspace if some one needs to tweak these.
*/
struct vpe_dei_regs {
unsigned long mdt_spacial_freq_thr_reg; /* VPE_DEI_REG2 */
unsigned long edi_config_reg; /* VPE_DEI_REG3 */
unsigned long edi_lut_reg0; /* VPE_DEI_REG4 */
unsigned long edi_lut_reg1; /* VPE_DEI_REG5 */
unsigned long edi_lut_reg2; /* VPE_DEI_REG6 */
unsigned long edi_lut_reg3; /* VPE_DEI_REG7 */
};
/*
* default expert DEI register values, unlikely to be modified.
*/
static const struct vpe_dei_regs dei_regs = {
.mdt_spacial_freq_thr_reg = 0x020C0804u,
.edi_config_reg = 0x0118100Cu,
.edi_lut_reg0 = 0x08040200u,
.edi_lut_reg1 = 0x1010100Cu,
.edi_lut_reg2 = 0x10101010u,
.edi_lut_reg3 = 0x10101010u,
};
/*
* The port_data structure contains per-port data.
*/
struct vpe_port_data {
enum vpdma_channel channel; /* VPDMA channel */
u8 vb_index; /* input frame f, f-1, f-2 index */
u8 vb_part; /* plane index for co-panar formats */
};
/*
* Define indices into the port_data tables
*/
#define VPE_PORT_LUMA1_IN 0
#define VPE_PORT_CHROMA1_IN 1
#define VPE_PORT_LUMA2_IN 2
#define VPE_PORT_CHROMA2_IN 3
#define VPE_PORT_LUMA3_IN 4
#define VPE_PORT_CHROMA3_IN 5
#define VPE_PORT_MV_IN 6
#define VPE_PORT_MV_OUT 7
#define VPE_PORT_LUMA_OUT 8
#define VPE_PORT_CHROMA_OUT 9
#define VPE_PORT_RGB_OUT 10
static const struct vpe_port_data port_data[11] = {
[VPE_PORT_LUMA1_IN] = {
.channel = VPE_CHAN_LUMA1_IN,
.vb_index = 0,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/fs.h`, `linux/interrupt.h`, `linux/io.h`, `linux/ioctl.h`, `linux/module.h`.
- Detected declarations: `struct vpe_us_coeffs`, `struct vpe_dei_regs`, `struct vpe_port_data`, `struct vpe_fmt`, `struct vpe_q_data`, `struct vpe_dev`, `struct vpe_ctx`, `struct vpe_mmr_adb`, `function read_reg`, `function write_reg`.
- 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.