sound/soc/mediatek/mt8189/mt8189-dai-i2s.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8189/mt8189-dai-i2s.c- Extension
.c- Size
- 48095 bytes
- Lines
- 1464
- 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/bitops.hlinux/regmap.hsound/pcm_params.hmt8189-afe-clk.hmt8189-afe-common.hmt8189-interconnection.h../common/mtk-afe-fe-dai.h
Detected Declarations
struct mtk_afe_i2s_privfunction get_etdm_wlenfunction get_etdm_lrck_widthfunction get_etdm_ratefunction get_etdm_inconn_ratefunction get_i2s_id_by_namefunction mtk_apll_eventfunction mtk_mclk_en_eventfunction mtk_afe_i2s_share_connectfunction mtk_afe_i2s_apll_connectfunction mtk_afe_i2s_mclk_connectfunction mtk_afe_mclk_apll_connectfunction mtk_dai_i2s_configfunction mtk_dai_i2s_hw_paramsfunction mtk_dai_i2s_set_sysclkfunction mt8189_dai_i2s_get_sharefunction init_i2s_priv_datafunction mt8189_dai_i2s_register
Annotated Snippet
struct mtk_afe_i2s_priv {
int id;
int rate; /* for determine which apll to use */
int low_jitter_en;
unsigned int i2s_low_power_mask;
const char *share_property_name;
int share_i2s_id;
int mclk_id;
int mclk_rate;
int mclk_apll;
int ch_num;
int sync;
int ip_mode;
int slave_mode;
int lpbk_mode;
};
static unsigned int get_etdm_wlen(snd_pcm_format_t format)
{
return snd_pcm_format_physical_width(format) <= 16 ?
ETDM_WLEN_16_BIT : ETDM_WLEN_32_BIT;
}
static unsigned int get_etdm_lrck_width(snd_pcm_format_t format)
{
if (snd_pcm_format_physical_width(format) <= 1)
return 0;
/* The valid data bit number should be larger than 7 due to hardware limitation. */
return snd_pcm_format_physical_width(format) - 1;
}
static unsigned int get_etdm_rate(unsigned int rate)
{
switch (rate) {
case 8000:
return ETDM_RATE_8K;
case 12000:
return ETDM_RATE_12K;
case 16000:
return ETDM_RATE_16K;
case 24000:
return ETDM_RATE_24K;
case 32000:
return ETDM_RATE_32K;
case 48000:
return ETDM_RATE_48K;
case 64000:
return ETDM_RATE_64K;
case 96000:
return ETDM_RATE_96K;
case 128000:
return ETDM_RATE_128K;
case 192000:
return ETDM_RATE_192K;
case 256000:
return ETDM_RATE_256K;
case 384000:
return ETDM_RATE_384K;
case 11025:
return ETDM_RATE_11025;
case 22050:
return ETDM_RATE_22050;
case 44100:
return ETDM_RATE_44100;
case 88200:
return ETDM_RATE_88200;
case 176400:
return ETDM_RATE_176400;
case 352800:
return ETDM_RATE_352800;
default:
return 0;
}
}
static unsigned int get_etdm_inconn_rate(unsigned int rate)
{
switch (rate) {
case 8000:
return ETDM_CONN_8K;
case 12000:
return ETDM_CONN_12K;
case 16000:
return ETDM_CONN_16K;
case 24000:
return ETDM_CONN_24K;
case 32000:
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/regmap.h`, `sound/pcm_params.h`, `mt8189-afe-clk.h`, `mt8189-afe-common.h`, `mt8189-interconnection.h`, `../common/mtk-afe-fe-dai.h`.
- Detected declarations: `struct mtk_afe_i2s_priv`, `function get_etdm_wlen`, `function get_etdm_lrck_width`, `function get_etdm_rate`, `function get_etdm_inconn_rate`, `function get_i2s_id_by_name`, `function mtk_apll_event`, `function mtk_mclk_en_event`, `function mtk_afe_i2s_share_connect`, `function mtk_afe_i2s_apll_connect`.
- 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.