drivers/clk/visconti/clkc.c
Source file repositories/reference/linux-study-clean/drivers/clk/visconti/clkc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/visconti/clkc.c- Extension
.c- Size
- 5018 bytes
- Lines
- 207
- 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/clk-provider.hlinux/delay.hlinux/device.hlinux/io.hlinux/of.hlinux/of_address.hlinux/regmap.hlinux/slab.hlinux/string.hclkc.h
Detected Declarations
function Copyrightfunction visconti_gate_clk_is_enabledfunction visconti_gate_clk_disablefunction visconti_gate_clk_enablefunction visconti_clk_register_gates
Annotated Snippet
if (clks[i].rs_id != NO_RESET) {
rson_offset = reset[clks[i].rs_id].rson_offset;
rsoff_offset = reset[clks[i].rs_id].rsoff_offset;
rs_idx = reset[clks[i].rs_id].rs_idx;
} else {
rson_offset = rsoff_offset = rs_idx = -1;
}
div_clk = devm_clk_hw_register_fixed_factor(dev,
dev_name,
parent_div_name,
0, 1,
clks[i].div);
if (IS_ERR(div_clk))
return PTR_ERR(div_clk);
gate_clk = visconti_clk_register_gate(dev,
clks[i].name,
dev_name,
ctx->regmap,
&clks[i],
rson_offset,
rsoff_offset,
rs_idx,
lock);
if (IS_ERR(gate_clk)) {
dev_err(dev, "%s: failed to register clock %s\n",
__func__, clks[i].name);
return PTR_ERR(gate_clk);
}
ctx->clk_data.hws[clks[i].id] = gate_clk;
}
return 0;
}
struct visconti_clk_provider *visconti_init_clk(struct device *dev,
struct regmap *regmap,
unsigned long nr_clks)
{
struct visconti_clk_provider *ctx;
int i;
ctx = devm_kzalloc(dev, struct_size(ctx, clk_data.hws, nr_clks), GFP_KERNEL);
if (!ctx)
return ERR_PTR(-ENOMEM);
for (i = 0; i < nr_clks; ++i)
ctx->clk_data.hws[i] = ERR_PTR(-ENOENT);
ctx->clk_data.num = nr_clks;
ctx->dev = dev;
ctx->regmap = regmap;
return ctx;
}
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/delay.h`, `linux/device.h`, `linux/io.h`, `linux/of.h`, `linux/of_address.h`, `linux/regmap.h`, `linux/slab.h`.
- Detected declarations: `function Copyright`, `function visconti_gate_clk_is_enabled`, `function visconti_gate_clk_disable`, `function visconti_gate_clk_enable`, `function visconti_clk_register_gates`.
- 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.