drivers/clk/samsung/clk.c
Source file repositories/reference/linux-study-clean/drivers/clk/samsung/clk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/samsung/clk.c- Extension
.c- Size
- 15299 bytes
- Lines
- 561
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/slab.hlinux/clkdev.hlinux/clk-provider.hlinux/io.hlinux/mfd/syscon.hlinux/mod_devicetable.hlinux/of_address.hlinux/regmap.hlinux/syscore_ops.hclk.h
Detected Declarations
function samsung_clk_savefunction samsung_clk_restorefunction samsung_clk_initfunction samsung_clk_of_add_providerfunction samsung_clk_add_lookupfunction samsung_clk_register_aliasfunction samsung_clk_register_fixed_ratefunction samsung_clk_register_fixed_factorfunction samsung_clk_register_muxfunction samsung_clk_register_divfunction samsung_is_auto_capablefunction samsung_auto_clk_gate_is_enfunction samsung_auto_clk_gate_enfunction samsung_auto_clk_gate_disfunction samsung_clk_register_gatefunction samsung_clk_of_register_fixed_extfunction for_each_matching_node_and_matchfunction samsung_clk_suspendfunction list_for_each_entryfunction samsung_clk_resumefunction samsung_clk_extended_sleep_initfunction samsung_cmu_register_clocksfunction samsung_en_dyn_root_clk_gatingfunction samsung_cmu_register_one
Annotated Snippet
if (!list->id) {
pr_err("%s: clock id missing for index %d\n", __func__,
idx);
continue;
}
clk_hw = ctx->clk_data.hws[list->id];
if (!clk_hw) {
pr_err("%s: failed to find clock %d\n", __func__,
list->id);
continue;
}
ret = clk_hw_register_clkdev(clk_hw, list->alias,
list->dev_name);
if (ret)
pr_err("%s: failed to register lookup %s\n",
__func__, list->alias);
}
}
/* register a list of fixed clocks */
void __init samsung_clk_register_fixed_rate(struct samsung_clk_provider *ctx,
const struct samsung_fixed_rate_clock *list,
unsigned int nr_clk)
{
struct clk_hw *clk_hw;
unsigned int idx;
for (idx = 0; idx < nr_clk; idx++, list++) {
clk_hw = clk_hw_register_fixed_rate(ctx->dev, list->name,
list->parent_name, list->flags, list->fixed_rate);
if (IS_ERR(clk_hw)) {
pr_err("%s: failed to register clock %s\n", __func__,
list->name);
continue;
}
samsung_clk_add_lookup(ctx, clk_hw, list->id);
}
}
/* register a list of fixed factor clocks */
void __init samsung_clk_register_fixed_factor(struct samsung_clk_provider *ctx,
const struct samsung_fixed_factor_clock *list, unsigned int nr_clk)
{
struct clk_hw *clk_hw;
unsigned int idx;
for (idx = 0; idx < nr_clk; idx++, list++) {
clk_hw = clk_hw_register_fixed_factor(ctx->dev, list->name,
list->parent_name, list->flags, list->mult, list->div);
if (IS_ERR(clk_hw)) {
pr_err("%s: failed to register clock %s\n", __func__,
list->name);
continue;
}
samsung_clk_add_lookup(ctx, clk_hw, list->id);
}
}
/* register a list of mux clocks */
void __init samsung_clk_register_mux(struct samsung_clk_provider *ctx,
const struct samsung_mux_clock *list,
unsigned int nr_clk)
{
struct clk_hw *clk_hw;
unsigned int idx;
for (idx = 0; idx < nr_clk; idx++, list++) {
clk_hw = clk_hw_register_mux(ctx->dev, list->name,
list->parent_names, list->num_parents, list->flags,
ctx->reg_base + list->offset,
list->shift, list->width, list->mux_flags, &ctx->lock);
if (IS_ERR(clk_hw)) {
pr_err("%s: failed to register clock %s\n", __func__,
list->name);
continue;
}
samsung_clk_add_lookup(ctx, clk_hw, list->id);
}
}
/* register a list of div clocks */
void __init samsung_clk_register_div(struct samsung_clk_provider *ctx,
const struct samsung_div_clock *list,
unsigned int nr_clk)
{
Annotation
- Immediate include surface: `linux/slab.h`, `linux/clkdev.h`, `linux/clk-provider.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/mod_devicetable.h`, `linux/of_address.h`, `linux/regmap.h`.
- Detected declarations: `function samsung_clk_save`, `function samsung_clk_restore`, `function samsung_clk_init`, `function samsung_clk_of_add_provider`, `function samsung_clk_add_lookup`, `function samsung_clk_register_alias`, `function samsung_clk_register_fixed_rate`, `function samsung_clk_register_fixed_factor`, `function samsung_clk_register_mux`, `function samsung_clk_register_div`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.