drivers/clk/ti/interface.c
Source file repositories/reference/linux-study-clean/drivers/clk/ti/interface.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ti/interface.c- Extension
.c- Size
- 3875 bytes
- Lines
- 143
- 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/of.hlinux/of_address.hlinux/clk/ti.hclock.h
Detected Declarations
function _of_ti_interface_clk_setupfunction of_ti_interface_clk_setupfunction of_ti_no_wait_interface_clk_setupfunction of_ti_hsotgusb_interface_clk_setupfunction of_ti_dss_interface_clk_setupfunction of_ti_ssi_interface_clk_setupfunction of_ti_am35xx_interface_clk_setupfunction of_ti_omap2430_interface_clk_setup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* OMAP interface clock support
*
* Copyright (C) 2013 Texas Instruments, Inc.
*
* Tero Kristo <t-kristo@ti.com>
*/
#include <linux/clk-provider.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/clk/ti.h>
#include "clock.h"
#undef pr_fmt
#define pr_fmt(fmt) "%s: " fmt, __func__
static const struct clk_ops ti_interface_clk_ops = {
.init = &omap2_init_clk_clkdm,
.enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
};
static struct clk *_register_interface(struct device_node *node,
const char *name,
const char *parent_name,
struct clk_omap_reg *reg, u8 bit_idx,
const struct clk_hw_omap_ops *ops)
{
struct clk_init_data init = { NULL };
struct clk_hw_omap *clk_hw;
struct clk *clk;
clk_hw = kzalloc_obj(*clk_hw);
if (!clk_hw)
return ERR_PTR(-ENOMEM);
clk_hw->hw.init = &init;
clk_hw->ops = ops;
memcpy(&clk_hw->enable_reg, reg, sizeof(*reg));
clk_hw->enable_bit = bit_idx;
init.name = name;
init.ops = &ti_interface_clk_ops;
init.flags = 0;
init.num_parents = 1;
init.parent_names = &parent_name;
clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (IS_ERR(clk))
kfree(clk_hw);
return clk;
}
static void __init _of_ti_interface_clk_setup(struct device_node *node,
const struct clk_hw_omap_ops *ops)
{
struct clk *clk;
const char *parent_name;
struct clk_omap_reg reg;
u8 enable_bit = 0;
const char *name;
if (ti_clk_get_reg_addr(node, 0, ®))
return;
enable_bit = reg.bit;
parent_name = of_clk_get_parent_name(node, 0);
if (!parent_name) {
pr_err("%pOFn must have a parent\n", node);
return;
}
name = ti_dt_clk_name(node);
clk = _register_interface(node, name, parent_name, ®,
enable_bit, ops);
if (!IS_ERR(clk))
of_clk_add_provider(node, of_clk_src_simple_get, clk);
}
static void __init of_ti_interface_clk_setup(struct device_node *node)
{
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/slab.h`, `linux/of.h`, `linux/of_address.h`, `linux/clk/ti.h`, `clock.h`.
- Detected declarations: `function _of_ti_interface_clk_setup`, `function of_ti_interface_clk_setup`, `function of_ti_no_wait_interface_clk_setup`, `function of_ti_hsotgusb_interface_clk_setup`, `function of_ti_dss_interface_clk_setup`, `function of_ti_ssi_interface_clk_setup`, `function of_ti_am35xx_interface_clk_setup`, `function of_ti_omap2430_interface_clk_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.