sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8192/mt8192-dai-tdm.c- Extension
.c- Size
- 20621 bytes
- Lines
- 779
- 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.hsound/pcm_params.hmt8192-afe-clk.hmt8192-afe-common.hmt8192-afe-gpio.hmt8192-interconnection.h
Detected Declarations
struct mtk_afe_tdm_privfunction get_tdm_wlenfunction get_tdm_channel_bckfunction get_tdm_lrck_widthfunction get_tdm_chfunction get_tdm_ch_fixupfunction get_tdm_ch_per_sdatafunction get_tdm_id_by_namefunction mtk_tdm_en_eventfunction mtk_tdm_bck_en_eventfunction mtk_tdm_mck_en_eventfunction mtk_afe_tdm_apll_connectfunction mtk_dai_tdm_cal_mclkfunction mtk_dai_tdm_hw_paramsfunction mtk_dai_tdm_set_sysclkfunction mtk_dai_tdm_set_fmtfunction mt8192_dai_tdm_register
Annotated Snippet
struct mtk_afe_tdm_priv {
int id;
int bck_id;
int bck_rate;
int tdm_out_mode;
int bck_invert;
int lck_invert;
int mclk_id;
int mclk_multiple; /* according to sample rate */
int mclk_rate;
int mclk_apll;
};
enum {
TDM_OUT_I2S = 0,
TDM_OUT_DSP_A = 1,
TDM_OUT_DSP_B = 2,
};
enum {
TDM_BCK_NON_INV = 0,
TDM_BCK_INV = 1,
};
enum {
TDM_LCK_NON_INV = 0,
TDM_LCK_INV = 1,
};
enum {
TDM_WLEN_16_BIT = 1,
TDM_WLEN_32_BIT = 2,
};
enum {
TDM_CHANNEL_BCK_16 = 0,
TDM_CHANNEL_BCK_24 = 1,
TDM_CHANNEL_BCK_32 = 2,
};
enum {
TDM_CHANNEL_NUM_2 = 0,
TDM_CHANNEL_NUM_4 = 1,
TDM_CHANNEL_NUM_8 = 2,
};
enum {
TDM_CH_START_O30_O31 = 0,
TDM_CH_START_O32_O33,
TDM_CH_START_O34_O35,
TDM_CH_START_O36_O37,
TDM_CH_ZERO,
};
static unsigned int get_tdm_wlen(snd_pcm_format_t format)
{
return snd_pcm_format_physical_width(format) <= 16 ?
TDM_WLEN_16_BIT : TDM_WLEN_32_BIT;
}
static unsigned int get_tdm_channel_bck(snd_pcm_format_t format)
{
return snd_pcm_format_physical_width(format) <= 16 ?
TDM_CHANNEL_BCK_16 : TDM_CHANNEL_BCK_32;
}
static unsigned int get_tdm_lrck_width(snd_pcm_format_t format)
{
return snd_pcm_format_physical_width(format) - 1;
}
static unsigned int get_tdm_ch(unsigned int ch)
{
switch (ch) {
case 1:
case 2:
return TDM_CHANNEL_NUM_2;
case 3:
case 4:
return TDM_CHANNEL_NUM_4;
case 5:
case 6:
case 7:
case 8:
default:
return TDM_CHANNEL_NUM_8;
}
}
static unsigned int get_tdm_ch_fixup(unsigned int channels)
Annotation
- Immediate include surface: `linux/regmap.h`, `sound/pcm_params.h`, `mt8192-afe-clk.h`, `mt8192-afe-common.h`, `mt8192-afe-gpio.h`, `mt8192-interconnection.h`.
- Detected declarations: `struct mtk_afe_tdm_priv`, `function get_tdm_wlen`, `function get_tdm_channel_bck`, `function get_tdm_lrck_width`, `function get_tdm_ch`, `function get_tdm_ch_fixup`, `function get_tdm_ch_per_sdata`, `function get_tdm_id_by_name`, `function mtk_tdm_en_event`, `function mtk_tdm_bck_en_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.