sound/soc/mediatek/mt8196/mt8196-dai-tdm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8196/mt8196-dai-tdm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8196/mt8196-dai-tdm.c- Extension
.c- Size
- 17123 bytes
- Lines
- 676
- 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.hmt8196-afe-clk.hmt8196-afe-common.hmt8196-interconnection.h
Detected Declarations
struct mtk_afe_tdm_privfunction get_tdm_wlenfunction get_tdm_channel_bckfunction get_tdm_lrck_widthfunction get_tdm_chfunction get_dptx_ch_enable_maskfunction get_dptx_chfunction get_dptx_wlenfunction get_tdm_id_by_namefunction 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_triggerfunction mtk_dai_tdm_set_sysclkfunction mt8196_dai_tdm_register
Annotated Snippet
struct mtk_afe_tdm_priv {
int bck_id;
int bck_rate;
int mclk_id;
int mclk_multiple; /* according to sample rate */
int mclk_rate;
int mclk_apll;
};
enum {
TDM_WLEN_8_BIT,
TDM_WLEN_16_BIT,
TDM_WLEN_24_BIT,
TDM_WLEN_32_BIT,
};
enum {
TDM_CHANNEL_BCK_16,
TDM_CHANNEL_BCK_24,
TDM_CHANNEL_BCK_32,
};
enum {
TDM_CHANNEL_NUM_2,
TDM_CHANNEL_NUM_4,
TDM_CHANNEL_NUM_8,
};
enum {
TDM_CH_START_O30_O31,
TDM_CH_START_O32_O33,
TDM_CH_START_O34_O35,
TDM_CH_START_O36_O37,
TDM_CH_ZERO,
};
enum {
DPTX_CHANNEL_2,
DPTX_CHANNEL_8,
};
enum {
DPTX_WLEN_24_BIT,
DPTX_WLEN_16_BIT,
};
#define DPTX_CH_EN_MASK_2CH (0x3)
#define DPTX_CH_EN_MASK_4CH (0xf)
#define DPTX_CH_EN_MASK_6CH (0x3f)
#define DPTX_CH_EN_MASK_8CH (0xff)
static unsigned int get_tdm_wlen(snd_pcm_format_t format)
{
return (snd_pcm_format_physical_width(format) / 8) - 1;
}
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_dptx_ch_enable_mask(struct device *dev, unsigned int ch)
{
switch (ch) {
case 1:
Annotation
- Immediate include surface: `linux/regmap.h`, `sound/pcm_params.h`, `mt8196-afe-clk.h`, `mt8196-afe-common.h`, `mt8196-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_dptx_ch_enable_mask`, `function get_dptx_ch`, `function get_dptx_wlen`, `function get_tdm_id_by_name`, `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.