sound/soc/codecs/hdac_hda.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/hdac_hda.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/hdac_hda.c- Extension
.c- Size
- 18226 bytes
- Lines
- 678
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/init.hlinux/delay.hlinux/module.hlinux/pm_runtime.hsound/pcm_params.hsound/soc.hsound/hdaudio_ext.hsound/hda_i915.hsound/hda_codec.hsound/hda_register.hhdac_hda.h
Detected Declarations
function hdac_hda_dai_set_streamfunction hdac_hda_dai_hw_paramsfunction hdac_hda_dai_hw_freefunction hdac_hda_dai_preparefunction hdac_hda_dai_openfunction hdac_hda_dai_closefunction list_for_each_entryfunction is_hdmi_codecfunction list_for_each_entryfunction hdac_hda_codec_probefunction hdac_hda_codec_removefunction hdac_hda_dev_probefunction hdac_hda_dev_removeexport snd_soc_hdac_hda_get_ops
Annotated Snippet
if (strstr(cpcm->name, pcm_name)) {
if (strcmp(pcm_name, "Analog") == 0) {
if (strstr(cpcm->name, "Alt Analog"))
continue;
}
return cpcm;
}
}
dev_err(dai->dev, "%s: didn't find PCM for DAI %s\n", __func__, dai->name);
return NULL;
}
static bool is_hdmi_codec(struct hda_codec *hcodec)
{
struct hda_pcm *cpcm;
list_for_each_entry(cpcm, &hcodec->pcm_list_head, list) {
if (cpcm->pcm_type == HDA_PCM_TYPE_HDMI)
return true;
}
return false;
}
static int hdac_hda_codec_probe(struct snd_soc_component *component)
{
struct hdac_hda_priv *hda_pvt =
snd_soc_component_get_drvdata(component);
struct hdac_device *hdev = &hda_pvt->codec->core;
struct hda_codec *hcodec = hda_pvt->codec;
struct hda_codec_driver *driver = hda_codec_to_driver(hcodec);
struct hdac_ext_link *hlink;
int ret;
hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
if (!hlink) {
dev_err(&hdev->dev, "%s: hdac link not found\n", __func__);
return -EIO;
}
snd_hdac_ext_bus_link_get(hdev->bus, hlink);
/*
* Ensure any HDA display is powered at codec probe.
* After snd_hda_codec_device_new(), display power is
* managed by runtime PM.
*/
if (hda_pvt->need_display_power)
snd_hdac_display_power(hdev->bus,
HDA_CODEC_IDX_CONTROLLER, true);
ret = snd_hda_codec_device_new(hcodec->bus, component->card->snd_card,
hdev->addr, hcodec, true);
if (ret < 0) {
dev_err(&hdev->dev, "%s: failed to create hda codec %d\n", __func__, ret);
goto error_no_pm;
}
#ifdef CONFIG_SND_HDA_PATCH_LOADER
if (loadable_patch[hda_pvt->dev_index] && *loadable_patch[hda_pvt->dev_index]) {
const struct firmware *fw;
dev_info(&hdev->dev, "Applying patch firmware '%s'\n",
loadable_patch[hda_pvt->dev_index]);
ret = request_firmware(&fw, loadable_patch[hda_pvt->dev_index],
&hdev->dev);
if (ret < 0)
goto error_no_pm;
if (fw) {
ret = snd_hda_load_patch(hcodec->bus, fw->size, fw->data);
if (ret < 0) {
dev_err(&hdev->dev, "%s: failed to load hda patch %d\n", __func__, ret);
goto error_no_pm;
}
release_firmware(fw);
}
}
#endif
/*
* Overwrite type to HDA_DEV_ASOC since it is a ASoC driver
* hda_codec.c will check this flag to determine if unregister
* device is needed.
*/
hdev->type = HDA_DEV_ASOC;
/*
* snd_hda_codec_device_new decrements the usage count so call get pm
* else the device will be powered off
*/
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/init.h`, `linux/delay.h`, `linux/module.h`, `linux/pm_runtime.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/hdaudio_ext.h`.
- Detected declarations: `function hdac_hda_dai_set_stream`, `function hdac_hda_dai_hw_params`, `function hdac_hda_dai_hw_free`, `function hdac_hda_dai_prepare`, `function hdac_hda_dai_open`, `function hdac_hda_dai_close`, `function list_for_each_entry`, `function is_hdmi_codec`, `function list_for_each_entry`, `function hdac_hda_codec_probe`.
- Atlas domain: Driver Families / sound/soc.
- 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.