drivers/clk/ux500/clk-prcmu.c
Source file repositories/reference/linux-study-clean/drivers/clk/ux500/clk-prcmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ux500/clk-prcmu.c- Extension
.c- Size
- 9976 bytes
- Lines
- 404
- 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.
- 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/mfd/dbx500-prcmu.hlinux/slab.hlinux/io.hlinux/err.hclk.h
Detected Declarations
struct clk_prcmustruct clk_prcmu_clkoutfunction clk_prcmu_preparefunction clk_prcmu_unpreparefunction clk_prcmu_recalc_ratefunction clk_prcmu_determine_ratefunction clk_prcmu_set_ratefunction clk_prcmu_opp_preparefunction clk_prcmu_opp_unpreparefunction clk_prcmu_opp_volt_preparefunction clk_prcmu_opp_volt_unpreparefunction clk_prcmu_clkout_preparefunction clk_prcmu_clkout_unpreparefunction clk_prcmu_clkout_recalc_ratefunction clk_prcmu_clkout_get_parentfunction clk_prcmu_clkout_set_parent
Annotated Snippet
struct clk_prcmu {
struct clk_hw hw;
u8 cg_sel;
int opp_requested;
};
struct clk_prcmu_clkout {
struct clk_hw hw;
u8 clkout_id;
u8 source;
u8 divider;
};
/* PRCMU clock operations. */
static int clk_prcmu_prepare(struct clk_hw *hw)
{
struct clk_prcmu *clk = to_clk_prcmu(hw);
return prcmu_request_clock(clk->cg_sel, true);
}
static void clk_prcmu_unprepare(struct clk_hw *hw)
{
struct clk_prcmu *clk = to_clk_prcmu(hw);
if (prcmu_request_clock(clk->cg_sel, false))
pr_err("clk_prcmu: %s failed to disable %s.\n", __func__,
clk_hw_get_name(hw));
}
static unsigned long clk_prcmu_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_prcmu *clk = to_clk_prcmu(hw);
return prcmu_clock_rate(clk->cg_sel);
}
static int clk_prcmu_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_prcmu *clk = to_clk_prcmu(hw);
req->rate = prcmu_round_clock_rate(clk->cg_sel, req->rate);
return 0;
}
static int clk_prcmu_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_prcmu *clk = to_clk_prcmu(hw);
return prcmu_set_clock_rate(clk->cg_sel, rate);
}
static int clk_prcmu_opp_prepare(struct clk_hw *hw)
{
int err;
struct clk_prcmu *clk = to_clk_prcmu(hw);
if (!clk->opp_requested) {
err = prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP,
(char *)clk_hw_get_name(hw),
100);
if (err) {
pr_err("clk_prcmu: %s fail req APE OPP for %s.\n",
__func__, clk_hw_get_name(hw));
return err;
}
clk->opp_requested = 1;
}
err = prcmu_request_clock(clk->cg_sel, true);
if (err) {
prcmu_qos_remove_requirement(PRCMU_QOS_APE_OPP,
(char *)clk_hw_get_name(hw));
clk->opp_requested = 0;
return err;
}
return 0;
}
static void clk_prcmu_opp_unprepare(struct clk_hw *hw)
{
struct clk_prcmu *clk = to_clk_prcmu(hw);
if (prcmu_request_clock(clk->cg_sel, false)) {
pr_err("clk_prcmu: %s failed to disable %s.\n", __func__,
clk_hw_get_name(hw));
return;
}
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/mfd/dbx500-prcmu.h`, `linux/slab.h`, `linux/io.h`, `linux/err.h`, `clk.h`.
- Detected declarations: `struct clk_prcmu`, `struct clk_prcmu_clkout`, `function clk_prcmu_prepare`, `function clk_prcmu_unprepare`, `function clk_prcmu_recalc_rate`, `function clk_prcmu_determine_rate`, `function clk_prcmu_set_rate`, `function clk_prcmu_opp_prepare`, `function clk_prcmu_opp_unprepare`, `function clk_prcmu_opp_volt_prepare`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source 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.