drivers/clk/ti/dpll.c
Source file repositories/reference/linux-study-clean/drivers/clk/ti/dpll.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ti/dpll.c- Extension
.c- Size
- 20064 bytes
- Lines
- 719
- Domain
- Driver Families
- Bucket
- drivers/clk
- 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/clk.hlinux/clk-provider.hlinux/slab.hlinux/err.hlinux/of.hlinux/of_address.hlinux/clk/ti.hclock.h
Detected Declarations
function _register_dpllfunction _register_dpll_x2function of_ti_dpll_setupfunction of_ti_omap4_dpll_x2_setupfunction of_ti_am3_dpll_x2_setupfunction of_ti_omap3_dpll_setupfunction of_ti_omap3_core_dpll_setupfunction of_ti_omap3_per_dpll_setupfunction of_ti_omap3_per_jtype_dpll_setupfunction of_ti_omap4_dpll_setupfunction of_ti_omap5_mpu_dpll_setupfunction of_ti_omap4_core_dpll_setupfunction of_ti_omap4_m4xen_dpll_setupfunction of_ti_omap4_jtype_dpll_setupfunction of_ti_am3_no_gate_dpll_setupfunction of_ti_am3_jtype_dpll_setupfunction of_ti_am3_no_gate_jtype_dpll_setupfunction of_ti_am3_dpll_setupfunction of_ti_am3_core_dpll_setupfunction of_ti_omap2_core_dpll_setup
Annotated Snippet
if (ret <= 0) {
clk_hw->ops = NULL;
} else if (ti_clk_get_reg_addr(node, 0, &clk_hw->clksel_reg)) {
kfree(clk_hw);
return;
}
}
#endif
/* register the clock */
clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (IS_ERR(clk))
kfree(clk_hw);
else
of_clk_add_provider(node, of_clk_src_simple_get, clk);
}
#endif
/**
* of_ti_dpll_setup - Setup function for OMAP DPLL clocks
* @node: device node containing the DPLL info
* @ops: ops for the DPLL
* @ddt: DPLL data template to use
*
* Initializes a DPLL clock from device tree data.
*/
static void __init of_ti_dpll_setup(struct device_node *node,
const struct clk_ops *ops,
const struct dpll_data *ddt)
{
struct clk_hw_omap *clk_hw = NULL;
struct clk_init_data *init = NULL;
const char **parent_names = NULL;
struct dpll_data *dd = NULL;
int ssc_clk_index;
u8 dpll_mode = 0;
u32 min_div;
dd = kmemdup(ddt, sizeof(*dd), GFP_KERNEL);
clk_hw = kzalloc_obj(*clk_hw);
init = kzalloc_obj(*init);
if (!dd || !clk_hw || !init)
goto cleanup;
clk_hw->dpll_data = dd;
clk_hw->ops = &clkhwops_omap3_dpll;
clk_hw->hw.init = init;
init->name = ti_dt_clk_name(node);
init->ops = ops;
init->num_parents = of_clk_get_parent_count(node);
if (!init->num_parents) {
pr_err("%pOFn must have parent(s)\n", node);
goto cleanup;
}
parent_names = kcalloc(init->num_parents, sizeof(char *), GFP_KERNEL);
if (!parent_names)
goto cleanup;
of_clk_parent_fill(node, parent_names, init->num_parents);
init->parent_names = parent_names;
if (ti_clk_get_reg_addr(node, 0, &dd->control_reg))
goto cleanup;
/*
* Special case for OMAP2 DPLL, register order is different due to
* missing idlest_reg, also clkhwops is different. Detected from
* missing idlest_mask.
*/
if (!dd->idlest_mask) {
if (ti_clk_get_reg_addr(node, 1, &dd->mult_div1_reg))
goto cleanup;
#ifdef CONFIG_ARCH_OMAP2
clk_hw->ops = &clkhwops_omap2xxx_dpll;
omap2xxx_clkt_dpllcore_init(&clk_hw->hw);
#endif
} else {
if (ti_clk_get_reg_addr(node, 1, &dd->idlest_reg))
goto cleanup;
if (ti_clk_get_reg_addr(node, 2, &dd->mult_div1_reg))
goto cleanup;
}
if (dd->autoidle_mask) {
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/slab.h`, `linux/err.h`, `linux/of.h`, `linux/of_address.h`, `linux/clk/ti.h`, `clock.h`.
- Detected declarations: `function _register_dpll`, `function _register_dpll_x2`, `function of_ti_dpll_setup`, `function of_ti_omap4_dpll_x2_setup`, `function of_ti_am3_dpll_x2_setup`, `function of_ti_omap3_dpll_setup`, `function of_ti_omap3_core_dpll_setup`, `function of_ti_omap3_per_dpll_setup`, `function of_ti_omap3_per_jtype_dpll_setup`, `function of_ti_omap4_dpll_setup`.
- Atlas domain: Driver Families / drivers/clk.
- 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.