sound/soc/mediatek/mt8189/mt8189-nau8825.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8189/mt8189-nau8825.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8189/mt8189-nau8825.c- Extension
.c- Size
- 33912 bytes
- Lines
- 1181
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/input.hlinux/module.hlinux/of_device.hlinux/pm_runtime.hsound/soc.hsound/jack.hsound/pcm_params.hmt8189-afe-common.h../common/mtk-soc-card.h../common/mtk-soundcard-driver.h../common/mtk-afe-platform-driver.h../../codecs/cs35l41.h../../codecs/nau8825.h../../codecs/rt5682s.h../../codecs/rt5682.h
Detected Declarations
enum mt8189_jacksfunction mt8189_common_i2s_startupfunction mt8189_common_i2s_hw_paramsfunction mt8189_dptx_hw_paramsfunction mt8189_dptx_hw_params_fixupfunction mt8189_nau8825_hw_paramsfunction mt8189_rtxxxx_i2s_hw_paramsfunction mt8189_cs35l41_i2s_hw_paramsfunction for_each_rtd_codec_daisfunction mt8189_es8326_hw_paramsfunction mt8189_dumb_amp_initfunction mt8189_dptx_codec_initfunction mt8189_hdmi_codec_initfunction mt8189_headset_codec_initfunction mt8189_headset_codec_exitfunction mt8189_nau8825_soc_card_probefunction for_each_card_prelinksfunction strcmp
Annotated Snippet
if (ret < 0) {
dev_err(codec_dai->dev, "set component sysclk fail: %d\n",
ret);
return ret;
}
ret = snd_soc_dai_set_sysclk(codec_dai, CS35L41_CLKID_SCLK,
clk_freq, SND_SOC_CLOCK_IN);
if (ret < 0) {
dev_err(codec_dai->dev, "set sysclk fail: %d\n",
ret);
return ret;
}
ret = snd_soc_dai_set_channel_map(codec_dai, 0, NULL,
1, &rx_slot[i]);
if (ret < 0) {
dev_err(codec_dai->dev, "set channel map fail: %d\n",
ret);
return ret;
}
}
return snd_soc_dai_set_sysclk(cpu_dai,
0, mclk_fs, SND_SOC_CLOCK_OUT);
}
static const struct snd_soc_ops mt8189_cs35l41_i2s_ops = {
.startup = mt8189_common_i2s_startup,
.hw_params = mt8189_cs35l41_i2s_hw_params,
};
static int mt8189_es8326_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
unsigned int rate = params_rate(params);
int ret;
/* Configure MCLK for codec */
ret = snd_soc_dai_set_sysclk(codec_dai, 0, rate * 256, SND_SOC_CLOCK_IN);
if (ret < 0) {
dev_err(codec_dai->dev, "can't set MCLK %d\n", ret);
return ret;
}
/* Configure MCLK for cpu */
return snd_soc_dai_set_sysclk(cpu_dai, 0, rate * 256, SND_SOC_CLOCK_OUT);
}
static const struct snd_soc_ops mt8189_es8326_ops = {
.startup = mt8189_common_i2s_startup,
.hw_params = mt8189_es8326_hw_params,
};
static int mt8189_dumb_amp_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
ret = snd_soc_dapm_new_controls(dapm, mt8189_dumb_spk_widgets,
ARRAY_SIZE(mt8189_dumb_spk_widgets));
if (ret) {
dev_err(rtd->dev, "unable to add Dumb Speaker dapm, ret %d\n", ret);
return ret;
}
ret = snd_soc_add_card_controls(card, mt8189_dumb_spk_controls,
ARRAY_SIZE(mt8189_dumb_spk_controls));
if (ret) {
dev_err(rtd->dev, "unable to add Dumb card controls, ret %d\n", ret);
return ret;
}
return 0;
}
static int mt8189_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)
{
struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_jack *jack = &soc_card_data->card_data->jacks[MT8189_JACK_DP];
struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
int ret;
ret = snd_soc_card_jack_new_pins(rtd->card, "DP Jack", SND_JACK_LINEOUT,
jack, mt8189_dp_jack_pins,
ARRAY_SIZE(mt8189_dp_jack_pins));
Annotation
- Immediate include surface: `linux/input.h`, `linux/module.h`, `linux/of_device.h`, `linux/pm_runtime.h`, `sound/soc.h`, `sound/jack.h`, `sound/pcm_params.h`, `mt8189-afe-common.h`.
- Detected declarations: `enum mt8189_jacks`, `function mt8189_common_i2s_startup`, `function mt8189_common_i2s_hw_params`, `function mt8189_dptx_hw_params`, `function mt8189_dptx_hw_params_fixup`, `function mt8189_nau8825_hw_params`, `function mt8189_rtxxxx_i2s_hw_params`, `function mt8189_cs35l41_i2s_hw_params`, `function for_each_rtd_codec_dais`, `function mt8189_es8326_hw_params`.
- 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.