drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dce/dce_audio.c- Extension
.c- Size
- 36884 bytes
- Lines
- 1257
- 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.
- 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
reg_helper.hdce_audio.hdce/dce_11_0_d.hdce/dce_11_0_sh_mask.h
Detected Declarations
struct dp_audio_layout_configfunction filesfunction read_indirect_azalia_regfunction is_audio_format_supportedfunction check_audio_bandwidth_hdmifunction get_link_symbol_clk_freq_mhzfunction get_audio_layout_configfunction get_av_stream_map_lane_countfunction get_audio_sdp_overheadfunction calculate_required_audio_bw_in_symbolsfunction calculate_available_hblank_bw_in_symbolsfunction check_audio_bandwidth_dpfunction check_audio_bandwidthfunction set_high_bit_rate_capablefunction set_video_latencyfunction set_audio_latencyfunction dce_aud_az_enablefunction dce_aud_az_disable_hbr_audiofunction dce_aud_az_disablefunction dce_aud_az_configurefunction get_azalia_clock_info_hdmifunction get_azalia_clock_info_dpfunction dce_aud_wall_dto_setupfunction dce_aud_endpoint_validfunction dce_aud_hw_initfunction dce_aud_destroy
Annotated Snippet
struct dp_audio_layout_config {
uint8_t layouts_per_sample_denom;
uint8_t symbols_per_layout;
uint8_t max_layouts_per_audio_sdp;
};
static void get_audio_layout_config(
uint32_t channel_count,
enum dp_link_encoding encoding,
struct dp_audio_layout_config *output)
{
/* Assuming L-PCM audio. Current implementation uses max 1 layout per SDP,
* with each layout being the same size (8ch layout).
*/
if (encoding == DP_8b_10b_ENCODING) {
if (channel_count == 2) {
output->layouts_per_sample_denom = 4;
output->symbols_per_layout = 40;
output->max_layouts_per_audio_sdp = 1;
} else if (channel_count == 8 || channel_count == 6) {
output->layouts_per_sample_denom = 1;
output->symbols_per_layout = 40;
output->max_layouts_per_audio_sdp = 1;
}
} else if (encoding == DP_128b_132b_ENCODING) {
if (channel_count == 2) {
output->layouts_per_sample_denom = 4;
output->symbols_per_layout = 10;
output->max_layouts_per_audio_sdp = 1;
} else if (channel_count == 8 || channel_count == 6) {
output->layouts_per_sample_denom = 1;
output->symbols_per_layout = 10;
output->max_layouts_per_audio_sdp = 1;
}
}
}
static uint32_t get_av_stream_map_lane_count(
enum dp_link_encoding encoding,
enum dc_lane_count lane_count,
bool is_mst)
{
uint32_t av_stream_map_lane_count = 0;
if (encoding == DP_8b_10b_ENCODING) {
if (!is_mst)
av_stream_map_lane_count = lane_count;
else
av_stream_map_lane_count = 4;
} else if (encoding == DP_128b_132b_ENCODING) {
av_stream_map_lane_count = 4;
}
ASSERT(av_stream_map_lane_count != 0);
return av_stream_map_lane_count;
}
static uint32_t get_audio_sdp_overhead(
enum dp_link_encoding encoding,
enum dc_lane_count lane_count,
bool is_mst)
{
uint32_t audio_sdp_overhead = 0;
if (encoding == DP_8b_10b_ENCODING) {
if (is_mst)
audio_sdp_overhead = 16; /* 4 * 2 + 8 */
else
audio_sdp_overhead = lane_count * 2 + 8;
} else if (encoding == DP_128b_132b_ENCODING) {
audio_sdp_overhead = 10; /* 4 x 2.5 */
}
ASSERT(audio_sdp_overhead != 0);
return audio_sdp_overhead;
}
static uint32_t calculate_required_audio_bw_in_symbols(
const struct audio_crtc_info *crtc_info,
const struct dp_audio_layout_config *layout_config,
uint32_t channel_count,
uint32_t sample_rate_hz,
uint32_t av_stream_map_lane_count,
uint32_t audio_sdp_overhead)
{
(void)channel_count;
/* DP spec recommends between 1.05 to 1.1 safety margin to prevent sample under-run */
struct fixed31_32 audio_sdp_margin = dc_fixpt_from_fraction(110, 100);
Annotation
- Immediate include surface: `reg_helper.h`, `dce_audio.h`, `dce/dce_11_0_d.h`, `dce/dce_11_0_sh_mask.h`.
- Detected declarations: `struct dp_audio_layout_config`, `function files`, `function read_indirect_azalia_reg`, `function is_audio_format_supported`, `function check_audio_bandwidth_hdmi`, `function get_link_symbol_clk_freq_mhz`, `function get_audio_layout_config`, `function get_av_stream_map_lane_count`, `function get_audio_sdp_overhead`, `function calculate_required_audio_bw_in_symbols`.
- 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.