drivers/gpu/drm/vc4/vc4_vec.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vc4/vc4_vec.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vc4/vc4_vec.c- Extension
.c- Size
- 22377 bytes
- Lines
- 850
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- 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
drm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hlinux/clk.hlinux/component.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hvc4_drv.hvc4_regs.h
Detected Declarations
struct vc4_vec_variantstruct vc4_vecstruct vc4_vec_tv_modeenum vc4_vec_tv_mode_idfunction vc4_vec_tv_mode_lookupfunction vc4_vec_connector_detectfunction vc4_vec_connector_resetfunction vc4_vec_connector_set_propertyfunction vc4_vec_connector_get_propertyfunction vc4_vec_connector_initfunction vc4_vec_encoder_disablefunction vc4_vec_encoder_enablefunction vc4_vec_encoder_atomic_checkfunction vc4_vec_late_registerfunction vc4_vec_bindfunction vc4_vec_dev_probefunction vc4_vec_dev_remove
Annotated Snippet
struct vc4_vec_variant {
u32 dac_config;
};
/* General VEC hardware state. */
struct vc4_vec {
struct vc4_encoder encoder;
struct drm_connector connector;
struct platform_device *pdev;
const struct vc4_vec_variant *variant;
void __iomem *regs;
struct clk *clock;
struct drm_property *legacy_tv_mode_property;
struct debugfs_regset32 regset;
};
#define VEC_READ(offset) \
({ \
kunit_fail_current_test("Accessing a register in a unit test!\n"); \
readl(vec->regs + (offset)); \
})
#define VEC_WRITE(offset, val) \
do { \
kunit_fail_current_test("Accessing a register in a unit test!\n"); \
writel(val, vec->regs + (offset)); \
} while (0)
#define encoder_to_vc4_vec(_encoder) \
container_of_const(_encoder, struct vc4_vec, encoder.base)
#define connector_to_vc4_vec(_connector) \
container_of_const(_connector, struct vc4_vec, connector)
enum vc4_vec_tv_mode_id {
VC4_VEC_TV_MODE_NTSC,
VC4_VEC_TV_MODE_NTSC_J,
VC4_VEC_TV_MODE_PAL,
VC4_VEC_TV_MODE_PAL_M,
VC4_VEC_TV_MODE_NTSC_443,
VC4_VEC_TV_MODE_PAL_60,
VC4_VEC_TV_MODE_PAL_N,
VC4_VEC_TV_MODE_SECAM,
VC4_VEC_TV_MODE_MONOCHROME,
};
struct vc4_vec_tv_mode {
unsigned int mode;
u16 expected_htotal;
u32 config0;
u32 config1;
u32 custom_freq;
};
static const struct debugfs_reg32 vec_regs[] = {
VC4_REG32(VEC_WSE_CONTROL),
VC4_REG32(VEC_WSE_WSS_DATA),
VC4_REG32(VEC_WSE_VPS_DATA1),
VC4_REG32(VEC_WSE_VPS_CONTROL),
VC4_REG32(VEC_REVID),
VC4_REG32(VEC_CONFIG0),
VC4_REG32(VEC_SCHPH),
VC4_REG32(VEC_CLMP0_START),
VC4_REG32(VEC_CLMP0_END),
VC4_REG32(VEC_FREQ3_2),
VC4_REG32(VEC_FREQ1_0),
VC4_REG32(VEC_CONFIG1),
VC4_REG32(VEC_CONFIG2),
VC4_REG32(VEC_INTERRUPT_CONTROL),
VC4_REG32(VEC_INTERRUPT_STATUS),
VC4_REG32(VEC_FCW_SECAM_B),
VC4_REG32(VEC_SECAM_GAIN_VAL),
VC4_REG32(VEC_CONFIG3),
VC4_REG32(VEC_STATUS0),
VC4_REG32(VEC_MASK0),
VC4_REG32(VEC_CFG),
VC4_REG32(VEC_DAC_TEST),
VC4_REG32(VEC_DAC_CONFIG),
VC4_REG32(VEC_DAC_MISC),
};
static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
{
.mode = DRM_MODE_TV_MODE_NTSC,
.expected_htotal = 858,
Annotation
- Immediate include surface: `drm/drm_atomic_helper.h`, `drm/drm_drv.h`, `drm/drm_edid.h`, `drm/drm_panel.h`, `drm/drm_print.h`, `drm/drm_probe_helper.h`, `drm/drm_simple_kms_helper.h`, `linux/clk.h`.
- Detected declarations: `struct vc4_vec_variant`, `struct vc4_vec`, `struct vc4_vec_tv_mode`, `enum vc4_vec_tv_mode_id`, `function vc4_vec_tv_mode_lookup`, `function vc4_vec_connector_detect`, `function vc4_vec_connector_reset`, `function vc4_vec_connector_set_property`, `function vc4_vec_connector_get_property`, `function vc4_vec_connector_init`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.