drivers/gpu/drm/i915/display/intel_dp_link_training.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_dp_link_training.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_dp_link_training.c- Extension
.c- Size
- 67193 bytes
- Lines
- 2236
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/iopoll.hdrm/display/drm_dp_helper.hdrm/drm_print.hintel_display_core.hintel_display_jiffies.hintel_display_types.hintel_display_utils.hintel_dp.hintel_dp_link_training.hintel_encoder.hintel_hdmi.hintel_hotplug.hintel_panel.hintel_psr.h
Detected Declarations
function intel_dp_reset_lttpr_common_capsfunction intel_dp_reset_lttpr_countfunction intel_dp_read_lttpr_phy_capsfunction intel_dp_read_lttpr_common_capsfunction intel_dp_set_lttpr_transparent_modefunction intel_dp_lttpr_transparent_mode_enabledfunction intel_dp_init_lttpr_physfunction intel_dp_init_lttprfunction intel_dp_read_dprx_capsfunction supportedfunction dp_voltage_maxfunction intel_dp_lttpr_voltage_maxfunction intel_dp_lttpr_preemph_maxfunction intel_dp_phy_is_downstream_of_sourcefunction intel_dp_phy_voltage_maxfunction intel_dp_phy_preemph_maxfunction has_per_lane_signal_levelsfunction intel_dp_get_lane_adjust_tx_ffe_presetfunction intel_dp_get_lane_adjust_vswing_preemphfunction intel_dp_get_lane_adjust_trainfunction intel_dp_get_adjust_trainfunction intel_dp_training_pattern_set_regfunction intel_dp_set_link_trainfunction dp_training_pattern_namefunction intel_dp_program_link_training_patternfunction intel_dp_set_signal_levelsfunction intel_dp_reset_link_trainfunction intel_dp_update_link_trainfunction intel_dp_lane_max_tx_ffe_reachedfunction intel_dp_lane_max_vswing_reachedfunction intel_dp_link_max_vswing_reachedfunction intel_dp_link_training_set_modefunction intel_dp_pr_with_as_sdp_enabledfunction intel_dp_update_downspread_ctrlfunction intel_dp_link_training_set_bwfunction Sequencefunction intel_dp_use_post_lt_adj_reqfunction intel_dp_update_link_bw_setfunction intel_dp_prepare_link_trainfunction MUXfunction intel_dp_adjust_request_changedfunction intel_dp_dump_link_statusfunction intel_dp_link_training_clock_recoveryfunction intel_dp_link_training_channel_equalizationfunction intel_dp_post_lt_adj_reqfunction intel_dp_stop_post_lt_adj_reqfunction intel_dp_disable_dpcd_training_patternfunction intel_dp_128b132b_intra_hop
Annotated Snippet
if (intel_dp_is_uhbr(crtc_state)) {
if (!intel_dp_lane_max_tx_ffe_reached(train_set_lane))
return false;
} else {
if (!intel_dp_lane_max_vswing_reached(train_set_lane))
return false;
}
}
return true;
}
void intel_dp_link_training_set_mode(struct intel_dp *intel_dp, int link_rate,
bool is_vrr,
bool pr_with_as_sdp_enable)
{
u8 link_config[2];
link_config[0] = is_vrr ? DP_MSA_TIMING_PAR_IGNORE_EN : 0;
link_config[0] |= pr_with_as_sdp_enable ? DP_FIXED_VTOTAL_AS_SDP_EN_IN_PR_ACTIVE : 0;
link_config[1] = drm_dp_is_uhbr_rate(link_rate) ?
DP_SET_ANSI_128B132B : DP_SET_ANSI_8B10B;
drm_dp_dpcd_write(&intel_dp->aux, DP_DOWNSPREAD_CTRL, link_config, 2);
}
static bool
intel_dp_pr_with_as_sdp_enabled(struct intel_dp *intel_dp,
const struct intel_crtc_state *crtc_state)
{
return intel_psr_needs_alpm_aux_less(intel_dp, crtc_state) &&
(crtc_state->infoframes.enable &
intel_hdmi_infoframe_enable(DP_SDP_ADAPTIVE_SYNC));
}
static void intel_dp_update_downspread_ctrl(struct intel_dp *intel_dp,
const struct intel_crtc_state *crtc_state)
{
/*
* Currently, we set the MSA ignore bit based on vrr.in_range.
* We can't really read that out during driver load since we don't have
* the connector information read in yet. So if we do end up doing a
* modeset during initial_commit() we'll clear the MSA ignore bit.
* GOP likely wouldn't have set this bit so after the initial commit,
* if there are no modesets and we enable VRR mode seamlessly
* (without a full modeset), the MSA ignore bit might never get set.
*
* #TODO: Implement readout of vrr.in_range.
* We need fastset support for setting the MSA ignore bit in DPCD,
* especially on the first real commit when clearing the inherited flag.
*/
intel_dp_link_training_set_mode(intel_dp,
crtc_state->port_clock,
crtc_state->vrr.in_range,
intel_dp_pr_with_as_sdp_enabled(intel_dp, crtc_state));
}
void intel_dp_link_training_set_bw(struct intel_dp *intel_dp,
int link_bw, int rate_select, int lane_count,
bool enhanced_framing, bool post_lt_adj_req)
{
if (enhanced_framing)
lane_count |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
if (post_lt_adj_req)
lane_count |= DP_POST_LT_ADJ_REQ_GRANTED;
if (link_bw) {
/* DP and eDP v1.3 and earlier link bw set method. */
u8 link_config[] = { link_bw, lane_count };
drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_BW_SET, link_config,
ARRAY_SIZE(link_config));
} else {
/*
* eDP v1.4 and later link rate set method.
*
* eDP v1.4x sinks shall ignore DP_LINK_RATE_SET if
* DP_LINK_BW_SET is set. Avoid writing DP_LINK_BW_SET.
*
* eDP v1.5 sinks allow choosing either, and the last choice
* shall be active.
*/
drm_dp_dpcd_writeb(&intel_dp->aux, DP_LANE_COUNT_SET, lane_count);
drm_dp_dpcd_writeb(&intel_dp->aux, DP_LINK_RATE_SET, rate_select);
}
}
/*
* Pick Training Pattern Sequence (TPS) for channel equalization. 128b/132b TPS2
* for UHBR+, TPS4 for HBR3 or for 1.4 devices that support it, TPS3 for HBR2 or
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/iopoll.h`, `drm/display/drm_dp_helper.h`, `drm/drm_print.h`, `intel_display_core.h`, `intel_display_jiffies.h`, `intel_display_types.h`, `intel_display_utils.h`.
- Detected declarations: `function intel_dp_reset_lttpr_common_caps`, `function intel_dp_reset_lttpr_count`, `function intel_dp_read_lttpr_phy_caps`, `function intel_dp_read_lttpr_common_caps`, `function intel_dp_set_lttpr_transparent_mode`, `function intel_dp_lttpr_transparent_mode_enabled`, `function intel_dp_init_lttpr_phys`, `function intel_dp_init_lttpr`, `function intel_dp_read_dprx_caps`, `function supported`.
- 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.