drivers/clk/eswin/clk.c
Source file repositories/reference/linux-study-clean/drivers/clk/eswin/clk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/eswin/clk.c- Extension
.c- Size
- 14882 bytes
- Lines
- 587
- 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.
- 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/bitfield.hlinux/clk-provider.hlinux/iopoll.hlinux/math.hlinux/platform_device.hlinux/slab.hcommon.h
Detected Declarations
function eswin_calc_pllfunction clk_pll_set_ratefunction clk_pll_recalc_ratefunction clk_pll_determine_ratefunction eswin_clk_register_fixed_ratefunction eswin_clk_register_pllfunction eswin_clk_register_fixed_factorfunction eswin_clk_register_muxfunction _eswin_get_valfunction eswin_div_get_valfunction clk_div_set_ratefunction clk_div_recalc_ratefunction eswin_clk_bestdivfunction clk_div_determine_ratefunction eswin_clk_register_dividerfunction eswin_clk_register_gatefunction eswin_clk_register_clksexport eswin_clk_initexport eswin_clk_register_fixed_rateexport eswin_clk_register_pllexport eswin_clk_register_fixed_factorexport eswin_clk_register_muxexport eswin_register_clkdivexport eswin_clk_register_dividerexport eswin_clk_register_gateexport eswin_clk_register_clks
Annotated Snippet
switch (info->type) {
case CLK_FIXED_FACTOR: {
const struct eswin_fixed_factor_clock *factor;
factor = &info->data.factor;
phw = data->clk_data.hws[info->pid];
hw = devm_clk_hw_register_fixed_factor_parent_hw(dev, factor->name, phw,
factor->flags,
factor->mult,
factor->div);
break;
}
case CLK_MUX: {
const struct eswin_mux_clock *mux = &info->data.mux;
hw = devm_clk_hw_register_mux_parent_data_table(dev, mux->name,
mux->parent_data,
mux->num_parents,
mux->flags,
data->base + mux->reg,
mux->shift, mux->width,
mux->mux_flags,
mux->table, &data->lock);
break;
}
case CLK_DIVIDER: {
const struct eswin_divider_clock *div = &info->data.div;
phw = data->clk_data.hws[info->pid];
if (div->priv_flag)
hw = eswin_register_clkdiv(dev, div->id, div->name, phw,
div->flags, data->base + div->reg,
div->shift, div->width, div->div_flags,
div->priv_flag, &data->lock);
else
hw = devm_clk_hw_register_divider_parent_hw(dev, div->name, phw,
div->flags,
data->base + div->reg,
div->shift, div->width,
div->div_flags,
&data->lock);
break;
}
case CLK_GATE: {
const struct eswin_gate_clock *gate = &info->data.gate;
phw = data->clk_data.hws[info->pid];
hw = devm_clk_hw_register_gate_parent_hw(dev, gate->name, phw,
gate->flags,
data->base + gate->reg,
gate->bit_idx, gate->gate_flags,
&data->lock);
break;
}
default:
dev_err(dev, "Unidentifiable clock type!\n");
return -EINVAL;
}
if (IS_ERR(hw))
return PTR_ERR(hw);
info->hw = *hw;
data->clk_data.hws[info->id] = hw;
}
return 0;
}
EXPORT_SYMBOL_GPL(eswin_clk_register_clks);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk-provider.h`, `linux/iopoll.h`, `linux/math.h`, `linux/platform_device.h`, `linux/slab.h`, `common.h`.
- Detected declarations: `function eswin_calc_pll`, `function clk_pll_set_rate`, `function clk_pll_recalc_rate`, `function clk_pll_determine_rate`, `function eswin_clk_register_fixed_rate`, `function eswin_clk_register_pll`, `function eswin_clk_register_fixed_factor`, `function eswin_clk_register_mux`, `function _eswin_get_val`, `function eswin_div_get_val`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: integration 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.