sound/soc/mediatek/mt8188/mt8188-mt6359.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8188/mt8188-mt6359.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8188/mt8188-mt6359.c- Extension
.c- Size
- 40976 bytes
- Lines
- 1479
- 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/bitfield.hlinux/input.hlinux/module.hlinux/of.hlinux/pm_runtime.hsound/jack.hsound/pcm_params.hsound/soc.hmt8188-afe-common.h../../codecs/nau8825.h../../codecs/mt6359.h../../codecs/mt6359-accdet.h../../codecs/rt5682.h../common/mtk-afe-platform-driver.h../common/mtk-soundcard-driver.h../common/mtk-dsp-sof-common.h../common/mtk-soc-card.h
Detected Declarations
enum mt8188_jacksfunction mt8188_mt6359_mtkaif_calibrationfunction for_each_card_widgetsfunction mt8188_mt6359_accdet_initfunction mt8188_mt6359_initfunction mt8188_dptx_hw_paramsfunction mt8188_dptx_hw_params_fixupfunction mt8188_hdmi_codec_initfunction mt8188_dptx_codec_initfunction mt8188_dumb_amp_initfunction mt8188_max98390_hw_paramsfunction for_each_rtd_codec_daisfunction mt8188_max98390_codec_initfunction mt8188_headset_codec_initfunction mt8188_headset_codec_exitfunction mt8188_nau8825_hw_paramsfunction mt8188_rt5682s_i2s_hw_paramsfunction mt8188_sof_be_hw_paramsfunction mt8188_es8326_hw_paramsfunction mt8188_fixup_controlsfunction for_each_card_widgets_safefunction mt8188_mt6359_soc_card_probefunction for_each_card_prelinksfunction strcmpfunction strcmp
Annotated Snippet
if (!strcmp(w->name, "MTKAIF_PIN")) {
pin_w = w;
break;
}
}
if (pin_w)
snd_soc_dapm_pinctrl_event(pin_w, NULL, SND_SOC_DAPM_PRE_PMU);
else
dev_dbg(afe->dev, "%s(), no pinmux widget, please check if default on\n", __func__);
pm_runtime_get_sync(afe->dev);
mt6359_mtkaif_calibration_enable(cmpnt_codec);
/* set test type to synchronizer pulse */
regmap_write(afe_priv->topckgen, CKSYS_AUD_TOP_CFG, RG_TEST_TYPE);
mtkaif_calibration_num_phase = 42; /* mt6359: 0 ~ 42 */
mtkaif_calibration_ok = true;
for (phase = 0;
phase <= mtkaif_calibration_num_phase && mtkaif_calibration_ok;
phase++) {
mt6359_set_mtkaif_calibration_phase(cmpnt_codec,
phase, phase, phase);
regmap_set_bits(afe_priv->topckgen, CKSYS_AUD_TOP_CFG, RG_TEST_ON);
test_done_1 = 0;
test_done_2 = 0;
cycle_1 = -1;
cycle_2 = -1;
counter = 0;
while (!(test_done_1 & test_done_2)) {
regmap_read(afe_priv->topckgen,
CKSYS_AUD_TOP_MON, &monitor);
test_done_1 = FIELD_GET(TEST_MISO_DONE_1, monitor);
test_done_2 = FIELD_GET(TEST_MISO_DONE_2, monitor);
if (test_done_1 == 1)
cycle_1 = FIELD_GET(TEST_MISO_COUNT_1, monitor);
if (test_done_2 == 1)
cycle_2 = FIELD_GET(TEST_MISO_COUNT_2, monitor);
/* handle if never test done */
if (++counter > 10000) {
dev_err(afe->dev, "%s(), test fail, cycle_1 %d, cycle_2 %d, monitor 0x%x\n",
__func__, cycle_1, cycle_2, monitor);
mtkaif_calibration_ok = false;
break;
}
}
if (phase == 0) {
prev_cycle_1 = cycle_1;
prev_cycle_2 = cycle_2;
}
if (cycle_1 != prev_cycle_1 &&
mtkaif_chosen_phase[MT8188_MTKAIF_MISO_0] < 0) {
mtkaif_chosen_phase[MT8188_MTKAIF_MISO_0] = phase - 1;
mtkaif_phase_cycle[MT8188_MTKAIF_MISO_0] = prev_cycle_1;
}
if (cycle_2 != prev_cycle_2 &&
mtkaif_chosen_phase[MT8188_MTKAIF_MISO_1] < 0) {
mtkaif_chosen_phase[MT8188_MTKAIF_MISO_1] = phase - 1;
mtkaif_phase_cycle[MT8188_MTKAIF_MISO_1] = prev_cycle_2;
}
regmap_clear_bits(afe_priv->topckgen, CKSYS_AUD_TOP_CFG, RG_TEST_ON);
if (mtkaif_chosen_phase[MT8188_MTKAIF_MISO_0] >= 0 &&
mtkaif_chosen_phase[MT8188_MTKAIF_MISO_1] >= 0)
break;
}
if (mtkaif_chosen_phase[MT8188_MTKAIF_MISO_0] < 0) {
mtkaif_calibration_ok = false;
chosen_phase_1 = 0;
} else {
chosen_phase_1 = mtkaif_chosen_phase[MT8188_MTKAIF_MISO_0];
}
if (mtkaif_chosen_phase[MT8188_MTKAIF_MISO_1] < 0) {
mtkaif_calibration_ok = false;
chosen_phase_2 = 0;
} else {
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/input.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`, `sound/jack.h`, `sound/pcm_params.h`, `sound/soc.h`.
- Detected declarations: `enum mt8188_jacks`, `function mt8188_mt6359_mtkaif_calibration`, `function for_each_card_widgets`, `function mt8188_mt6359_accdet_init`, `function mt8188_mt6359_init`, `function mt8188_dptx_hw_params`, `function mt8188_dptx_hw_params_fixup`, `function mt8188_hdmi_codec_init`, `function mt8188_dptx_codec_init`, `function mt8188_dumb_amp_init`.
- 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.