drivers/clk/mediatek/clk-pllfh.c
Source file repositories/reference/linux-study-clean/drivers/clk/mediatek/clk-pllfh.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/mediatek/clk-pllfh.c- Extension
.c- Size
- 6793 bytes
- Lines
- 302
- 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/of.hlinux/of_address.hlinux/io.hlinux/slab.hlinux/clkdev.hlinux/delay.hlinux/device.hclk-mtk.hclk-pllfh.hclk-fhctl.h
Detected Declarations
function mtk_fhctl_set_ratefunction fhctl_parse_dtfunction pllfh_initfunction fhctl_is_supported_and_enabledfunction mtk_clk_register_pllfhfunction mtk_clk_unregister_pllfhfunction mtk_clk_register_pllfhsfunction mtk_clk_unregister_pllfhsexport fhctl_parse_dtexport mtk_clk_register_pllfhsexport mtk_clk_unregister_pllfhs
Annotated Snippet
if (IS_ERR(hw)) {
pr_err("Failed to register %s clk %s: %ld\n",
use_fhctl ? "fhpll" : "pll", pll->name,
PTR_ERR(hw));
goto err;
}
clk_data->hws[pll->id] = hw;
}
return 0;
err:
while (--i >= 0) {
const struct mtk_pll_data *pll = &plls[i];
struct mtk_pllfh_data *pllfh;
bool use_fhctl;
pllfh = get_pllfh_by_id(pllfhs, num_fhs, pll->id);
use_fhctl = fhctl_is_supported_and_enabled(pllfh);
if (use_fhctl)
mtk_clk_unregister_pllfh(clk_data->hws[pll->id]);
else
mtk_clk_unregister_pll(clk_data->hws[pll->id]);
clk_data->hws[pll->id] = ERR_PTR(-ENOENT);
}
iounmap(base);
return PTR_ERR(hw);
}
EXPORT_SYMBOL_GPL(mtk_clk_register_pllfhs);
void mtk_clk_unregister_pllfhs(const struct mtk_pll_data *plls, int num_plls,
struct mtk_pllfh_data *pllfhs, int num_fhs,
struct clk_hw_onecell_data *clk_data)
{
void __iomem *base = NULL, *fhctl_base = NULL;
int i;
if (!clk_data)
return;
for (i = num_plls; i > 0; i--) {
const struct mtk_pll_data *pll = &plls[i - 1];
struct mtk_pllfh_data *pllfh;
bool use_fhctl;
if (IS_ERR_OR_NULL(clk_data->hws[pll->id]))
continue;
pllfh = get_pllfh_by_id(pllfhs, num_fhs, pll->id);
use_fhctl = fhctl_is_supported_and_enabled(pllfh);
if (use_fhctl) {
fhctl_base = pllfh->state.base;
mtk_clk_unregister_pllfh(clk_data->hws[pll->id]);
} else {
base = mtk_clk_pll_get_base(clk_data->hws[pll->id],
pll);
mtk_clk_unregister_pll(clk_data->hws[pll->id]);
}
clk_data->hws[pll->id] = ERR_PTR(-ENOENT);
}
if (fhctl_base)
iounmap(fhctl_base);
iounmap(base);
}
EXPORT_SYMBOL_GPL(mtk_clk_unregister_pllfhs);
Annotation
- Immediate include surface: `linux/of.h`, `linux/of_address.h`, `linux/io.h`, `linux/slab.h`, `linux/clkdev.h`, `linux/delay.h`, `linux/device.h`, `clk-mtk.h`.
- Detected declarations: `function mtk_fhctl_set_rate`, `function fhctl_parse_dt`, `function pllfh_init`, `function fhctl_is_supported_and_enabled`, `function mtk_clk_register_pllfh`, `function mtk_clk_unregister_pllfh`, `function mtk_clk_register_pllfhs`, `function mtk_clk_unregister_pllfhs`, `export fhctl_parse_dt`, `export mtk_clk_register_pllfhs`.
- 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.