sound/soc/intel/avs/boards/i2s_test.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/boards/i2s_test.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/boards/i2s_test.c- Extension
.c- Size
- 3324 bytes
- Lines
- 130
- 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.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-acpi.hsound/soc-dapm.h../utils.h
Detected Declarations
function avs_create_dai_linkfunction avs_i2s_test_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2021-2022 Intel Corporation
//
// Authors: Cezary Rojewski <cezary.rojewski@intel.com>
// Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
//
#include <linux/module.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/soc-dapm.h>
#include "../utils.h"
static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot,
struct snd_soc_dai_link **dai_link)
{
struct snd_soc_dai_link_component *platform;
struct snd_soc_dai_link *dl;
dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL);
platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
if (!dl || !platform)
return -ENOMEM;
dl->name = devm_kasprintf(dev, GFP_KERNEL,
AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot));
dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL);
if (!dl->name || !dl->cpus)
return -ENOMEM;
dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot));
dl->codecs = &snd_soc_dummy_dlc;
if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name)
return -ENOMEM;
platform->name = dev_name(dev);
dl->num_cpus = 1;
dl->num_codecs = 1;
dl->platforms = platform;
dl->num_platforms = 1;
dl->id = 0;
dl->nonatomic = 1;
dl->no_pcm = 1;
*dai_link = dl;
return 0;
}
static int avs_i2s_test_probe(struct platform_device *pdev)
{
struct snd_soc_dai_link *dai_link;
struct snd_soc_acpi_mach *mach;
struct avs_mach_pdata *pdata;
struct snd_soc_card *card;
struct device *dev = &pdev->dev;
int ssp_port, tdm_slot, ret;
mach = dev_get_platdata(dev);
pdata = mach->pdata;
if (!avs_mach_singular_ssp(mach)) {
dev_err(dev, "Invalid SSP configuration\n");
return -EINVAL;
}
ssp_port = avs_mach_ssp_port(mach);
if (!avs_mach_singular_tdm(mach, ssp_port)) {
dev_err(dev, "Invalid TDM configuration\n");
return -EINVAL;
}
tdm_slot = avs_mach_ssp_tdm(mach, ssp_port);
card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
if (!card)
return -ENOMEM;
if (pdata->obsolete_card_names) {
card->name = devm_kasprintf(dev, GFP_KERNEL,
AVS_STRING_FMT("ssp", "-loopback", ssp_port, tdm_slot));
} else {
card->driver_name = "avs_i2s_test";
card->long_name = card->name = devm_kasprintf(dev, GFP_KERNEL,
AVS_STRING_FMT("AVS I2S TEST-", "",
ssp_port, tdm_slot));
}
Annotation
- Immediate include surface: `linux/module.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/soc-acpi.h`, `sound/soc-dapm.h`, `../utils.h`.
- Detected declarations: `function avs_create_dai_link`, `function avs_i2s_test_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.