sound/soc/mediatek/mt8192/mt8192-dai-adda.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8192/mt8192-dai-adda.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8192/mt8192-dai-adda.c- Extension
.c- Size
- 40909 bytes
- Lines
- 1366
- 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/delay.hlinux/regmap.hmt8192-afe-clk.hmt8192-afe-common.hmt8192-afe-gpio.hmt8192-interconnection.h../common/mtk-dai-adda-common.h
Detected Declarations
function mtk_adda_ul_src_dmicfunction mtk_adda_ul_eventfunction mtk_adda_ch34_ul_eventfunction mtk_adda_pad_top_eventfunction mtk_adda_mtkaif_cfg_eventfunction mtk_adda_dl_eventfunction mtk_adda_ch34_dl_eventfunction stf_positive_gain_getfunction stf_positive_gain_setfunction mt8192_adda_dmic_getfunction mt8192_adda_dmic_setfunction mt8192_adda6_only_getfunction mt8192_adda6_only_setfunction mtk_stf_eventfunction mtk_dai_adda_hw_paramsfunction mt8192_dai_adda_register
Annotated Snippet
if (mtkaif_dmic) {
/* mtkaif_rxif_data_mode = 1, dmic */
regmap_update_bits(afe->regmap, AFE_ADDA_MTKAIF_RX_CFG0,
0x1, 0x1);
/* dmic mode, 3.25M*/
regmap_update_bits(afe->regmap, AFE_ADDA_MTKAIF_RX_CFG0,
MTKAIF_RXIF_VOICE_MODE_MASK_SFT,
0x0);
mtk_adda_ul_src_dmic(afe, MT8192_DAI_ADDA);
}
break;
case SND_SOC_DAPM_POST_PMD:
/* should delayed 1/fs(smallest is 8k) = 125us before afe off */
usleep_range(125, 135);
mt8192_afe_gpio_request(afe->dev, false, MT8192_DAI_ADDA, 1);
break;
default:
break;
}
return 0;
}
static int mtk_adda_ch34_ul_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
struct mt8192_afe_private *afe_priv = afe->platform_priv;
int mtkaif_dmic = afe_priv->mtkaif_dmic_ch34;
int mtkaif_adda6_only = afe_priv->mtkaif_adda6_only;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
mt8192_afe_gpio_request(afe->dev, true, MT8192_DAI_ADDA_CH34,
1);
/* update setting to dmic */
if (mtkaif_dmic) {
/* mtkaif_rxif_data_mode = 1, dmic */
regmap_update_bits(afe->regmap,
AFE_ADDA6_MTKAIF_RX_CFG0,
0x1, 0x1);
/* dmic mode, 3.25M*/
regmap_update_bits(afe->regmap,
AFE_ADDA6_MTKAIF_RX_CFG0,
MTKAIF_RXIF_VOICE_MODE_MASK_SFT,
0x0);
mtk_adda_ul_src_dmic(afe, MT8192_DAI_ADDA_CH34);
}
/* when using adda6 without adda enabled,
* RG_ADDA6_MTKAIF_RX_SYNC_WORD2_DISABLE_SFT need to be set or
* data cannot be received.
*/
if (mtkaif_adda6_only) {
regmap_update_bits(afe->regmap,
AFE_ADDA_MTKAIF_SYNCWORD_CFG,
0x1 << 23, 0x1 << 23);
}
break;
case SND_SOC_DAPM_POST_PMD:
/* should delayed 1/fs(smallest is 8k) = 125us before afe off */
usleep_range(125, 135);
mt8192_afe_gpio_request(afe->dev, false, MT8192_DAI_ADDA_CH34,
1);
/* reset dmic */
afe_priv->mtkaif_dmic_ch34 = 0;
if (mtkaif_adda6_only) {
regmap_update_bits(afe->regmap,
AFE_ADDA_MTKAIF_SYNCWORD_CFG,
0x1 << 23, 0x0 << 23);
}
break;
default:
break;
}
return 0;
}
static int mtk_adda_pad_top_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{
Annotation
- Immediate include surface: `linux/delay.h`, `linux/regmap.h`, `mt8192-afe-clk.h`, `mt8192-afe-common.h`, `mt8192-afe-gpio.h`, `mt8192-interconnection.h`, `../common/mtk-dai-adda-common.h`.
- Detected declarations: `function mtk_adda_ul_src_dmic`, `function mtk_adda_ul_event`, `function mtk_adda_ch34_ul_event`, `function mtk_adda_pad_top_event`, `function mtk_adda_mtkaif_cfg_event`, `function mtk_adda_dl_event`, `function mtk_adda_ch34_dl_event`, `function stf_positive_gain_get`, `function stf_positive_gain_set`, `function mt8192_adda_dmic_get`.
- 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.