drivers/clk/clk-rpmi.c
Source file repositories/reference/linux-study-clean/drivers/clk/clk-rpmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/clk-rpmi.c- Extension
.c- Size
- 15806 bytes
- Lines
- 621
- 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/err.hlinux/mailbox_client.hlinux/mailbox/riscv-rpmi-message.hlinux/module.hlinux/platform_device.hlinux/types.hlinux/slab.hlinux/wordpart.h
Detected Declarations
struct rpmi_clk_contextstruct rpmi_clkstruct rpmi_clk_rate_discretestruct rpmi_clk_rate_linearstruct rpmi_get_num_clocks_rxstruct rpmi_get_attrs_txstruct rpmi_get_attrs_rxstruct rpmi_get_supp_rates_txstruct rpmi_get_supp_rates_rxstruct rpmi_get_rate_txstruct rpmi_get_rate_rxstruct rpmi_set_rate_txstruct rpmi_set_rate_rxstruct rpmi_set_config_txstruct rpmi_set_config_rxenum rpmi_clk_configenum rpmi_clk_typefunction rpmi_clkrate_u64function rpmi_clk_get_num_clocksfunction rpmi_clk_get_attrsfunction rpmi_clk_get_supported_ratesfunction rpmi_clk_recalc_ratefunction rpmi_clk_determine_ratefunction rpmi_clk_set_ratefunction rpmi_clk_enablefunction rpmi_clk_disablefunction rpmi_clk_mbox_chan_releasefunction rpmi_clk_probe
Annotated Snippet
struct rpmi_clk_context {
struct device *dev;
struct mbox_chan *chan;
struct mbox_client client;
u32 max_msg_data_size;
};
/*
* rpmi_clk_rates represents the rates format
* as specified by the RPMI specification.
* No other data format (e.g., struct linear_range)
* is required to avoid to and from conversion.
*/
union rpmi_clk_rates {
u64 discrete[RPMI_CLK_DISCRETE_MAX_NUM_RATES];
struct {
u64 min;
u64 max;
u64 step;
} linear;
};
struct rpmi_clk {
struct rpmi_clk_context *context;
u32 id;
u32 num_rates;
u32 transition_latency;
enum rpmi_clk_type type;
union rpmi_clk_rates *rates;
char name[RPMI_CLK_NAME_LEN];
struct clk_hw hw;
};
struct rpmi_clk_rate_discrete {
__le32 lo;
__le32 hi;
};
struct rpmi_clk_rate_linear {
__le32 min_lo;
__le32 min_hi;
__le32 max_lo;
__le32 max_hi;
__le32 step_lo;
__le32 step_hi;
};
struct rpmi_get_num_clocks_rx {
__le32 status;
__le32 num_clocks;
};
struct rpmi_get_attrs_tx {
__le32 clkid;
};
struct rpmi_get_attrs_rx {
__le32 status;
__le32 flags;
__le32 num_rates;
__le32 transition_latency;
char name[RPMI_CLK_NAME_LEN];
};
struct rpmi_get_supp_rates_tx {
__le32 clkid;
__le32 clk_rate_idx;
};
struct rpmi_get_supp_rates_rx {
__le32 status;
__le32 flags;
__le32 remaining;
__le32 returned;
__le32 rates[];
};
struct rpmi_get_rate_tx {
__le32 clkid;
};
struct rpmi_get_rate_rx {
__le32 status;
__le32 lo;
__le32 hi;
};
struct rpmi_set_rate_tx {
__le32 clkid;
__le32 flags;
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/err.h`, `linux/mailbox_client.h`, `linux/mailbox/riscv-rpmi-message.h`, `linux/module.h`, `linux/platform_device.h`, `linux/types.h`, `linux/slab.h`.
- Detected declarations: `struct rpmi_clk_context`, `struct rpmi_clk`, `struct rpmi_clk_rate_discrete`, `struct rpmi_clk_rate_linear`, `struct rpmi_get_num_clocks_rx`, `struct rpmi_get_attrs_tx`, `struct rpmi_get_attrs_rx`, `struct rpmi_get_supp_rates_tx`, `struct rpmi_get_supp_rates_rx`, `struct rpmi_get_rate_tx`.
- 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.