drivers/clk/samsung/clk-acpm.c
Source file repositories/reference/linux-study-clean/drivers/clk/samsung/clk-acpm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/samsung/clk-acpm.c- Extension
.c- Size
- 4350 bytes
- Lines
- 186
- 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/array_size.hlinux/clk-provider.hlinux/container_of.hlinux/device/devres.hlinux/device.hlinux/err.hlinux/firmware/samsung/exynos-acpm-protocol.hlinux/module.hlinux/platform_device.hlinux/types.h
Detected Declarations
struct acpm_clkstruct acpm_clk_variantstruct acpm_clk_driver_datafunction acpm_clk_recalc_ratefunction acpm_clk_determine_ratefunction acpm_clk_set_ratefunction acpm_clk_registerfunction acpm_clk_probe
Annotated Snippet
struct acpm_clk {
u32 id;
struct clk_hw hw;
unsigned int mbox_chan_id;
struct acpm_handle *handle;
};
struct acpm_clk_variant {
const char *name;
};
struct acpm_clk_driver_data {
const struct acpm_clk_variant *clks;
unsigned int nr_clks;
unsigned int mbox_chan_id;
};
#define to_acpm_clk(clk) container_of(clk, struct acpm_clk, hw)
#define ACPM_CLK(cname) \
{ \
.name = cname, \
}
static const struct acpm_clk_variant gs101_acpm_clks[] = {
ACPM_CLK("mif"),
ACPM_CLK("int"),
ACPM_CLK("cpucl0"),
ACPM_CLK("cpucl1"),
ACPM_CLK("cpucl2"),
ACPM_CLK("g3d"),
ACPM_CLK("g3dl2"),
ACPM_CLK("tpu"),
ACPM_CLK("intcam"),
ACPM_CLK("tnr"),
ACPM_CLK("cam"),
ACPM_CLK("mfc"),
ACPM_CLK("disp"),
ACPM_CLK("bo"),
};
static const struct acpm_clk_driver_data acpm_clk_gs101 = {
.clks = gs101_acpm_clks,
.nr_clks = ARRAY_SIZE(gs101_acpm_clks),
.mbox_chan_id = 0,
};
static unsigned long acpm_clk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct acpm_clk *clk = to_acpm_clk(hw);
return clk->handle->ops->dvfs.get_rate(clk->handle, clk->mbox_chan_id,
clk->id);
}
static int acpm_clk_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
/*
* We can't figure out what rate it will be, so just return the
* rate back to the caller. acpm_clk_recalc_rate() will be called
* after the rate is set and we'll know what rate the clock is
* running at then.
*/
return 0;
}
static int acpm_clk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct acpm_clk *clk = to_acpm_clk(hw);
return clk->handle->ops->dvfs.set_rate(clk->handle, clk->mbox_chan_id,
clk->id, rate);
}
static const struct clk_ops acpm_clk_ops = {
.recalc_rate = acpm_clk_recalc_rate,
.determine_rate = acpm_clk_determine_rate,
.set_rate = acpm_clk_set_rate,
};
static int acpm_clk_register(struct device *dev, struct acpm_clk *aclk,
const char *name)
{
struct clk_init_data init = {};
init.name = name;
init.ops = &acpm_clk_ops;
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/clk-provider.h`, `linux/container_of.h`, `linux/device/devres.h`, `linux/device.h`, `linux/err.h`, `linux/firmware/samsung/exynos-acpm-protocol.h`, `linux/module.h`.
- Detected declarations: `struct acpm_clk`, `struct acpm_clk_variant`, `struct acpm_clk_driver_data`, `function acpm_clk_recalc_rate`, `function acpm_clk_determine_rate`, `function acpm_clk_set_rate`, `function acpm_clk_register`, `function acpm_clk_probe`.
- 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.