drivers/gpu/drm/amd/amdgpu/atombios_dp.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/atombios_dp.c- Extension
.c- Size
- 22223 bytes
- Lines
- 771
- 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
drm/amdgpu_drm.hdrm/display/drm_dp_helper.hamdgpu.hatom.hatom-bits.hatombios_encoders.hatombios_dp.hamdgpu_connectors.hamdgpu_atombios.h
Detected Declarations
struct amdgpu_atombios_dp_link_train_infofunction amdgpu_atombios_dp_process_aux_chfunction amdgpu_atombios_dp_aux_transferfunction amdgpu_atombios_dp_aux_initfunction amdgpu_atombios_dp_get_adjust_trainfunction amdgpu_atombios_dp_convert_bpc_to_bppfunction amdgpu_atombios_dp_get_dp_link_configfunction amdgpu_atombios_dp_encoder_servicefunction amdgpu_atombios_dp_get_sinktypefunction amdgpu_atombios_dp_probe_ouifunction amdgpu_atombios_dp_ds_portsfunction amdgpu_atombios_dp_get_dpcdfunction amdgpu_atombios_dp_get_panel_modefunction amdgpu_atombios_dp_set_link_configfunction amdgpu_atombios_dp_mode_valid_helperfunction amdgpu_atombios_dp_needs_link_trainfunction amdgpu_atombios_dp_set_rx_power_statefunction amdgpu_atombios_dp_update_vs_emphfunction amdgpu_atombios_dp_set_tpfunction amdgpu_atombios_dp_link_train_initfunction amdgpu_atombios_dp_link_train_finishfunction amdgpu_atombios_dp_link_train_crfunction amdgpu_atombios_dp_link_train_cefunction amdgpu_atombios_dp_link_train
Annotated Snippet
struct amdgpu_atombios_dp_link_train_info {
struct amdgpu_device *adev;
struct drm_encoder *encoder;
struct drm_connector *connector;
int dp_clock;
int dp_lane_count;
bool tp3_supported;
u8 dpcd[DP_RECEIVER_CAP_SIZE];
u8 train_set[4];
u8 link_status[DP_LINK_STATUS_SIZE];
u8 tries;
struct drm_dp_aux *aux;
};
static void
amdgpu_atombios_dp_update_vs_emph(struct amdgpu_atombios_dp_link_train_info *dp_info)
{
/* set the initial vs/emph on the source */
amdgpu_atombios_encoder_setup_dig_transmitter(dp_info->encoder,
ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH,
0, dp_info->train_set[0]); /* sets all lanes at once */
/* set the vs/emph on the sink */
drm_dp_dpcd_write(dp_info->aux, DP_TRAINING_LANE0_SET,
dp_info->train_set, dp_info->dp_lane_count);
}
static void
amdgpu_atombios_dp_set_tp(struct amdgpu_atombios_dp_link_train_info *dp_info, int tp)
{
int rtp = 0;
/* set training pattern on the source */
switch (tp) {
case DP_TRAINING_PATTERN_1:
rtp = ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN1;
break;
case DP_TRAINING_PATTERN_2:
rtp = ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN2;
break;
case DP_TRAINING_PATTERN_3:
rtp = ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN3;
break;
}
amdgpu_atombios_encoder_setup_dig_encoder(dp_info->encoder, rtp, 0);
/* enable training pattern on the sink */
drm_dp_dpcd_writeb(dp_info->aux, DP_TRAINING_PATTERN_SET, tp);
}
static int
amdgpu_atombios_dp_link_train_init(struct amdgpu_atombios_dp_link_train_info *dp_info)
{
struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(dp_info->encoder);
struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv;
u8 tmp;
/* power up the sink */
amdgpu_atombios_dp_set_rx_power_state(dp_info->connector, DP_SET_POWER_D0);
/* possibly enable downspread on the sink */
if (dp_info->dpcd[3] & 0x1)
drm_dp_dpcd_writeb(dp_info->aux,
DP_DOWNSPREAD_CTRL, DP_SPREAD_AMP_0_5);
else
drm_dp_dpcd_writeb(dp_info->aux,
DP_DOWNSPREAD_CTRL, 0);
if (dig->panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)
drm_dp_dpcd_writeb(dp_info->aux, DP_EDP_CONFIGURATION_SET, 1);
/* set the lane count on the sink */
tmp = dp_info->dp_lane_count;
if (drm_dp_enhanced_frame_cap(dp_info->dpcd))
tmp |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
drm_dp_dpcd_writeb(dp_info->aux, DP_LANE_COUNT_SET, tmp);
/* set the link rate on the sink */
tmp = drm_dp_link_rate_to_bw_code(dp_info->dp_clock);
drm_dp_dpcd_writeb(dp_info->aux, DP_LINK_BW_SET, tmp);
/* start training on the source */
amdgpu_atombios_encoder_setup_dig_encoder(dp_info->encoder,
ATOM_ENCODER_CMD_DP_LINK_TRAINING_START, 0);
/* disable the training pattern on the sink */
drm_dp_dpcd_writeb(dp_info->aux,
DP_TRAINING_PATTERN_SET,
DP_TRAINING_PATTERN_DISABLE);
Annotation
- Immediate include surface: `drm/amdgpu_drm.h`, `drm/display/drm_dp_helper.h`, `amdgpu.h`, `atom.h`, `atom-bits.h`, `atombios_encoders.h`, `atombios_dp.h`, `amdgpu_connectors.h`.
- Detected declarations: `struct amdgpu_atombios_dp_link_train_info`, `function amdgpu_atombios_dp_process_aux_ch`, `function amdgpu_atombios_dp_aux_transfer`, `function amdgpu_atombios_dp_aux_init`, `function amdgpu_atombios_dp_get_adjust_train`, `function amdgpu_atombios_dp_convert_bpc_to_bpp`, `function amdgpu_atombios_dp_get_dp_link_config`, `function amdgpu_atombios_dp_encoder_service`, `function amdgpu_atombios_dp_get_sinktype`, `function amdgpu_atombios_dp_probe_oui`.
- 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.