sound/soc/mediatek/mt8183/mt8183-dai-adda.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8183/mt8183-dai-adda.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8183/mt8183-dai-adda.c- Extension
.c- Size
- 12743 bytes
- Lines
- 427
- 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.hlinux/delay.hmt8183-afe-common.hmt8183-interconnection.hmt8183-reg.h../common/mtk-dai-adda-common.h
Detected Declarations
function mtk_adda_ul_eventfunction mt8183_adda_dmic_getfunction mt8183_adda_dmic_setfunction set_mtkaif_rxfunction mtk_dai_adda_hw_paramsfunction mt8183_dai_adda_register
Annotated Snippet
if (afe_priv->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,
0x0, 0xf << 20);
regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0,
0x0, 0x1 << 5);
regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0,
0x0, 0x3 << 14);
/* turn on dmic, ch1, ch2 */
regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0,
0x1 << 1, 0x1 << 1);
regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0,
0x3 << 21, 0x3 << 21);
}
break;
case SND_SOC_DAPM_POST_PMD:
/* should delayed 1/fs(smallest is 8k) = 125us before afe off */
usleep_range(125, 135);
break;
default:
break;
}
return 0;
}
/* mtkaif dmic */
static const char * const mt8183_adda_off_on_str[] = {
"Off", "On"
};
static const struct soc_enum mt8183_adda_enum[] = {
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(mt8183_adda_off_on_str),
mt8183_adda_off_on_str),
};
static int mt8183_adda_dmic_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
struct mt8183_afe_private *afe_priv = afe->platform_priv;
ucontrol->value.integer.value[0] = afe_priv->mtkaif_dmic;
return 0;
}
static int mt8183_adda_dmic_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
struct mt8183_afe_private *afe_priv = afe->platform_priv;
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
if (ucontrol->value.enumerated.item[0] >= e->items)
return -EINVAL;
afe_priv->mtkaif_dmic = ucontrol->value.integer.value[0];
dev_info(afe->dev, "%s(), kcontrol name %s, mtkaif_dmic %d\n",
__func__, kcontrol->id.name, afe_priv->mtkaif_dmic);
return 0;
}
static const struct snd_kcontrol_new mtk_adda_controls[] = {
SOC_ENUM_EXT("MTKAIF_DMIC", mt8183_adda_enum[0],
mt8183_adda_dmic_get, mt8183_adda_dmic_set),
};
enum {
SUPPLY_SEQ_ADDA_AFE_ON,
SUPPLY_SEQ_ADDA_DL_ON,
SUPPLY_SEQ_ADDA_UL_ON,
};
static const struct snd_soc_dapm_widget mtk_dai_adda_widgets[] = {
/* adda */
SND_SOC_DAPM_MIXER("ADDA_DL_CH1", SND_SOC_NOPM, 0, 0,
mtk_adda_dl_ch1_mix,
ARRAY_SIZE(mtk_adda_dl_ch1_mix)),
SND_SOC_DAPM_MIXER("ADDA_DL_CH2", SND_SOC_NOPM, 0, 0,
mtk_adda_dl_ch2_mix,
Annotation
- Immediate include surface: `linux/regmap.h`, `linux/delay.h`, `mt8183-afe-common.h`, `mt8183-interconnection.h`, `mt8183-reg.h`, `../common/mtk-dai-adda-common.h`.
- Detected declarations: `function mtk_adda_ul_event`, `function mt8183_adda_dmic_get`, `function mt8183_adda_dmic_set`, `function set_mtkaif_rx`, `function mtk_dai_adda_hw_params`, `function mt8183_dai_adda_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.