sound/soc/mediatek/mt8365/mt8365-dai-i2s.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8365/mt8365-dai-i2s.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8365/mt8365-dai-i2s.c- Extension
.c- Size
- 25742 bytes
- Lines
- 843
- 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.hmt8365-afe-clk.hmt8365-afe-common.h
Detected Declarations
struct mtk_afe_i2s_privfunction mt8365_dai_set_configfunction mt8365_afe_set_i2s_outfunction mt8365_afe_set_2nd_i2s_asrcfunction mt8365_afe_set_2nd_i2s_asrc_enablefunction mt8365_afe_set_i2s_out_enablefunction mt8365_dai_set_enablefunction mt8365_dai_i2s_startupfunction mt8365_dai_i2s_shutdownfunction mt8365_dai_i2s_preparefunction mt8365_afe_2nd_i2s_hw_paramsfunction mt8365_afe_2nd_i2s_set_fmtfunction mt8365_dai_i2s_set_privfunction mt8365_dai_i2s_register
Annotated Snippet
struct mtk_afe_i2s_priv {
bool adda_link;
int i2s_out_on_ref_cnt;
int id;
int low_jitter_en;
int mclk_id;
int share_i2s_id;
unsigned int clk_id_in;
unsigned int clk_id_in_m_sel;
unsigned int clk_id_out;
unsigned int clk_id_out_m_sel;
unsigned int clk_in_mult;
unsigned int clk_out_mult;
unsigned int config_val_in;
unsigned int config_val_out;
unsigned int dynamic_bck;
unsigned int reg_off_in;
unsigned int reg_off_out;
};
/* This enum is merely for mtk_afe_i2s_priv declare */
enum {
DAI_I2S0 = 0,
DAI_I2S3,
DAI_I2S_NUM,
};
static const struct mtk_afe_i2s_priv mt8365_i2s_priv[DAI_I2S_NUM] = {
[DAI_I2S0] = {
.id = MT8365_AFE_IO_I2S,
.mclk_id = MT8365_I2S0_MCK,
.share_i2s_id = -1,
.clk_id_in = MT8365_CLK_AUD_I2S2_M,
.clk_id_out = MT8365_CLK_AUD_I2S1_M,
.clk_id_in_m_sel = MT8365_CLK_I2S2_M_SEL,
.clk_id_out_m_sel = MT8365_CLK_I2S1_M_SEL,
.clk_in_mult = 256,
.clk_out_mult = 256,
.adda_link = true,
.config_val_out = AFE_I2S_CON1_I2S2_TO_PAD,
.reg_off_in = AFE_I2S_CON2,
.reg_off_out = AFE_I2S_CON1,
},
[DAI_I2S3] = {
.id = MT8365_AFE_IO_2ND_I2S,
.mclk_id = MT8365_I2S3_MCK,
.share_i2s_id = -1,
.clk_id_in = MT8365_CLK_AUD_I2S0_M,
.clk_id_out = MT8365_CLK_AUD_I2S3_M,
.clk_id_in_m_sel = MT8365_CLK_I2S0_M_SEL,
.clk_id_out_m_sel = MT8365_CLK_I2S3_M_SEL,
.clk_in_mult = 256,
.clk_out_mult = 256,
.adda_link = false,
.config_val_in = AFE_I2S_CON_FROM_IO_MUX,
.reg_off_in = AFE_I2S_CON,
.reg_off_out = AFE_I2S_CON3,
},
};
static const u32 *get_iir_coef(unsigned int input_fs,
unsigned int output_fs, unsigned int *count)
{
static const u32 IIR_COEF_48_TO_44p1[30] = {
0x061fb0, 0x0bd256, 0x061fb0, 0xe3a3e6, 0xf0a300, 0x000003,
0x0e416d, 0x1bb577, 0x0e416d, 0xe59178, 0xf23637, 0x000003,
0x0c7d72, 0x189060, 0x0c7d72, 0xe96f09, 0xf505b2, 0x000003,
0x126054, 0x249143, 0x126054, 0xe1fc0c, 0xf4b20a, 0x000002,
0x000000, 0x323c85, 0x323c85, 0xf76d4e, 0x000000, 0x000002,
};
static const u32 IIR_COEF_44p1_TO_32[42] = {
0x0a6074, 0x0d237a, 0x0a6074, 0xdd8d6c, 0xe0b3f6, 0x000002,
0x0e41f8, 0x128d48, 0x0e41f8, 0xefc14e, 0xf12d7a, 0x000003,
0x0cfa60, 0x11e89c, 0x0cfa60, 0xf1b09e, 0xf27205, 0x000003,
0x15b69c, 0x20e7e4, 0x15b69c, 0xea799a, 0xe9314a, 0x000002,
0x0f79e2, 0x1a7064, 0x0f79e2, 0xf65e4a, 0xf03d8e, 0x000002,
0x10c34f, 0x1ffe4b, 0x10c34f, 0x0bbecb, 0xf2bc4b, 0x000001,
0x000000, 0x23b063, 0x23b063, 0x07335f, 0x000000, 0x000002,
};
static const u32 IIR_COEF_48_TO_32[42] = {
0x0a2a9b, 0x0a2f05, 0x0a2a9b, 0xe73873, 0xe0c525, 0x000002,
0x0dd4ad, 0x0e765a, 0x0dd4ad, 0xf49808, 0xf14844, 0x000003,
0x18a8cd, 0x1c40d0, 0x18a8cd, 0xed2aab, 0xe542ec, 0x000002,
0x13e044, 0x1a47c4, 0x13e044, 0xf44aed, 0xe9acc7, 0x000002,
0x1abd9c, 0x2a5429, 0x1abd9c, 0xff3441, 0xe0fc5f, 0x000001,
0x0d86db, 0x193e2e, 0x0d86db, 0x1a6f15, 0xf14507, 0x000001,
0x000000, 0x1f820c, 0x1f820c, 0x0a1b1f, 0x000000, 0x000002,
};
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/regmap.h`, `sound/pcm_params.h`, `mt8365-afe-clk.h`, `mt8365-afe-common.h`.
- Detected declarations: `struct mtk_afe_i2s_priv`, `function mt8365_dai_set_config`, `function mt8365_afe_set_i2s_out`, `function mt8365_afe_set_2nd_i2s_asrc`, `function mt8365_afe_set_2nd_i2s_asrc_enable`, `function mt8365_afe_set_i2s_out_enable`, `function mt8365_dai_set_enable`, `function mt8365_dai_i2s_startup`, `function mt8365_dai_i2s_shutdown`, `function mt8365_dai_i2s_prepare`.
- 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.