sound/soc/mediatek/mt6797/mt6797-dai-adda.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt6797/mt6797-dai-adda.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt6797/mt6797-dai-adda.c- Extension
.c- Size
- 9266 bytes
- Lines
- 324
- 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.hlinux/delay.hmt6797-afe-common.hmt6797-interconnection.hmt6797-reg.h../common/mtk-dai-adda-common.h
Detected Declarations
function mtk_adda_ul_eventfunction mtk_dai_adda_hw_paramsfunction mt6797_dai_adda_register
Annotated Snippet
switch (rate) {
case 192000:
dl_src2_con0 |= (0x1 << 24); /* UP_SAMPLING_RATE_X2 */
dl_src2_con0 |= 1 << 14;
break;
case 96000:
dl_src2_con0 |= (0x2 << 24); /* UP_SAMPLING_RATE_X4 */
dl_src2_con0 |= 1 << 14;
break;
default:
dl_src2_con0 |= (0x3 << 24); /* UP_SAMPLING_RATE_X8 */
break;
}
/* turn off mute function */
dl_src2_con0 |= (0x03 << 11);
/* set voice input data if input sample rate is 8k or 16k */
if (rate == 8000 || rate == 16000)
dl_src2_con0 |= 0x01 << 5;
if (rate < 96000) {
/* SA suggest apply -0.3db to audio/speech path */
dl_src2_con1 = 0xf74f0000;
} else {
/* SA suggest apply -0.3db to audio/speech path
* with DL gain set to half,
* 0xFFFF = 0dB -> 0x8000 = 0dB when 96k, 192k
*/
dl_src2_con1 = 0x7ba70000;
}
/* turn on down-link gain */
dl_src2_con0 = dl_src2_con0 | (0x01 << 1);
regmap_write(afe->regmap, AFE_ADDA_DL_SRC2_CON0, dl_src2_con0);
regmap_write(afe->regmap, AFE_ADDA_DL_SRC2_CON1, dl_src2_con1);
} else {
unsigned int voice_mode = 0;
unsigned int ul_src_con0 = 0; /* default value */
/* Using Internal ADC */
regmap_update_bits(afe->regmap,
AFE_ADDA_TOP_CON0,
0x1 << 0,
0x0 << 0);
voice_mode = mtk_adda_ul_rate_transform(afe, rate);
ul_src_con0 |= (voice_mode << 17) & (0x7 << 17);
/* up8x txif sat on */
regmap_write(afe->regmap, AFE_ADDA_NEWIF_CFG0, 0x03F87201);
if (rate >= 96000) { /* hires */
/* use hires format [1 0 23] */
regmap_update_bits(afe->regmap,
AFE_ADDA_NEWIF_CFG0,
0x1 << 5,
0x1 << 5);
regmap_update_bits(afe->regmap,
AFE_ADDA_NEWIF_CFG2,
0xf << 28,
voice_mode << 28);
} else { /* normal 8~48k */
/* use fixed 260k anc path */
regmap_update_bits(afe->regmap,
AFE_ADDA_NEWIF_CFG2,
0xf << 28,
8 << 28);
/* ul_use_cic_out */
ul_src_con0 |= 0x1 << 20;
}
regmap_update_bits(afe->regmap,
AFE_ADDA_NEWIF_CFG2,
0xf << 28,
8 << 28);
regmap_update_bits(afe->regmap,
AFE_ADDA_UL_SRC_CON0,
0xfffffffe,
ul_src_con0);
}
return 0;
}
Annotation
- Immediate include surface: `linux/regmap.h`, `linux/delay.h`, `mt6797-afe-common.h`, `mt6797-interconnection.h`, `mt6797-reg.h`, `../common/mtk-dai-adda-common.h`.
- Detected declarations: `function mtk_adda_ul_event`, `function mtk_dai_adda_hw_params`, `function mt6797_dai_adda_register`.
- 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.