drivers/gpu/drm/sun4i/sun4i_tv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/sun4i/sun4i_tv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/sun4i/sun4i_tv.c- Extension
.c- Size
- 15893 bytes
- Lines
- 573
- 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
linux/clk.hlinux/component.hlinux/module.hlinux/of_address.hlinux/platform_device.hlinux/regmap.hlinux/reset.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_of.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hsun4i_crtc.hsun4i_drv.hsunxi_engine.h
Detected Declarations
struct color_gainsstruct burst_levelsstruct video_levelsstruct resync_parametersstruct tv_modestruct sun4i_tvfunction drm_encoder_to_sun4i_tvfunction sun4i_tv_find_tv_by_modefunction sun4i_tv_disablefunction sun4i_tv_enablefunction sun4i_tv_connector_resetfunction sun4i_tv_bindfunction sun4i_tv_unbindfunction sun4i_tv_probefunction sun4i_tv_remove
Annotated Snippet
struct color_gains {
u16 cb;
u16 cr;
};
struct burst_levels {
u16 cb;
u16 cr;
};
struct video_levels {
u16 black;
u16 blank;
};
struct resync_parameters {
bool field;
u16 line;
u16 pixel;
};
struct tv_mode {
char *name;
unsigned int tv_mode;
u32 mode;
u32 chroma_freq;
u16 back_porch;
u16 front_porch;
u16 vblank_level;
bool yc_en;
bool dac3_en;
bool dac_bit25_en;
const struct color_gains *color_gains;
const struct burst_levels *burst_levels;
const struct video_levels *video_levels;
const struct resync_parameters *resync_params;
};
struct sun4i_tv {
struct drm_connector connector;
struct drm_encoder encoder;
struct clk *clk;
struct regmap *regs;
struct reset_control *reset;
struct sun4i_drv *drv;
};
static const struct video_levels ntsc_video_levels = {
.black = 282, .blank = 240,
};
static const struct video_levels pal_video_levels = {
.black = 252, .blank = 252,
};
static const struct burst_levels ntsc_burst_levels = {
.cb = 79, .cr = 0,
};
static const struct burst_levels pal_burst_levels = {
.cb = 40, .cr = 40,
};
static const struct color_gains ntsc_color_gains = {
.cb = 160, .cr = 160,
};
static const struct color_gains pal_color_gains = {
.cb = 224, .cr = 224,
};
static const struct resync_parameters ntsc_resync_parameters = {
.field = false, .line = 14, .pixel = 12,
};
static const struct resync_parameters pal_resync_parameters = {
.field = true, .line = 13, .pixel = 12,
};
static const struct tv_mode tv_modes[] = {
{
.tv_mode = DRM_MODE_TV_MODE_NTSC,
.mode = SUN4I_TVE_CFG0_RES_480i,
.chroma_freq = 0x21f07c1f,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/module.h`, `linux/of_address.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/reset.h`, `drm/drm_atomic.h`.
- Detected declarations: `struct color_gains`, `struct burst_levels`, `struct video_levels`, `struct resync_parameters`, `struct tv_mode`, `struct sun4i_tv`, `function drm_encoder_to_sun4i_tv`, `function sun4i_tv_find_tv_by_mode`, `function sun4i_tv_disable`, `function sun4i_tv_enable`.
- 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.