drivers/gpu/drm/msm/dp/dp_link.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/dp/dp_link.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/dp/dp_link.c- Extension
.c- Size
- 36284 bytes
- Lines
- 1351
- 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_device.hdrm/drm_of.hdrm/drm_print.hdp_reg.hdp_link.hdp_panel.h
Detected Declarations
struct msm_dp_link_requeststruct msm_dp_link_privateenum audio_sample_rateenum audio_pattern_typefunction msm_dp_aux_link_power_upfunction msm_dp_aux_link_power_downfunction msm_dp_link_get_periodfunction msm_dp_link_parse_audio_channel_periodfunction msm_dp_link_parse_audio_pattern_typefunction msm_dp_link_parse_audio_modefunction msm_dp_link_parse_audio_pattern_paramsfunction msm_dp_link_is_video_pattern_validfunction msm_dp_link_is_bit_depth_validfunction msm_dp_link_parse_timing_params1function msm_dp_link_parse_timing_params2function msm_dp_link_parse_timing_params3function msm_dp_link_parse_video_pattern_paramsfunction msm_dp_link_parse_link_training_paramsfunction msm_dp_link_parse_phy_test_paramsfunction msm_dp_link_is_video_audio_test_requestedfunction msm_dp_link_parse_requestfunction msm_dp_link_parse_sink_status_fieldfunction msm_dp_link_process_link_training_requestfunction msm_dp_link_send_test_responsefunction msm_dp_link_psm_configfunction msm_dp_link_send_edid_checksumfunction msm_dp_link_parse_vx_pxfunction msm_dp_link_process_phy_test_pattern_requestfunction msm_dp_link_read_psr_error_statusfunction msm_dp_link_psr_capability_changedfunction get_link_statusfunction msm_dp_link_process_link_status_updatefunction msm_dp_link_process_ds_port_status_changefunction msm_dp_link_is_video_pattern_requestedfunction msm_dp_link_is_audio_pattern_requestedfunction msm_dp_link_reset_datafunction msm_dp_link_process_requestfunction msm_dp_link_get_colorimetry_configfunction msm_dp_link_adjust_levelsfunction msm_dp_link_reset_phy_params_vx_pxfunction msm_dp_link_get_test_bits_depthfunction msm_dp_link_link_frequenciesfunction msm_dp_link_lane_mapfunction msm_dp_link_parse_dt
Annotated Snippet
struct msm_dp_link_request {
u32 test_requested;
u32 test_link_rate;
u32 test_lane_count;
};
struct msm_dp_link_private {
u32 prev_sink_count;
struct drm_device *drm_dev;
struct drm_dp_aux *aux;
struct msm_dp_link msm_dp_link;
struct msm_dp_link_request request;
struct mutex psm_mutex;
u8 link_status[DP_LINK_STATUS_SIZE];
};
static int msm_dp_aux_link_power_up(struct drm_dp_aux *aux,
struct msm_dp_link_info *link)
{
u8 value;
ssize_t len;
int i;
if (link->revision < 0x11)
return 0;
len = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
if (len < 0)
return len;
value &= ~DP_SET_POWER_MASK;
value |= DP_SET_POWER_D0;
/* retry for 1ms to give the sink time to wake up */
for (i = 0; i < 3; i++) {
len = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
usleep_range(1000, 2000);
if (len == 1)
break;
}
return 0;
}
static int msm_dp_aux_link_power_down(struct drm_dp_aux *aux,
struct msm_dp_link_info *link)
{
u8 value;
int err;
if (link->revision < 0x11)
return 0;
err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
if (err < 0)
return err;
value &= ~DP_SET_POWER_MASK;
value |= DP_SET_POWER_D3;
err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
if (err < 0)
return err;
return 0;
}
static int msm_dp_link_get_period(struct msm_dp_link_private *link, int const addr)
{
int ret = 0;
u8 data;
u32 const max_audio_period = 0xA;
/* TEST_AUDIO_PERIOD_CH_XX */
if (drm_dp_dpcd_readb(link->aux, addr, &data) < 0) {
DRM_ERROR("failed to read test_audio_period (0x%x)\n", addr);
ret = -EINVAL;
goto exit;
}
/* Period - Bits 3:0 */
data = data & 0xF;
if ((int)data > max_audio_period) {
DRM_ERROR("invalid test_audio_period_ch_1 = 0x%x\n", data);
ret = -EINVAL;
goto exit;
}
ret = data;
Annotation
- Immediate include surface: `drm/drm_device.h`, `drm/drm_of.h`, `drm/drm_print.h`, `dp_reg.h`, `dp_link.h`, `dp_panel.h`.
- Detected declarations: `struct msm_dp_link_request`, `struct msm_dp_link_private`, `enum audio_sample_rate`, `enum audio_pattern_type`, `function msm_dp_aux_link_power_up`, `function msm_dp_aux_link_power_down`, `function msm_dp_link_get_period`, `function msm_dp_link_parse_audio_channel_period`, `function msm_dp_link_parse_audio_pattern_type`, `function msm_dp_link_parse_audio_mode`.
- 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.