drivers/gpu/drm/radeon/evergreen_hdmi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/evergreen_hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/evergreen_hdmi.c- Extension
.c- Size
- 15971 bytes
- Lines
- 491
- 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
linux/hdmi.hdrm/drm_edid.hdrm/radeon_drm.hevergreen_hdmi.hradeon.hradeon_asic.hradeon_audio.hevergreend.hatom.h
Detected Declarations
function filesfunction evergreen_hdmi_update_acrfunction dce4_afmt_write_latency_fieldsfunction dce4_afmt_hdmi_write_speaker_allocationfunction dce4_afmt_dp_write_speaker_allocationfunction evergreen_hdmi_write_sad_regsfunction evergreen_set_avi_packetfunction dce4_hdmi_audio_set_dtofunction dce4_dp_audio_set_dtofunction numberfunction dce4_set_vbi_packetfunction dce4_hdmi_set_color_depthfunction dce4_set_audio_packetfunction dce4_set_mutefunction evergreen_hdmi_enablefunction evergreen_dp_enable
Annotated Snippet
if (sad->format == eld_reg_to_type[i][1]) {
if (sad->channels > max_channels) {
value = MAX_CHANNELS(sad->channels) |
DESCRIPTOR_BYTE_2(sad->byte2) |
SUPPORTED_FREQUENCIES(sad->freq);
max_channels = sad->channels;
}
if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
stereo_freqs |= sad->freq;
else
break;
}
}
value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
WREG32_ENDPOINT(0, eld_reg_to_type[i][0], value);
}
}
/*
* build a AVI Info Frame
*/
void evergreen_set_avi_packet(struct radeon_device *rdev, u32 offset,
unsigned char *buffer, size_t size)
{
uint8_t *frame = buffer + 3;
WREG32(AFMT_AVI_INFO0 + offset,
frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
WREG32(AFMT_AVI_INFO1 + offset,
frame[0x4] | (frame[0x5] << 8) | (frame[0x6] << 16) | (frame[0x7] << 24));
WREG32(AFMT_AVI_INFO2 + offset,
frame[0x8] | (frame[0x9] << 8) | (frame[0xA] << 16) | (frame[0xB] << 24));
WREG32(AFMT_AVI_INFO3 + offset,
frame[0xC] | (frame[0xD] << 8) | (buffer[1] << 24));
WREG32_P(HDMI_INFOFRAME_CONTROL1 + offset,
HDMI_AVI_INFO_LINE(2), /* anything other than 0 */
~HDMI_AVI_INFO_LINE_MASK);
}
void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
struct radeon_crtc *crtc, unsigned int clock)
{
unsigned int max_ratio = clock / 24000;
u32 dto_phase;
u32 wallclock_ratio;
u32 value;
if (max_ratio >= 8) {
dto_phase = 192 * 1000;
wallclock_ratio = 3;
} else if (max_ratio >= 4) {
dto_phase = 96 * 1000;
wallclock_ratio = 2;
} else if (max_ratio >= 2) {
dto_phase = 48 * 1000;
wallclock_ratio = 1;
} else {
dto_phase = 24 * 1000;
wallclock_ratio = 0;
}
value = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK;
value |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio);
value &= ~DCCG_AUDIO_DTO1_USE_512FBR_DTO;
WREG32(DCCG_AUDIO_DTO0_CNTL, value);
/* Two dtos; generally use dto0 for HDMI */
value = 0;
if (crtc)
value |= DCCG_AUDIO_DTO0_SOURCE_SEL(crtc->crtc_id);
WREG32(DCCG_AUDIO_DTO_SOURCE, value);
/* Express [24MHz / target pixel clock] as an exact rational
* number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE
* is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator
*/
WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase);
WREG32(DCCG_AUDIO_DTO0_MODULE, clock);
}
void dce4_dp_audio_set_dto(struct radeon_device *rdev,
struct radeon_crtc *crtc, unsigned int clock)
{
u32 value;
Annotation
- Immediate include surface: `linux/hdmi.h`, `drm/drm_edid.h`, `drm/radeon_drm.h`, `evergreen_hdmi.h`, `radeon.h`, `radeon_asic.h`, `radeon_audio.h`, `evergreend.h`.
- Detected declarations: `function files`, `function evergreen_hdmi_update_acr`, `function dce4_afmt_write_latency_fields`, `function dce4_afmt_hdmi_write_speaker_allocation`, `function dce4_afmt_dp_write_speaker_allocation`, `function evergreen_hdmi_write_sad_regs`, `function evergreen_set_avi_packet`, `function dce4_hdmi_audio_set_dto`, `function dce4_dp_audio_set_dto`, `function number`.
- 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.