sound/hda/codecs/hdmi/hdmi.c
Source file repositories/reference/linux-study-clean/sound/hda/codecs/hdmi/hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/codecs/hdmi/hdmi.c- Extension
.c- Size
- 64965 bytes
- Lines
- 2372
- Domain
- Driver Families
- Bucket
- sound/hda
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
linux/init.hlinux/delay.hlinux/pci.hlinux/slab.hlinux/module.hlinux/pm_runtime.hsound/core.hsound/jack.hsound/asoundef.hsound/tlv.hsound/hdaudio.hsound/hda_i915.hsound/hda_chmap.hsound/hda_codec.hhda_local.hhda_jack.hhda_controller.hhdmi_local.h
Detected Declarations
function snd_hda_hdmi_pin_id_to_pin_indexfunction hinfo_to_pcm_indexfunction hinfo_to_pin_indexfunction cvt_nid_to_cvt_indexfunction hdmi_eld_ctl_infofunction hdmi_eld_ctl_getfunction hdmi_create_eld_ctlfunction hdmi_get_dip_indexfunction hdmi_set_dip_indexfunction hdmi_write_dip_bytefunction hdmi_init_pinfunction print_eld_infofunction write_eld_infofunction eld_proc_newfunction eld_proc_freefunction eld_proc_newfunction eld_proc_freefunction hdmi_stop_infoframe_transfunction hdmi_debug_dip_sizefunction hdmi_clear_dip_buffersfunction hdmi_checksum_audio_infoframefunction hdmi_fill_audio_infoframefunction hdmi_infoframe_uptodatefunction hdmi_pin_get_eldfunction hdmi_pin_setup_infoframefunction snd_hda_hdmi_setup_audio_infoframefunction snd_hda_hdmi_check_presence_and_reportfunction jack_callbackfunction hdmi_intrinsic_eventfunction hdmi_non_intrinsic_eventfunction snd_hda_hdmi_generic_unsol_eventfunction hdmi_pin_hbr_setupfunction snd_hda_hdmi_setup_streamfunction hdmi_choose_cvtfunction pin_cvt_fixupfunction hdmi_pcm_open_no_pinfunction hdmi_pcm_openfunction hdmi_read_pin_connfunction hdmi_find_pcm_slotfunction hdmi_attach_hda_pcmfunction hdmi_detach_hda_pcmfunction hdmi_get_pin_cvt_muxfunction hdmi_pcm_setup_pinfunction hdmi_pcm_reset_pinfunction update_eldfunction hdmi_present_sense_via_verbsfunction silent_stream_enablefunction silent_stream_disable
Annotated Snippet
if (conn_type == 0) { /* HDMI */
hdmi_ai->type = 0x84;
hdmi_ai->ver = 0x01;
hdmi_ai->len = 0x0a;
} else {/* Nvidia DP */
hdmi_ai->type = 0x84;
hdmi_ai->ver = 0x1b;
hdmi_ai->len = 0x11 << 2;
}
hdmi_ai->CC02_CT47 = active_channels - 1;
hdmi_ai->CA = ca;
hdmi_checksum_audio_infoframe(hdmi_ai);
} else if (conn_type == 1) { /* DisplayPort */
struct dp_audio_infoframe *dp_ai = &ai.dp;
dp_ai->type = 0x84;
dp_ai->len = 0x1b;
dp_ai->ver = 0x11 << 2;
dp_ai->CC02_CT47 = active_channels - 1;
dp_ai->CA = ca;
} else {
codec_dbg(codec, "HDMI: unknown connection type at pin NID 0x%x\n", pin_nid);
return;
}
snd_hda_set_dev_select(codec, pin_nid, dev_id);
/*
* sizeof(ai) is used instead of sizeof(*hdmi_ai) or
* sizeof(*dp_ai) to avoid partial match/update problems when
* the user switches between HDMI/DP monitors.
*/
if (!hdmi_infoframe_uptodate(codec, pin_nid, ai.bytes,
sizeof(ai))) {
codec_dbg(codec, "%s: pin NID=0x%x channels=%d ca=0x%02x\n",
__func__, pin_nid, active_channels, ca);
hdmi_stop_infoframe_trans(codec, pin_nid);
hdmi_fill_audio_infoframe(codec, pin_nid,
ai.bytes, sizeof(ai));
hdmi_start_infoframe_trans(codec, pin_nid);
}
}
void snd_hda_hdmi_setup_audio_infoframe(struct hda_codec *codec,
struct hdmi_spec_per_pin *per_pin,
bool non_pcm)
{
struct hdmi_spec *spec = codec->spec;
struct hdac_chmap *chmap = &spec->chmap;
hda_nid_t pin_nid = per_pin->pin_nid;
int dev_id = per_pin->dev_id;
int channels = per_pin->channels;
int active_channels;
struct hdmi_eld *eld;
int ca;
if (!channels)
return;
snd_hda_set_dev_select(codec, pin_nid, dev_id);
/* some HW (e.g. HSW+) needs reprogramming the amp at each time */
if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP)
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_AMP_GAIN_MUTE,
AMP_OUT_UNMUTE);
eld = &per_pin->sink_eld;
ca = snd_hdac_channel_allocation(&codec->core,
eld->info.spk_alloc, channels,
per_pin->chmap_set, non_pcm, per_pin->chmap);
active_channels = snd_hdac_get_active_channels(ca);
chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid,
active_channels);
/*
* always configure channel mapping, it may have been changed by the
* user in the meantime
*/
snd_hdac_setup_channel_mapping(&spec->chmap,
pin_nid, non_pcm, ca, channels,
per_pin->chmap, per_pin->chmap_set);
spec->ops.pin_setup_infoframe(codec, pin_nid, dev_id,
ca, active_channels, eld->info.conn_type);
per_pin->non_pcm = non_pcm;
Annotation
- Immediate include surface: `linux/init.h`, `linux/delay.h`, `linux/pci.h`, `linux/slab.h`, `linux/module.h`, `linux/pm_runtime.h`, `sound/core.h`, `sound/jack.h`.
- Detected declarations: `function snd_hda_hdmi_pin_id_to_pin_index`, `function hinfo_to_pcm_index`, `function hinfo_to_pin_index`, `function cvt_nid_to_cvt_index`, `function hdmi_eld_ctl_info`, `function hdmi_eld_ctl_get`, `function hdmi_create_eld_ctl`, `function hdmi_get_dip_index`, `function hdmi_set_dip_index`, `function hdmi_write_dip_byte`.
- Atlas domain: Driver Families / sound/hda.
- Implementation status: integration 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.