sound/soc/mediatek/mt8195/mt8195-dai-pcm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8195/mt8195-dai-pcm.c- Extension
.c- Size
- 9300 bytes
- Lines
- 370
- 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/regmap.hsound/pcm_params.hmt8195-afe-clk.hmt8195-afe-common.hmt8195-reg.h
Detected Declarations
struct mtk_dai_pcm_ratestruct mtk_dai_pcmif_privfunction mtk_dai_pcm_modefunction mtk_dai_pcm_configurefunction mtk_dai_pcm_preparefunction mtk_dai_pcm_set_fmtfunction init_pcmif_priv_datafunction mt8195_dai_pcm_register
Annotated Snippet
struct mtk_dai_pcm_rate {
unsigned int rate;
unsigned int reg_value;
};
struct mtk_dai_pcmif_priv {
unsigned int slave_mode;
unsigned int lrck_inv;
unsigned int bck_inv;
unsigned int format;
};
static const struct mtk_dai_pcm_rate mtk_dai_pcm_rates[] = {
{ .rate = 8000, .reg_value = 0, },
{ .rate = 16000, .reg_value = 1, },
{ .rate = 32000, .reg_value = 2, },
{ .rate = 48000, .reg_value = 3, },
{ .rate = 11025, .reg_value = 1, },
{ .rate = 22050, .reg_value = 2, },
{ .rate = 44100, .reg_value = 3, },
};
static int mtk_dai_pcm_mode(unsigned int rate)
{
int i;
for (i = 0; i < ARRAY_SIZE(mtk_dai_pcm_rates); i++)
if (mtk_dai_pcm_rates[i].rate == rate)
return mtk_dai_pcm_rates[i].reg_value;
return -EINVAL;
}
static const struct snd_kcontrol_new mtk_dai_pcm_o000_mix[] = {
SOC_DAPM_SINGLE_AUTODISABLE("I000 Switch", AFE_CONN0, 0, 1, 0),
SOC_DAPM_SINGLE_AUTODISABLE("I070 Switch", AFE_CONN0_2, 6, 1, 0),
};
static const struct snd_kcontrol_new mtk_dai_pcm_o001_mix[] = {
SOC_DAPM_SINGLE_AUTODISABLE("I001 Switch", AFE_CONN1, 1, 1, 0),
SOC_DAPM_SINGLE_AUTODISABLE("I071 Switch", AFE_CONN1_2, 7, 1, 0),
};
static const struct snd_soc_dapm_widget mtk_dai_pcm_widgets[] = {
SND_SOC_DAPM_MIXER("I002", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("I003", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("O000", SND_SOC_NOPM, 0, 0,
mtk_dai_pcm_o000_mix,
ARRAY_SIZE(mtk_dai_pcm_o000_mix)),
SND_SOC_DAPM_MIXER("O001", SND_SOC_NOPM, 0, 0,
mtk_dai_pcm_o001_mix,
ARRAY_SIZE(mtk_dai_pcm_o001_mix)),
SND_SOC_DAPM_SUPPLY("PCM_EN", PCM_INTF_CON1,
PCM_INTF_CON1_PCM_EN_SHIFT, 0, NULL, 0),
SND_SOC_DAPM_INPUT("PCM1_INPUT"),
SND_SOC_DAPM_OUTPUT("PCM1_OUTPUT"),
SND_SOC_DAPM_CLOCK_SUPPLY("aud_asrc11"),
SND_SOC_DAPM_CLOCK_SUPPLY("aud_asrc12"),
SND_SOC_DAPM_CLOCK_SUPPLY("aud_pcmif"),
};
static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = {
{"I002", NULL, "PCM1 Capture"},
{"I003", NULL, "PCM1 Capture"},
{"O000", "I000 Switch", "I000"},
{"O001", "I001 Switch", "I001"},
{"O000", "I070 Switch", "I070"},
{"O001", "I071 Switch", "I071"},
{"PCM1 Playback", NULL, "O000"},
{"PCM1 Playback", NULL, "O001"},
{"PCM1 Playback", NULL, "PCM_EN"},
{"PCM1 Playback", NULL, "aud_asrc12"},
{"PCM1 Playback", NULL, "aud_pcmif"},
{"PCM1 Capture", NULL, "PCM_EN"},
{"PCM1 Capture", NULL, "aud_asrc11"},
{"PCM1 Capture", NULL, "aud_pcmif"},
{"PCM1_OUTPUT", NULL, "PCM1 Playback"},
{"PCM1 Capture", NULL, "PCM1_INPUT"},
};
static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
Annotation
- Immediate include surface: `linux/regmap.h`, `sound/pcm_params.h`, `mt8195-afe-clk.h`, `mt8195-afe-common.h`, `mt8195-reg.h`.
- Detected declarations: `struct mtk_dai_pcm_rate`, `struct mtk_dai_pcmif_priv`, `function mtk_dai_pcm_mode`, `function mtk_dai_pcm_configure`, `function mtk_dai_pcm_prepare`, `function mtk_dai_pcm_set_fmt`, `function init_pcmif_priv_data`, `function mt8195_dai_pcm_register`.
- 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.