sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt7986/mt7986-dai-etdm.c- Extension
.c- Size
- 11023 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/bitfield.hlinux/bitops.hlinux/regmap.hsound/pcm_params.hmt7986-afe-common.hmt7986-reg.h
Detected Declarations
struct mtk_dai_etdm_privfunction mt7986_etdm_rate_transformfunction get_etdm_wlenfunction mtk_dai_etdm_startupfunction mtk_dai_etdm_shutdownfunction get_etdm_ch_fixupfunction mtk_dai_etdm_configfunction mtk_dai_etdm_hw_paramsfunction mtk_dai_etdm_triggerfunction mtk_dai_etdm_set_fmtfunction mt7986_dai_etdm_register
Annotated Snippet
struct mtk_dai_etdm_priv {
bool bck_inv;
bool lrck_inv;
bool slave_mode;
unsigned int format;
};
static unsigned int mt7986_etdm_rate_transform(struct device *dev, unsigned int rate)
{
switch (rate) {
case 8000:
return MTK_ETDM_RATE_8K;
case 11025:
return MTK_ETDM_RATE_11K;
case 12000:
return MTK_ETDM_RATE_12K;
case 16000:
return MTK_ETDM_RATE_16K;
case 22050:
return MTK_ETDM_RATE_22K;
case 24000:
return MTK_ETDM_RATE_24K;
case 32000:
return MTK_ETDM_RATE_32K;
case 44100:
return MTK_ETDM_RATE_44K;
case 48000:
return MTK_ETDM_RATE_48K;
case 88200:
return MTK_ETDM_RATE_88K;
case 96000:
return MTK_ETDM_RATE_96K;
case 176400:
return MTK_ETDM_RATE_176K;
case 192000:
return MTK_ETDM_RATE_192K;
default:
dev_warn(dev, "%s(), rate %u invalid, using %d!!!\n",
__func__, rate, MTK_ETDM_RATE_48K);
return MTK_ETDM_RATE_48K;
}
}
static int get_etdm_wlen(unsigned int bitwidth)
{
return bitwidth <= 16 ? 16 : 32;
}
/* dai component */
/* interconnection */
static const struct snd_kcontrol_new o124_mix[] = {
SOC_DAPM_SINGLE_AUTODISABLE("I032_Switch", AFE_CONN124_1, 0, 1, 0),
};
static const struct snd_kcontrol_new o125_mix[] = {
SOC_DAPM_SINGLE_AUTODISABLE("I033_Switch", AFE_CONN125_1, 1, 1, 0),
};
static const struct snd_soc_dapm_widget mtk_dai_etdm_widgets[] = {
/* DL */
SND_SOC_DAPM_MIXER("I150", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("I151", SND_SOC_NOPM, 0, 0, NULL, 0),
/* UL */
SND_SOC_DAPM_MIXER("O124", SND_SOC_NOPM, 0, 0, o124_mix, ARRAY_SIZE(o124_mix)),
SND_SOC_DAPM_MIXER("O125", SND_SOC_NOPM, 0, 0, o125_mix, ARRAY_SIZE(o125_mix)),
};
static const struct snd_soc_dapm_route mtk_dai_etdm_routes[] = {
{"I150", NULL, "ETDM Capture"},
{"I151", NULL, "ETDM Capture"},
{"ETDM Playback", NULL, "O124"},
{"ETDM Playback", NULL, "O125"},
{"O124", "I032_Switch", "I032"},
{"O125", "I033_Switch", "I033"},
};
/* dai ops */
static int mtk_dai_etdm_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
struct mt7986_afe_private *afe_priv = afe->platform_priv;
int ret;
ret = clk_bulk_prepare_enable(afe_priv->num_clks, afe_priv->clks);
if (ret)
return dev_err_probe(afe->dev, ret, "Failed to enable clocks\n");
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/regmap.h`, `sound/pcm_params.h`, `mt7986-afe-common.h`, `mt7986-reg.h`.
- Detected declarations: `struct mtk_dai_etdm_priv`, `function mt7986_etdm_rate_transform`, `function get_etdm_wlen`, `function mtk_dai_etdm_startup`, `function mtk_dai_etdm_shutdown`, `function get_etdm_ch_fixup`, `function mtk_dai_etdm_config`, `function mtk_dai_etdm_hw_params`, `function mtk_dai_etdm_trigger`, `function mtk_dai_etdm_set_fmt`.
- 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.