sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8195/mt8195-dai-etdm.c- Extension
.c- Size
- 79700 bytes
- Lines
- 2755
- 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.hmt8195-afe-clk.hmt8195-afe-common.hmt8195-reg.h
Detected Declarations
struct etdm_con_regstruct mtk_dai_etdm_ratestruct mtk_dai_etdm_privfunction mt8195_afe_etdm_is_validfunction mt8195_afe_hdmitx_dptx_is_validfunction get_etdm_fs_timingfunction get_etdm_ch_fixupfunction get_etdm_regfunction get_etdm_dirfunction get_etdm_wlenfunction is_cowork_modefunction sync_to_dai_idfunction get_etdm_cowork_master_idfunction mt8195_etdm_clk_src_sel_putfunction mt8195_etdm_clk_src_sel_getfunction mt8195_afe_enable_etdmfunction mt8195_afe_disable_etdmfunction etdm_cowork_slv_selfunction mt8195_etdm_sync_mode_configurefunction mtk_dai_etdm_get_cg_id_by_dai_idfunction mtk_dai_etdm_get_clk_id_by_dai_idfunction mtk_dai_etdm_get_clkdiv_id_by_dai_idfunction mtk_dai_etdm_enable_mclkfunction mtk_dai_etdm_disable_mclkfunction mtk_dai_etdm_startupfunction mtk_dai_etdm_shutdownfunction mtk_dai_etdm_fifo_modefunction mtk_dai_etdm_in_configurefunction mtk_dai_etdm_out_configurefunction mtk_dai_etdm_mclk_configurefunction mtk_dai_etdm_configurefunction mtk_dai_etdm_hw_paramsfunction mtk_dai_etdm_triggerfunction mtk_dai_etdm_cal_mclkfunction mtk_dai_etdm_set_sysclkfunction mtk_dai_etdm_set_tdm_slotfunction mtk_dai_etdm_set_fmtfunction mtk_dai_hdmitx_dptx_startupfunction mtk_dai_hdmitx_dptx_shutdownfunction mtk_dai_get_dptx_ch_enfunction mtk_dai_get_dptx_chfunction mtk_dai_get_dptx_wlenfunction mtk_dai_hdmitx_dptx_hw_paramsfunction mtk_dai_hdmitx_dptx_triggerfunction mtk_dai_hdmitx_dptx_set_sysclkfunction mtk_dai_etdm_probefunction mt8195_etdm_update_sync_infofunction mt8195_dai_etdm_parse_of
Annotated Snippet
struct etdm_con_reg {
unsigned int con0;
unsigned int con1;
unsigned int con2;
unsigned int con3;
unsigned int con4;
unsigned int con5;
};
struct mtk_dai_etdm_rate {
unsigned int rate;
unsigned int reg_value;
};
struct mtk_dai_etdm_priv {
unsigned int clock_mode;
unsigned int data_mode;
bool slave_mode;
bool lrck_inv;
bool bck_inv;
unsigned int format;
unsigned int slots;
unsigned int lrck_width;
unsigned int mclk_freq;
unsigned int mclk_apll;
unsigned int mclk_dir;
int cowork_source_id; //dai id
unsigned int cowork_slv_count;
int cowork_slv_id[MT8195_AFE_IO_ETDM_NUM - 1]; //dai_id
bool in_disable_ch[MT8195_ETDM_MAX_CHANNELS];
unsigned int en_ref_cnt;
};
static const struct mtk_dai_etdm_rate mt8195_etdm_rates[] = {
{ .rate = 8000, .reg_value = 0, },
{ .rate = 12000, .reg_value = 1, },
{ .rate = 16000, .reg_value = 2, },
{ .rate = 24000, .reg_value = 3, },
{ .rate = 32000, .reg_value = 4, },
{ .rate = 48000, .reg_value = 5, },
{ .rate = 96000, .reg_value = 7, },
{ .rate = 192000, .reg_value = 9, },
{ .rate = 384000, .reg_value = 11, },
{ .rate = 11025, .reg_value = 16, },
{ .rate = 22050, .reg_value = 17, },
{ .rate = 44100, .reg_value = 18, },
{ .rate = 88200, .reg_value = 19, },
{ .rate = 176400, .reg_value = 20, },
{ .rate = 352800, .reg_value = 21, },
};
static bool mt8195_afe_etdm_is_valid(int id)
{
switch (id) {
case MT8195_AFE_IO_ETDM1_IN:
fallthrough;
case MT8195_AFE_IO_ETDM2_IN:
fallthrough;
case MT8195_AFE_IO_ETDM1_OUT:
fallthrough;
case MT8195_AFE_IO_ETDM2_OUT:
fallthrough;
case MT8195_AFE_IO_DPTX:
fallthrough;
case MT8195_AFE_IO_ETDM3_OUT:
return true;
default:
return false;
}
}
static bool mt8195_afe_hdmitx_dptx_is_valid(int id)
{
switch (id) {
case MT8195_AFE_IO_DPTX:
fallthrough;
case MT8195_AFE_IO_ETDM3_OUT:
return true;
default:
return false;
}
}
static int get_etdm_fs_timing(unsigned int rate)
{
int i;
for (i = 0; i < ARRAY_SIZE(mt8195_etdm_rates); i++)
if (mt8195_etdm_rates[i].rate == rate)
return mt8195_etdm_rates[i].reg_value;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `sound/pcm_params.h`, `mt8195-afe-clk.h`, `mt8195-afe-common.h`, `mt8195-reg.h`.
- Detected declarations: `struct etdm_con_reg`, `struct mtk_dai_etdm_rate`, `struct mtk_dai_etdm_priv`, `function mt8195_afe_etdm_is_valid`, `function mt8195_afe_hdmitx_dptx_is_valid`, `function get_etdm_fs_timing`, `function get_etdm_ch_fixup`, `function get_etdm_reg`, `function get_etdm_dir`, `function get_etdm_wlen`.
- 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.