drivers/clk/qcom/clk-alpha-pll.c
Source file repositories/reference/linux-study-clean/drivers/clk/qcom/clk-alpha-pll.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/qcom/clk-alpha-pll.c- Extension
.c- Size
- 92275 bytes
- Lines
- 3203
- Domain
- Driver Families
- Bucket
- drivers/clk
- 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/kernel.hlinux/export.hlinux/clk-provider.hlinux/regmap.hlinux/delay.hclk-alpha-pll.hcommon.h
Detected Declarations
function wait_for_pllfunction clk_alpha_pll_write_configfunction clk_alpha_pll_configurefunction clk_alpha_pll_hwfsm_enablefunction clk_alpha_pll_hwfsm_disablefunction pll_is_enabledfunction clk_alpha_pll_hwfsm_is_enabledfunction clk_alpha_pll_is_enabledfunction clk_alpha_pll_enablefunction clk_alpha_pll_disablefunction alpha_pll_calc_ratefunction alpha_pll_round_ratefunction alpha_pll_find_vcofunction clk_alpha_pll_recalc_ratefunction __clk_alpha_pll_update_latchfunction clk_alpha_pll_update_latchfunction clk_alpha_pll_update_configsfunction __clk_alpha_pll_set_ratefunction clk_alpha_pll_set_ratefunction clk_alpha_pll_hwfsm_set_ratefunction clk_alpha_pll_determine_ratefunction clk_huayra_2290_pll_configurefunction alpha_huayra_pll_calc_ratefunction alpha_huayra_pll_round_ratefunction alpha_pll_huayra_recalc_ratefunction alpha_pll_huayra_set_ratefunction alpha_pll_huayra_determine_ratefunction trion_pll_is_enabledfunction clk_trion_pll_is_enabledfunction clk_trion_pll_enablefunction clk_trion_pll_disablefunction clk_trion_pll_recalc_ratefunction clk_alpha_pll_postdiv_recalc_ratefunction clk_alpha_pll_postdiv_determine_ratefunction clk_alpha_pll_postdiv_ro_determine_ratefunction clk_alpha_pll_postdiv_set_ratefunction clk_fabia_pll_configurefunction alpha_pll_fabia_enablefunction alpha_pll_fabia_disablefunction alpha_pll_fabia_recalc_ratefunction alpha_pll_check_rate_marginfunction alpha_pll_fabia_set_ratefunction alpha_pll_fabia_preparefunction clk_alpha_pll_postdiv_fabia_recalc_ratefunction clk_trion_pll_postdiv_recalc_ratefunction clk_trion_pll_postdiv_determine_ratefunction clk_trion_pll_postdiv_set_ratefunction clk_alpha_pll_postdiv_fabia_determine_rate
Annotated Snippet
if (alpha_width > 32) {
if (regmap_read(pll->clkr.regmap, PLL_ALPHA_VAL_U(pll),
&high))
return 0;
a = (u64)high << 32 | low;
} else {
a = low & GENMASK(alpha_width - 1, 0);
}
if (alpha_width > ALPHA_BITWIDTH)
a >>= alpha_width - ALPHA_BITWIDTH;
}
return alpha_pll_calc_rate(prate, l, a, alpha_width);
}
static int __clk_alpha_pll_update_latch(struct clk_alpha_pll *pll)
{
int ret;
u32 mode;
regmap_read(pll->clkr.regmap, PLL_MODE(pll), &mode);
/* Latch the input to the PLL */
regmap_update_bits(pll->clkr.regmap, PLL_MODE(pll), PLL_UPDATE,
PLL_UPDATE);
/* Wait for 2 reference cycle before checking ACK bit */
udelay(1);
/*
* PLL will latch the new L, Alpha and freq control word.
* PLL will respond by raising PLL_ACK_LATCH output when new programming
* has been latched in and PLL is being updated. When
* UPDATE_LOGIC_BYPASS bit is not set, PLL_UPDATE will be cleared
* automatically by hardware when PLL_ACK_LATCH is asserted by PLL.
*/
if (mode & PLL_UPDATE_BYPASS) {
ret = wait_for_pll_update_ack_set(pll);
if (ret)
return ret;
regmap_update_bits(pll->clkr.regmap, PLL_MODE(pll), PLL_UPDATE, 0);
} else {
ret = wait_for_pll_update(pll);
if (ret)
return ret;
}
ret = wait_for_pll_update_ack_clear(pll);
if (ret)
return ret;
/* Wait for PLL output to stabilize */
udelay(10);
return 0;
}
static int clk_alpha_pll_update_latch(struct clk_alpha_pll *pll,
int (*is_enabled)(struct clk_hw *))
{
if (!is_enabled(&pll->clkr.hw) ||
!(pll->flags & SUPPORTS_DYNAMIC_UPDATE))
return 0;
return __clk_alpha_pll_update_latch(pll);
}
static void clk_alpha_pll_update_configs(struct clk_alpha_pll *pll, const struct pll_vco *vco,
u32 l, u64 alpha, u32 alpha_width, bool alpha_en)
{
regmap_write(pll->clkr.regmap, PLL_L_VAL(pll), l);
if (alpha_width > ALPHA_BITWIDTH)
alpha <<= alpha_width - ALPHA_BITWIDTH;
if (alpha_width > 32)
regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL_U(pll), upper_32_bits(alpha));
regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL(pll), lower_32_bits(alpha));
if (vco) {
regmap_update_bits(pll->clkr.regmap, PLL_USER_CTL(pll),
PLL_VCO_MASK << PLL_VCO_SHIFT,
vco->val << PLL_VCO_SHIFT);
}
if (alpha_en)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/export.h`, `linux/clk-provider.h`, `linux/regmap.h`, `linux/delay.h`, `clk-alpha-pll.h`, `common.h`.
- Detected declarations: `function wait_for_pll`, `function clk_alpha_pll_write_config`, `function clk_alpha_pll_configure`, `function clk_alpha_pll_hwfsm_enable`, `function clk_alpha_pll_hwfsm_disable`, `function pll_is_enabled`, `function clk_alpha_pll_hwfsm_is_enabled`, `function clk_alpha_pll_is_enabled`, `function clk_alpha_pll_enable`, `function clk_alpha_pll_disable`.
- Atlas domain: Driver Families / drivers/clk.
- 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.