sound/soc/intel/avs/boards/pcm3168a.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/boards/pcm3168a.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/boards/pcm3168a.c- Extension
.c- Size
- 4387 bytes
- Lines
- 156
- 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/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-acpi.h../utils.h
Detected Declarations
function avs_pcm3168a_be_fixupfunction avs_create_dai_linksfunction avs_pcm3168a_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2024-2025 Intel Corporation
//
// Author: Cezary Rojewski <cezary.rojewski@intel.com>
//
#include <linux/module.h>
#include <linux/platform_device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include "../utils.h"
static const struct snd_soc_dapm_widget card_widgets[] = {
SND_SOC_DAPM_HP("CPB Stereo HP 1", NULL),
SND_SOC_DAPM_HP("CPB Stereo HP 2", NULL),
SND_SOC_DAPM_HP("CPB Stereo HP 3", NULL),
SND_SOC_DAPM_LINE("CPB Line Out", NULL),
SND_SOC_DAPM_MIC("CPB Stereo Mic 1", NULL),
SND_SOC_DAPM_MIC("CPB Stereo Mic 2", NULL),
SND_SOC_DAPM_LINE("CPB Line In", NULL),
};
static const struct snd_soc_dapm_route card_routes[] = {
{ "CPB Stereo HP 1", NULL, "AOUT1L" },
{ "CPB Stereo HP 1", NULL, "AOUT1R" },
{ "CPB Stereo HP 2", NULL, "AOUT2L" },
{ "CPB Stereo HP 2", NULL, "AOUT2R" },
{ "CPB Stereo HP 3", NULL, "AOUT3L" },
{ "CPB Stereo HP 3", NULL, "AOUT3R" },
{ "CPB Line Out", NULL, "AOUT4L" },
{ "CPB Line Out", NULL, "AOUT4R" },
{ "AIN1L", NULL, "CPB Stereo Mic 1" },
{ "AIN1R", NULL, "CPB Stereo Mic 1" },
{ "AIN2L", NULL, "CPB Stereo Mic 2" },
{ "AIN2R", NULL, "CPB Stereo Mic 2" },
{ "AIN3L", NULL, "CPB Line In" },
{ "AIN3R", NULL, "CPB Line In" },
};
static int avs_pcm3168a_be_fixup(struct snd_soc_pcm_runtime *runtime,
struct snd_pcm_hw_params *params)
{
struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
/* Set SSP to 24 bit. */
snd_mask_none(fmt);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0;
}
SND_SOC_DAILINK_DEF(pcm3168a_dac,
DAILINK_COMP_ARRAY(COMP_CODEC("i2c-PCM3168A:00", "pcm3168a-dac")));
SND_SOC_DAILINK_DEF(pcm3168a_adc,
DAILINK_COMP_ARRAY(COMP_CODEC("i2c-PCM3168A:00", "pcm3168a-adc")));
SND_SOC_DAILINK_DEF(cpu_ssp0, DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin")));
SND_SOC_DAILINK_DEF(cpu_ssp2, DAILINK_COMP_ARRAY(COMP_CPU("SSP2 Pin")));
static int avs_create_dai_links(struct device *dev, struct snd_soc_dai_link **links, int *num_links)
{
struct snd_soc_dai_link_component *platform;
struct snd_soc_dai_link *dl;
const int num_dl = 2;
dl = devm_kcalloc(dev, num_dl, sizeof(*dl), GFP_KERNEL);
platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
if (!dl || !platform)
return -ENOMEM;
platform->name = dev_name(dev);
dl[0].num_cpus = 1;
dl[0].num_codecs = 1;
dl[0].platforms = platform;
dl[0].num_platforms = 1;
dl[0].dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP;
dl[0].be_hw_params_fixup = avs_pcm3168a_be_fixup;
dl[0].nonatomic = 1;
dl[0].no_pcm = 1;
memcpy(&dl[1], &dl[0], sizeof(*dl));
dl[0].name = "SSP0-Codec-dac";
dl[0].cpus = cpu_ssp0;
dl[0].codecs = pcm3168a_dac;
dl[1].name = "SSP2-Codec-adc";
dl[1].cpus = cpu_ssp2;
Annotation
- Immediate include surface: `linux/module.h`, `linux/platform_device.h`, `sound/core.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/soc-acpi.h`, `../utils.h`.
- Detected declarations: `function avs_pcm3168a_be_fixup`, `function avs_create_dai_links`, `function avs_pcm3168a_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.