sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c- Extension
.c- Size
- 34964 bytes
- Lines
- 1240
- 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.hlinux/pm_runtime.hsound/jack.hsound/pcm_params.hsound/rt5682.hsound/soc.h../../codecs/mt6359.h../../codecs/rt1015.h../../codecs/rt5682.h../common/mtk-afe-platform-driver.h../common/mtk-soc-card.h../common/mtk-soundcard-driver.hmt8192-afe-common.hmt8192-afe-clk.hmt8192-afe-gpio.h
Detected Declarations
enum mt8192_jacksfunction mt8192_rt1015_i2s_hw_paramsfunction for_each_rtd_codec_daisfunction mt8192_rt5682x_i2s_hw_paramsfunction mt8192_mt6359_mtkaif_calibrationfunction mt8192_mt6359_initfunction mt8192_rt5682_initfunction mt8192_mt6359_hdmi_initfunction mt8192_i2s_hw_params_fixupfunction mt8192_mt6359_card_set_be_linkfunction mt8192_mt6359_legacy_probefunction for_each_card_prelinksfunction mt8192_mt6359_soc_card_probe
Annotated Snippet
if (ret) {
dev_err(card->dev, "failed to set pll\n");
return ret;
}
ret = snd_soc_dai_set_sysclk(codec_dai,
RT1015_SCLK_S_PLL,
params_rate(params) * 256,
SND_SOC_CLOCK_IN);
if (ret) {
dev_err(card->dev, "failed to set sysclk\n");
return ret;
}
}
return snd_soc_dai_set_sysclk(cpu_dai, 0, mclk_fs, SND_SOC_CLOCK_OUT);
}
static int mt8192_rt5682x_i2s_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_card *card = rtd->card;
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);
unsigned int mclk_fs_ratio = 128;
unsigned int mclk_fs = rate * mclk_fs_ratio;
int bitwidth;
int ret;
bitwidth = snd_pcm_format_width(params_format(params));
if (bitwidth < 0) {
dev_err(card->dev, "invalid bit width: %d\n", bitwidth);
return bitwidth;
}
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x00, 0x0, 0x2, bitwidth);
if (ret) {
dev_err(card->dev, "failed to set tdm slot\n");
return ret;
}
ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL1,
RT5682_PLL1_S_BCLK1,
params_rate(params) * 64,
params_rate(params) * 512);
if (ret) {
dev_err(card->dev, "failed to set pll\n");
return ret;
}
ret = snd_soc_dai_set_sysclk(codec_dai,
RT5682_SCLK_S_PLL1,
params_rate(params) * 512,
SND_SOC_CLOCK_IN);
if (ret) {
dev_err(card->dev, "failed to set sysclk\n");
return ret;
}
return snd_soc_dai_set_sysclk(cpu_dai, 0, mclk_fs, SND_SOC_CLOCK_OUT);
}
static const struct snd_soc_ops mt8192_rt1015_i2s_ops = {
.hw_params = mt8192_rt1015_i2s_hw_params,
};
static const struct snd_soc_ops mt8192_rt5682x_i2s_ops = {
.hw_params = mt8192_rt5682x_i2s_hw_params,
};
static int mt8192_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *cmpnt_afe =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct snd_soc_component *cmpnt_codec =
snd_soc_rtd_to_codec(rtd, 0)->component;
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt_afe);
struct mt8192_afe_private *afe_priv = afe->platform_priv;
int phase;
unsigned int monitor;
int test_done_1, test_done_2, test_done_3;
int cycle_1, cycle_2, cycle_3;
int prev_cycle_1, prev_cycle_2, prev_cycle_3;
int chosen_phase_1, chosen_phase_2, chosen_phase_3;
int counter;
int mtkaif_calib_ok;
pm_runtime_get_sync(afe->dev);
Annotation
- Immediate include surface: `linux/input.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`, `sound/jack.h`, `sound/pcm_params.h`, `sound/rt5682.h`, `sound/soc.h`.
- Detected declarations: `enum mt8192_jacks`, `function mt8192_rt1015_i2s_hw_params`, `function for_each_rtd_codec_dais`, `function mt8192_rt5682x_i2s_hw_params`, `function mt8192_mt6359_mtkaif_calibration`, `function mt8192_mt6359_init`, `function mt8192_rt5682_init`, `function mt8192_mt6359_hdmi_init`, `function mt8192_i2s_hw_params_fixup`, `function mt8192_mt6359_card_set_be_link`.
- 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.