sound/soc/amd/vangogh/acp5x-mach.c
Source file repositories/reference/linux-study-clean/sound/soc/amd/vangogh/acp5x-mach.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/amd/vangogh/acp5x-mach.c- Extension
.c- Size
- 14077 bytes
- Lines
- 490
- 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/acpi.hlinux/dmi.hlinux/gpio/consumer.hlinux/i2c.hlinux/input-event-codes.hlinux/module.hsound/jack.hsound/pcm_params.hsound/soc.hsound/soc-dapm.h../../codecs/nau8821.hacp5x.h
Detected Declarations
function platform_clock_controlfunction acp5x_8821_initfunction acp5x_8821_startupfunction acp5x_nau8821_hw_paramsfunction acp5x_cs35l41_startupfunction acp5x_cs35l41_hw_paramsfunction for_each_rtd_componentsfunction acp5x_max98388_startupfunction acp5x_probe
Annotated Snippet
if (ret < 0) {
dev_err(card->dev, "set sysclk err = %d\n", ret);
return -EIO;
}
} else {
ret = snd_soc_dai_set_sysclk(dai, NAU8821_CLK_FLL_BLK, 0, SND_SOC_CLOCK_IN);
if (ret < 0)
dev_err(dai->dev, "can't set BLK clock %d\n", ret);
ret = snd_soc_dai_set_pll(dai, 0, 0, ACP5X_NAU8821_BCLK, ACP5X_NAU8821_FREQ_OUT);
if (ret < 0)
dev_err(dai->dev, "can't set FLL: %d\n", ret);
}
return ret;
}
static int acp5x_8821_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
int ret;
/*
* Headset buttons map to the google Reference headset.
* These can be configured by userspace.
*/
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
SND_JACK_HEADSET | SND_JACK_BTN_0,
&vg_headset, acp5x_nau8821_jack_pins,
ARRAY_SIZE(acp5x_nau8821_jack_pins));
if (ret) {
dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret);
return ret;
}
snd_jack_set_key(vg_headset.jack, SND_JACK_BTN_0, KEY_MEDIA);
nau8821_enable_jack_detect(component, &vg_headset);
return ret;
}
static const unsigned int rates[] = {
48000,
};
static const struct snd_pcm_hw_constraint_list constraints_rates = {
.count = ARRAY_SIZE(rates),
.list = rates,
.mask = 0,
};
static const unsigned int channels[] = {
2,
};
static const struct snd_pcm_hw_constraint_list constraints_channels = {
.count = ARRAY_SIZE(channels),
.list = channels,
.mask = 0,
};
static const unsigned int acp5x_nau8821_format[] = {32};
static struct snd_pcm_hw_constraint_list constraints_sample_bits = {
.list = acp5x_nau8821_format,
.count = ARRAY_SIZE(acp5x_nau8821_format),
};
static int acp5x_8821_startup(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct acp5x_platform_info *machine = snd_soc_card_get_drvdata(rtd->card);
machine->play_i2s_instance = I2S_SP_INSTANCE;
machine->cap_i2s_instance = I2S_SP_INSTANCE;
runtime->hw.channels_max = DUAL_CHANNEL;
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
&constraints_channels);
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
&constraints_rates);
snd_pcm_hw_constraint_list(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
&constraints_sample_bits);
return 0;
}
static int acp5x_nau8821_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/dmi.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/input-event-codes.h`, `linux/module.h`, `sound/jack.h`, `sound/pcm_params.h`.
- Detected declarations: `function platform_clock_control`, `function acp5x_8821_init`, `function acp5x_8821_startup`, `function acp5x_nau8821_hw_params`, `function acp5x_cs35l41_startup`, `function acp5x_cs35l41_hw_params`, `function for_each_rtd_components`, `function acp5x_max98388_startup`, `function acp5x_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.