drivers/clk/ti/composite.c
Source file repositories/reference/linux-study-clean/drivers/clk/ti/composite.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ti/composite.c- Extension
.c- Size
- 6315 bytes
- Lines
- 271
- 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-provider.hlinux/slab.hlinux/io.hlinux/of.hlinux/of_address.hlinux/clk/ti.hlinux/list.hclock.h
Detected Declarations
struct component_clkstruct clk_hw_omap_compfunction Copyrightfunction ti_composite_determine_ratefunction ti_composite_set_ratefunction list_for_each_entryfunction _register_compositefunction of_ti_composite_clk_setupfunction ti_clk_add_component
Annotated Snippet
struct component_clk {
int num_parents;
const char **parent_names;
struct device_node *node;
int type;
struct clk_hw *hw;
struct list_head link;
};
static const char * const component_clk_types[] __initconst = {
"gate", "divider", "mux"
};
static LIST_HEAD(component_clks);
static struct device_node *_get_component_node(struct device_node *node, int i)
{
int rc;
struct of_phandle_args clkspec;
rc = of_parse_phandle_with_args(node, "clocks", "#clock-cells", i,
&clkspec);
if (rc)
return NULL;
return clkspec.np;
}
static struct component_clk *_lookup_component(struct device_node *node)
{
struct component_clk *comp;
list_for_each_entry(comp, &component_clks, link) {
if (comp->node == node)
return comp;
}
return NULL;
}
struct clk_hw_omap_comp {
struct clk_hw hw;
struct device_node *comp_nodes[CLK_COMPONENT_TYPE_MAX];
struct component_clk *comp_clks[CLK_COMPONENT_TYPE_MAX];
};
static inline struct clk_hw *_get_hw(struct clk_hw_omap_comp *clk, int idx)
{
if (!clk)
return NULL;
if (!clk->comp_clks[idx])
return NULL;
return clk->comp_clks[idx]->hw;
}
#define to_clk_hw_comp(_hw) container_of(_hw, struct clk_hw_omap_comp, hw)
static void __init _register_composite(void *user,
struct device_node *node)
{
struct clk_hw *hw = user;
struct clk *clk;
struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw);
struct component_clk *comp;
int num_parents = 0;
const char **parent_names = NULL;
const char *name;
int i;
int ret;
/* Check for presence of each component clock */
for (i = 0; i < CLK_COMPONENT_TYPE_MAX; i++) {
if (!cclk->comp_nodes[i])
continue;
comp = _lookup_component(cclk->comp_nodes[i]);
if (!comp) {
pr_debug("component %s not ready for %pOFn, retry\n",
cclk->comp_nodes[i]->name, node);
if (!ti_clk_retry_init(node, hw,
_register_composite))
return;
goto cleanup;
}
if (cclk->comp_clks[comp->type] != NULL) {
pr_err("duplicate component types for %pOFn (%s)!\n",
node, component_clk_types[comp->type]);
goto cleanup;
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/slab.h`, `linux/io.h`, `linux/of.h`, `linux/of_address.h`, `linux/clk/ti.h`, `linux/list.h`, `clock.h`.
- Detected declarations: `struct component_clk`, `struct clk_hw_omap_comp`, `function Copyright`, `function ti_composite_determine_rate`, `function ti_composite_set_rate`, `function list_for_each_entry`, `function _register_composite`, `function of_ti_composite_clk_setup`, `function ti_clk_add_component`.
- 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.