drivers/clk/tegra/clk.c
Source file repositories/reference/linux-study-clean/drivers/clk/tegra/clk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/tegra/clk.c- Extension
.c- Size
- 10324 bytes
- Lines
- 452
- 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/clkdev.hlinux/clk.hlinux/clk-provider.hlinux/delay.hlinux/io.hlinux/of.hlinux/of_platform.hlinux/clk/tegra.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset-controller.hlinux/string_helpers.hsoc/tegra/fuse.hclk.h
Detected Declarations
function tegra_clk_rst_assertfunction tegra_clk_rst_deassertfunction tegra_clk_rst_resetfunction tegra_clk_set_pllp_out_cpufunction tegra_clk_periph_suspendfunction tegra_clk_periph_resumefunction tegra_clk_periph_ctx_initfunction tegra_clk_initfunction tegra_init_dup_clksfunction tegra_init_from_tablefunction tegra_add_of_providerfunction tegra_init_special_resetsfunction tegra_register_devclksfunction tegra_lookup_dt_idfunction for_each_child_of_nodefunction tegra_clocks_apply_init_table
Annotated Snippet
if (tegra_clk_periph_ctx_init(banks)) {
kfree(periph_clk_enb_refcnt);
kfree(clks);
return NULL;
}
}
return clks;
}
void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
struct clk *clks[], int clk_max)
{
struct clk *clk;
for (; dup_list->clk_id < clk_max; dup_list++) {
clk = clks[dup_list->clk_id];
dup_list->lookup.clk = clk;
clkdev_add(&dup_list->lookup);
}
}
void tegra_init_from_table(struct tegra_clk_init_table *tbl,
struct clk *clks[], int clk_max)
{
struct clk *clk;
for (; tbl->clk_id < clk_max; tbl++) {
clk = clks[tbl->clk_id];
if (IS_ERR_OR_NULL(clk)) {
pr_err("%s: invalid entry %ld in clks array for id %d\n",
__func__, PTR_ERR(clk), tbl->clk_id);
WARN_ON(1);
continue;
}
if (tbl->parent_id < clk_max) {
struct clk *parent = clks[tbl->parent_id];
if (clk_set_parent(clk, parent)) {
pr_err("%s: Failed to set parent %s of %s\n",
__func__, __clk_get_name(parent),
__clk_get_name(clk));
WARN_ON(1);
}
}
if (tbl->rate)
if (clk_set_rate(clk, tbl->rate)) {
pr_err("%s: Failed to set rate %lu of %s\n",
__func__, tbl->rate,
__clk_get_name(clk));
WARN_ON(1);
}
if (tbl->state)
if (clk_prepare_enable(clk)) {
pr_err("%s: Failed to enable %s\n", __func__,
__clk_get_name(clk));
WARN_ON(1);
}
}
}
static const struct reset_control_ops rst_ops = {
.assert = tegra_clk_rst_assert,
.deassert = tegra_clk_rst_deassert,
.reset = tegra_clk_rst_reset,
};
static struct reset_controller_dev rst_ctlr = {
.ops = &rst_ops,
.owner = THIS_MODULE,
.of_reset_n_cells = 1,
};
void __init tegra_add_of_provider(struct device_node *np,
void *clk_src_onecell_get)
{
int i;
tegra_car_np = np;
for (i = 0; i < clk_num; i++) {
if (IS_ERR(clks[i])) {
pr_err
("Tegra clk %d: register failed with %ld\n",
i, PTR_ERR(clks[i]));
}
if (!clks[i])
Annotation
- Immediate include surface: `linux/clkdev.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/io.h`, `linux/of.h`, `linux/of_platform.h`, `linux/clk/tegra.h`.
- Detected declarations: `function tegra_clk_rst_assert`, `function tegra_clk_rst_deassert`, `function tegra_clk_rst_reset`, `function tegra_clk_set_pllp_out_cpu`, `function tegra_clk_periph_suspend`, `function tegra_clk_periph_resume`, `function tegra_clk_periph_ctx_init`, `function tegra_clk_init`, `function tegra_init_dup_clks`, `function tegra_init_from_table`.
- 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.