drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c- Extension
.c- Size
- 40204 bytes
- Lines
- 1292
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dm_services.hdce/dce_12_0_offset.hdce/dce_12_0_sh_mask.hsoc15_hw_ip.hvega10_ip_offset.hdc_types.hdc_bios_types.hinclude/grph_object_id.hinclude/logger_interface.hdce120_timing_generator.htiming_generator.h
Detected Declarations
function filesfunction dce120_timing_generator_validate_timingfunction dce120_tg_validate_timingfunction dce120_timing_generator_enable_crtcfunction dce120_timing_generator_set_early_controlfunction dce120_timing_generator_get_vblank_counterfunction dce120_timing_generator_get_crtc_positionfunction dce120_timing_generator_wait_for_vblankfunction dce120_timing_generator_wait_for_vactivefunction dce120_timing_generator_setup_global_swap_lockfunction dce120_timing_generator_tear_down_global_swap_lockfunction dce120_timing_generator_enable_reset_triggerfunction dce120_timing_generator_disable_reset_triggerfunction dce120_timing_generator_did_triggered_reset_occurfunction dce120_timing_generator_disable_vgafunction dce120_timing_generator_program_blankingfunction dce120_timing_generator_program_blank_colorfunction dce120_timing_generator_set_overscan_color_blackfunction dce120_timing_generator_set_drrfunction dce120_timing_generator_get_crtc_scanoutposfunction dce120_timing_generator_enable_advanced_requestfunction dce120_tg_program_blank_colorfunction dce120_tg_set_overscan_colorfunction dce120_tg_program_timingfunction dce120_tg_is_blankedfunction dce120_tg_set_blankfunction dce120_tg_wait_for_statefunction dce120_tg_set_colorsfunction dce120_timing_generator_set_static_screen_controlfunction dce120_timing_generator_set_test_patternfunction dce120_arm_vert_intrfunction dce120_is_tg_enabledfunction dce120_configure_crcfunction dce120_get_crcfunction dce120_timing_generator_construct
Annotated Snippet
if (!tg->funcs->is_counter_moving(tg)) {
/* error - no point to wait if counter is not moving */
break;
}
}
while (!dce120_timing_generator_is_in_vertical_blank(tg)) {
if (!tg->funcs->is_counter_moving(tg)) {
/* error - no point to wait if counter is not moving */
break;
}
}
}
/* wait until TG is in beginning of active region */
static void dce120_timing_generator_wait_for_vactive(struct timing_generator *tg)
{
while (dce120_timing_generator_is_in_vertical_blank(tg)) {
if (!tg->funcs->is_counter_moving(tg)) {
/* error - no point to wait if counter is not moving */
break;
}
}
}
/*********** Timing Generator Synchronization routines ****/
/* Setups Global Swap Lock group, TimingServer or TimingClient*/
static void dce120_timing_generator_setup_global_swap_lock(
struct timing_generator *tg,
const struct dcp_gsl_params *gsl_params)
{
struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
uint32_t value_crtc_vtotal =
dm_read_reg_soc15(tg->ctx,
mmCRTC0_CRTC_V_TOTAL,
tg110->offsets.crtc);
/* Checkpoint relative to end of frame */
uint32_t check_point =
get_reg_field_value(value_crtc_vtotal,
CRTC0_CRTC_V_TOTAL,
CRTC_V_TOTAL);
dm_write_reg_soc15(tg->ctx, mmCRTC0_CRTC_GSL_WINDOW, tg110->offsets.crtc, 0);
CRTC_REG_UPDATE_N(DCP0_DCP_GSL_CONTROL, 6,
/* This pipe will belong to GSL Group zero. */
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL0_EN), 1,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_MASTER_EN), gsl_params->gsl_master == tg->inst,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_HSYNC_FLIP_FORCE_DELAY), HFLIP_READY_DELAY,
/* Keep signal low (pending high) during 6 lines.
* Also defines minimum interval before re-checking signal. */
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_HSYNC_FLIP_CHECK_DELAY), HFLIP_CHECK_DELAY,
/* DCP_GSL_PURPOSE_SURFACE_FLIP */
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_SYNC_SOURCE), 0,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_DELAY_SURFACE_UPDATE_PENDING), 1);
CRTC_REG_SET_2(
CRTC0_CRTC_GSL_CONTROL,
CRTC_GSL_CHECK_LINE_NUM, check_point - FLIP_READY_BACK_LOOKUP,
CRTC_GSL_FORCE_DELAY, VFLIP_READY_DELAY);
}
/* Clear all the register writes done by setup_global_swap_lock */
static void dce120_timing_generator_tear_down_global_swap_lock(
struct timing_generator *tg)
{
struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
/* Settig HW default values from reg specs */
CRTC_REG_SET_N(DCP0_DCP_GSL_CONTROL, 6,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL0_EN), 0,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_MASTER_EN), 0,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_HSYNC_FLIP_FORCE_DELAY), HFLIP_READY_DELAY,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_HSYNC_FLIP_CHECK_DELAY), HFLIP_CHECK_DELAY,
/* DCP_GSL_PURPOSE_SURFACE_FLIP */
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_SYNC_SOURCE), 0,
FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_DELAY_SURFACE_UPDATE_PENDING), 0);
CRTC_REG_SET_2(CRTC0_CRTC_GSL_CONTROL,
CRTC_GSL_CHECK_LINE_NUM, 0,
CRTC_GSL_FORCE_DELAY, 0x2); /*TODO Why this value here ?*/
}
/* Reset slave controllers on master VSync */
static void dce120_timing_generator_enable_reset_trigger(
struct timing_generator *tg,
int source)
{
Annotation
- Immediate include surface: `dm_services.h`, `dce/dce_12_0_offset.h`, `dce/dce_12_0_sh_mask.h`, `soc15_hw_ip.h`, `vega10_ip_offset.h`, `dc_types.h`, `dc_bios_types.h`, `include/grph_object_id.h`.
- Detected declarations: `function files`, `function dce120_timing_generator_validate_timing`, `function dce120_tg_validate_timing`, `function dce120_timing_generator_enable_crtc`, `function dce120_timing_generator_set_early_control`, `function dce120_timing_generator_get_vblank_counter`, `function dce120_timing_generator_get_crtc_position`, `function dce120_timing_generator_wait_for_vblank`, `function dce120_timing_generator_wait_for_vactive`, `function dce120_timing_generator_setup_global_swap_lock`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.