sound/soc/intel/avs/boards/hdaudio.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/boards/hdaudio.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/boards/hdaudio.c- Extension
.c- Size
- 6614 bytes
- Lines
- 255
- Domain
- Driver Families
- Bucket
- sound/soc
- 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
linux/module.hlinux/platform_device.hsound/hda_codec.hsound/hda_i915.hsound/soc.hsound/soc-acpi.h../../../codecs/hda.h../utils.h
Detected Declarations
function avs_create_dai_linksfunction avs_card_hdmi_pcm_atfunction for_each_card_rtdsfunction avs_card_late_probefunction list_for_each_entryfunction avs_probing_link_initfunction avs_hdaudio_probe
Annotated Snippet
if (spcm) {
hpcm->pcm = spcm;
hpcm->device = spcm->device;
dev_info(card->dev, "%s: mapping HDMI converter %d to PCM %d (%p)\n",
__func__, i, hpcm->device, spcm);
} else {
hpcm->pcm = NULL;
hpcm->device = SNDRV_PCM_INVALID_DEVICE;
dev_warn(card->dev, "%s: no PCM in topology for HDMI converter %d\n",
__func__, i);
}
i++;
}
return hda_codec_probe_complete(codec);
}
static int avs_probing_link_init(struct snd_soc_pcm_runtime *rtm)
{
struct snd_soc_acpi_mach *mach;
struct avs_mach_pdata *pdata;
struct snd_soc_dai_link *links = NULL;
struct snd_soc_card *card = rtm->card;
struct hda_codec *codec;
struct hda_pcm *pcm;
int ret, pcm_count = 0;
mach = dev_get_platdata(card->dev);
pdata = mach->pdata;
codec = pdata->codec;
if (list_empty(&codec->pcm_list_head))
return -EINVAL;
list_for_each_entry(pcm, &codec->pcm_list_head, list)
pcm_count++;
ret = avs_create_dai_links(card->dev, codec, pcm_count, &links);
if (ret < 0) {
dev_err(card->dev, "create links failed: %d\n", ret);
return ret;
}
ret = snd_soc_add_pcm_runtimes(card, links, pcm_count);
if (ret < 0) {
dev_err(card->dev, "add links failed: %d\n", ret);
return ret;
}
return 0;
}
static const struct snd_soc_dai_link probing_link = {
.name = "probing-LINK",
.id = -1,
.nonatomic = 1,
.no_pcm = 1,
.cpus = &snd_soc_dummy_dlc,
.num_cpus = 1,
.init = avs_probing_link_init,
};
static int avs_hdaudio_probe(struct platform_device *pdev)
{
struct snd_soc_dai_link *binder;
struct snd_soc_acpi_mach *mach;
struct avs_mach_pdata *pdata;
struct snd_soc_card *card;
struct device *dev = &pdev->dev;
struct hda_codec *codec;
mach = dev_get_platdata(dev);
pdata = mach->pdata;
codec = pdata->codec;
/* codec may be unloaded before card's probe() fires */
if (!device_is_registered(&codec->core.dev))
return -ENODEV;
binder = devm_kmemdup(dev, &probing_link, sizeof(probing_link), GFP_KERNEL);
if (!binder)
return -ENOMEM;
binder->platforms = devm_kzalloc(dev, sizeof(*binder->platforms), GFP_KERNEL);
binder->codecs = devm_kzalloc(dev, sizeof(*binder->codecs), GFP_KERNEL);
if (!binder->platforms || !binder->codecs)
return -ENOMEM;
binder->codecs->name = devm_kstrdup_const(dev, dev_name(&codec->core.dev), GFP_KERNEL);
if (!binder->codecs->name)
return -ENOMEM;
Annotation
- Immediate include surface: `linux/module.h`, `linux/platform_device.h`, `sound/hda_codec.h`, `sound/hda_i915.h`, `sound/soc.h`, `sound/soc-acpi.h`, `../../../codecs/hda.h`, `../utils.h`.
- Detected declarations: `function avs_create_dai_links`, `function avs_card_hdmi_pcm_at`, `function for_each_card_rtds`, `function avs_card_late_probe`, `function list_for_each_entry`, `function avs_probing_link_init`, `function avs_hdaudio_probe`.
- Atlas domain: Driver Families / sound/soc.
- 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.