sound/soc/mediatek/mt8188/mt8188-dai-dmic.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8188/mt8188-dai-dmic.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8188/mt8188-dai-dmic.c- Extension
.c- Size
- 20492 bytes
- Lines
- 684
- 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/pm_runtime.hlinux/regmap.hsound/pcm_params.hmt8188-afe-clk.hmt8188-afe-common.hmt8188-reg.h
Detected Declarations
struct mtk_dai_dmic_ctrl_regstruct mtk_dai_dmic_hw_gain_ctrl_regstruct mtk_dai_dmic_privfunction mtk_dai_dmic_hw_gain_bypassfunction mtk_dai_dmic_hw_gain_onfunction mtk_dai_dmic_load_iir_coeff_tablefunction mtk_dai_dmic_configure_arrayfunction mtk_dmic_channels_to_dmic_numberfunction mtk_dai_dmic_hw_gain_enablefunction mtk_dmic_gain_eventfunction mtk_dmic_eventfunction mtk_dai_dmic_hw_paramsfunction mtk_dai_dmic_hw_gain_ctrl_putfunction mtk_dai_dmic_hw_gain_ctrl_getfunction init_dmic_priv_datafunction mt8188_dai_dmic_register
Annotated Snippet
struct mtk_dai_dmic_ctrl_reg {
unsigned int con0;
};
struct mtk_dai_dmic_hw_gain_ctrl_reg {
unsigned int bypass;
unsigned int con0;
};
struct mtk_dai_dmic_priv {
unsigned int gain_on[DMIC_NUM];
unsigned int channels;
bool hires_required;
};
static const struct mtk_dai_dmic_ctrl_reg dmic_ctrl_regs[DMIC_NUM] = {
[DMIC0] = {
.con0 = AFE_DMIC0_UL_SRC_CON0,
},
[DMIC1] = {
.con0 = AFE_DMIC1_UL_SRC_CON0,
},
[DMIC2] = {
.con0 = AFE_DMIC2_UL_SRC_CON0,
},
[DMIC3] = {
.con0 = AFE_DMIC3_UL_SRC_CON0,
},
};
static const struct mtk_dai_dmic_ctrl_reg *get_dmic_ctrl_reg(int id)
{
if (id < 0 || id >= DMIC_NUM)
return NULL;
return &dmic_ctrl_regs[id];
}
static const struct mtk_dai_dmic_hw_gain_ctrl_reg
dmic_hw_gain_ctrl_regs[DMIC_NUM] = {
[DMIC0] = {
.bypass = DMIC_BYPASS_HW_GAIN,
.con0 = DMIC_GAIN1_CON0,
},
[DMIC1] = {
.bypass = DMIC_BYPASS_HW_GAIN,
.con0 = DMIC_GAIN2_CON0,
},
[DMIC2] = {
.bypass = DMIC_BYPASS_HW_GAIN,
.con0 = DMIC_GAIN3_CON0,
},
[DMIC3] = {
.bypass = DMIC_BYPASS_HW_GAIN,
.con0 = DMIC_GAIN4_CON0,
},
};
static const struct mtk_dai_dmic_hw_gain_ctrl_reg
*get_dmic_hw_gain_ctrl_reg(struct mtk_base_afe *afe, int id)
{
if ((id < 0) || (id >= DMIC_NUM)) {
dev_dbg(afe->dev, "%s invalid id\n", __func__);
return NULL;
}
return &dmic_hw_gain_ctrl_regs[id];
}
static void mtk_dai_dmic_hw_gain_bypass(struct mtk_base_afe *afe,
unsigned int id, bool bypass)
{
const struct mtk_dai_dmic_hw_gain_ctrl_reg *reg;
unsigned int msk;
reg = get_dmic_hw_gain_ctrl_reg(afe, id);
if (!reg)
return;
switch (id) {
case DMIC0:
msk = DMIC_BYPASS_HW_GAIN_DMIC1_BYPASS;
break;
case DMIC1:
msk = DMIC_BYPASS_HW_GAIN_DMIC2_BYPASS;
break;
case DMIC2:
msk = DMIC_BYPASS_HW_GAIN_DMIC3_BYPASS;
break;
case DMIC3:
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `sound/pcm_params.h`, `mt8188-afe-clk.h`, `mt8188-afe-common.h`, `mt8188-reg.h`.
- Detected declarations: `struct mtk_dai_dmic_ctrl_reg`, `struct mtk_dai_dmic_hw_gain_ctrl_reg`, `struct mtk_dai_dmic_priv`, `function mtk_dai_dmic_hw_gain_bypass`, `function mtk_dai_dmic_hw_gain_on`, `function mtk_dai_dmic_load_iir_coeff_table`, `function mtk_dai_dmic_configure_array`, `function mtk_dmic_channels_to_dmic_number`, `function mtk_dai_dmic_hw_gain_enable`, `function mtk_dmic_gain_event`.
- 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.