sound/soc/mediatek/mt8196/mt8196-afe-clk.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8196/mt8196-afe-clk.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8196/mt8196-afe-clk.c- Extension
.c- Size
- 14739 bytes
- Lines
- 582
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/regmap.hlinux/mfd/syscon.hmt8196-afe-clk.hmt8196-afe-common.h
Detected Declarations
function mt8196_afe_enable_clkfunction mt8196_afe_disable_clkfunction mt8196_afe_set_clk_ratefunction get_top_cg_regfunction get_top_cg_maskfunction get_top_cg_on_valfunction get_top_cg_off_valfunction mt8196_afe_enable_top_cgfunction mt8196_afe_disable_top_cgfunction apll1_mux_settingfunction apll2_mux_settingfunction mt8196_apll1_enablefunction mt8196_apll1_disablefunction mt8196_apll2_enablefunction mt8196_apll2_disablefunction mt8196_get_apll_ratefunction mt8196_get_apll_by_ratefunction mt8196_get_apll_by_namefunction mt8196_mck_enablefunction mt8196_mck_disablefunction mt8196_afe_enable_reg_rw_clkfunction mt8196_afe_disable_reg_rw_clkfunction mt8196_afe_enable_main_clockfunction mt8196_afe_disable_main_clockfunction mt8196_init_clockexport mt8196_afe_enable_clkexport mt8196_afe_disable_clk
Annotated Snippet
if (ret) {
dev_err(afe->dev, "failed to set clk rate\n");
return ret;
}
}
return 0;
}
static unsigned int get_top_cg_reg(unsigned int cg_type)
{
switch (cg_type) {
case MT8196_AUDIO_26M_EN_ON:
case MT8196_AUDIO_F3P25M_EN_ON:
case MT8196_AUDIO_APLL1_EN_ON:
case MT8196_AUDIO_APLL2_EN_ON:
return AUDIO_ENGEN_CON0;
case MT8196_CG_AUDIO_HOPPING_CK:
case MT8196_CG_AUDIO_F26M_CK:
case MT8196_CG_APLL1_CK:
case MT8196_CG_APLL2_CK:
case MT8196_PDN_APLL_TUNER2:
case MT8196_PDN_APLL_TUNER1:
return AUDIO_TOP_CON4;
default:
return 0;
}
}
static unsigned int get_top_cg_mask(unsigned int cg_type)
{
switch (cg_type) {
case MT8196_AUDIO_26M_EN_ON:
return AUDIO_26M_EN_ON_MASK_SFT;
case MT8196_AUDIO_F3P25M_EN_ON:
return AUDIO_F3P25M_EN_ON_MASK_SFT;
case MT8196_AUDIO_APLL1_EN_ON:
return AUDIO_APLL1_EN_ON_MASK_SFT;
case MT8196_AUDIO_APLL2_EN_ON:
return AUDIO_APLL2_EN_ON_MASK_SFT;
case MT8196_CG_AUDIO_HOPPING_CK:
return CG_AUDIO_HOPPING_CK_MASK_SFT;
case MT8196_CG_AUDIO_F26M_CK:
return CG_AUDIO_F26M_CK_MASK_SFT;
case MT8196_CG_APLL1_CK:
return CG_APLL1_CK_MASK_SFT;
case MT8196_CG_APLL2_CK:
return CG_APLL2_CK_MASK_SFT;
case MT8196_PDN_APLL_TUNER2:
return PDN_APLL_TUNER2_MASK_SFT;
case MT8196_PDN_APLL_TUNER1:
return PDN_APLL_TUNER1_MASK_SFT;
default:
return 0;
}
}
static unsigned int get_top_cg_on_val(unsigned int cg_type)
{
switch (cg_type) {
case MT8196_AUDIO_26M_EN_ON:
case MT8196_AUDIO_F3P25M_EN_ON:
case MT8196_AUDIO_APLL1_EN_ON:
case MT8196_AUDIO_APLL2_EN_ON:
return get_top_cg_mask(cg_type);
case MT8196_CG_AUDIO_HOPPING_CK:
case MT8196_CG_AUDIO_F26M_CK:
case MT8196_CG_APLL1_CK:
case MT8196_CG_APLL2_CK:
case MT8196_PDN_APLL_TUNER2:
case MT8196_PDN_APLL_TUNER1:
return 0;
default:
return 0;
}
}
static unsigned int get_top_cg_off_val(unsigned int cg_type)
{
switch (cg_type) {
case MT8196_AUDIO_26M_EN_ON:
case MT8196_AUDIO_F3P25M_EN_ON:
case MT8196_AUDIO_APLL1_EN_ON:
case MT8196_AUDIO_APLL2_EN_ON:
return 0;
case MT8196_CG_AUDIO_HOPPING_CK:
case MT8196_CG_AUDIO_F26M_CK:
case MT8196_CG_APLL1_CK:
case MT8196_CG_APLL2_CK:
case MT8196_PDN_APLL_TUNER2:
Annotation
- Immediate include surface: `linux/clk.h`, `linux/regmap.h`, `linux/mfd/syscon.h`, `mt8196-afe-clk.h`, `mt8196-afe-common.h`.
- Detected declarations: `function mt8196_afe_enable_clk`, `function mt8196_afe_disable_clk`, `function mt8196_afe_set_clk_rate`, `function get_top_cg_reg`, `function get_top_cg_mask`, `function get_top_cg_on_val`, `function get_top_cg_off_val`, `function mt8196_afe_enable_top_cg`, `function mt8196_afe_disable_top_cg`, `function apll1_mux_setting`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.