drivers/clk/ti/clkctrl.c
Source file repositories/reference/linux-study-clean/drivers/clk/ti/clkctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ti/clkctrl.c- Extension
.c- Size
- 17533 bytes
- Lines
- 751
- 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.
- 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.hlinux/delay.hlinux/string_helpers.hlinux/timekeeping.hclock.h
Detected Declarations
struct omap_clkctrl_providerstruct omap_clkctrl_clkfunction _omap4_idlestfunction _omap4_is_idlefunction _omap4_is_readyfunction _omap4_is_timeoutfunction _omap4_disable_early_timeoutfunction _omap4_clkctrl_clk_enablefunction _omap4_clkctrl_clk_disablefunction _omap4_clkctrl_clk_is_enabledfunction list_for_each_entryfunction clkctrl_get_clock_namefunction _ti_clkctrl_clk_registerfunction _ti_clkctrl_setup_gatefunction _ti_clkctrl_setup_muxfunction _ti_clkctrl_setup_divfunction _ti_clkctrl_setup_subclksfunction _clkctrl_add_providerfunction clkctrl_get_namefunction of_property_for_each_stringfunction _ti_omap4_clkctrl_setupfunction ti_clk_is_in_standbyexport ti_clk_is_in_standby
Annotated Snippet
struct omap_clkctrl_provider {
void __iomem *base;
struct list_head clocks;
char *clkdm_name;
};
struct omap_clkctrl_clk {
struct clk_hw *clk;
u16 reg_offset;
int bit_offset;
struct list_head node;
};
union omap4_timeout {
u32 cycles;
ktime_t start;
};
static const struct omap_clkctrl_data default_clkctrl_data[] __initconst = {
{ 0 },
};
static u32 _omap4_idlest(u32 val)
{
val &= OMAP4_IDLEST_MASK;
val >>= OMAP4_IDLEST_SHIFT;
return val;
}
static bool _omap4_is_idle(u32 val)
{
val = _omap4_idlest(val);
return val == CLKCTRL_IDLEST_DISABLED;
}
static bool _omap4_is_ready(u32 val)
{
val = _omap4_idlest(val);
return val == CLKCTRL_IDLEST_FUNCTIONAL ||
val == CLKCTRL_IDLEST_INTERFACE_IDLE;
}
static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout)
{
/*
* There are two special cases where ktime_to_ns() can't be
* used to track the timeouts. First one is during early boot
* when the timers haven't been initialized yet. The second
* one is during suspend-resume cycle while timekeeping is
* being suspended / resumed. Clocksource for the system
* can be from a timer that requires pm_runtime access, which
* will eventually bring us here with timekeeping_suspended,
* during both suspend entry and resume paths. This happens
* at least on am43xx platform. Account for flakeyness
* with udelay() by multiplying the timeout value by 2.
*/
if (unlikely(_early_timeout || timekeeping_suspended)) {
if (time->cycles++ < timeout) {
udelay(1 * 2);
return false;
}
} else {
if (!ktime_to_ns(time->start)) {
time->start = ktime_get();
return false;
}
if (ktime_us_delta(ktime_get(), time->start) < timeout) {
cpu_relax();
return false;
}
}
return true;
}
static int __init _omap4_disable_early_timeout(void)
{
_early_timeout = false;
return 0;
}
arch_initcall(_omap4_disable_early_timeout);
static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)
{
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/slab.h`, `linux/of.h`, `linux/of_address.h`, `linux/clk/ti.h`, `linux/delay.h`, `linux/string_helpers.h`, `linux/timekeeping.h`.
- Detected declarations: `struct omap_clkctrl_provider`, `struct omap_clkctrl_clk`, `function _omap4_idlest`, `function _omap4_is_idle`, `function _omap4_is_ready`, `function _omap4_is_timeout`, `function _omap4_disable_early_timeout`, `function _omap4_clkctrl_clk_enable`, `function _omap4_clkctrl_clk_disable`, `function _omap4_clkctrl_clk_is_enabled`.
- 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.