drivers/firmware/arm_scmi/clock.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/clock.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/clock.c- Extension
.c- Size
- 32088 bytes
- Lines
- 1278
- Domain
- Driver Families
- Bucket
- drivers/firmware
- 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.
- 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/math64.hlinux/module.hlinux/limits.hlinux/sort.hprotocols.hnotify.hquirks.h
Detected Declarations
struct scmi_msg_resp_clock_protocol_attributesstruct scmi_msg_resp_clock_attributesstruct scmi_msg_clock_possible_parentsstruct scmi_msg_resp_clock_possible_parentsstruct scmi_msg_clock_set_parentstruct scmi_msg_clock_config_setstruct scmi_msg_clock_config_set_v2struct scmi_msg_clock_config_getstruct scmi_msg_resp_clock_config_getstruct scmi_msg_clock_describe_ratesstruct scmi_msg_resp_clock_describe_ratesstruct scmi_clock_set_ratestruct scmi_msg_resp_set_rate_completestruct scmi_msg_clock_rate_notifystruct scmi_clock_rate_notify_payldstruct scmi_clock_descstruct clock_infostruct scmi_clk_iprivenum scmi_clock_protocol_cmdenum clk_statefunction scmi_clock_domain_lookupfunction scmi_clock_protocol_attributes_getfunction iter_clk_possible_parents_prepare_messagefunction iter_clk_possible_parents_update_statefunction iter_clk_possible_parents_process_responsefunction scmi_clock_possible_parentsfunction scmi_clock_get_permissionsfunction scmi_clock_attributes_getfunction rate_cmp_funcfunction iter_clk_describe_prepare_messagefunction iter_clk_describe_update_statefunction iter_clk_describe_process_responsefunction scmi_clock_describe_rates_get_fullfunction scmi_clock_describe_rates_get_lazyfunction scmi_clock_describe_rates_getfunction scmi_clock_rate_getfunction scmi_clock_rate_setfunction scmi_clock_determine_ratefunction scmi_clock_all_rates_getfunction scmi_clock_config_setfunction scmi_clock_set_parentfunction scmi_clock_get_parentfunction scmi_clock_config_set_v2function scmi_clock_enablefunction scmi_clock_disablefunction scmi_clock_config_get_v2function scmi_clock_config_getfunction scmi_clock_state_get
Annotated Snippet
struct scmi_msg_resp_clock_protocol_attributes {
__le16 num_clocks;
u8 max_async_req;
u8 reserved;
};
struct scmi_msg_resp_clock_attributes {
__le32 attributes;
#define SUPPORTS_RATE_CHANGED_NOTIF(x) ((x) & BIT(31))
#define SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(x) ((x) & BIT(30))
#define SUPPORTS_EXTENDED_NAMES(x) ((x) & BIT(29))
#define SUPPORTS_PARENT_CLOCK(x) ((x) & BIT(28))
#define SUPPORTS_EXTENDED_CONFIG(x) ((x) & BIT(27))
#define SUPPORTS_GET_PERMISSIONS(x) ((x) & BIT(1))
u8 name[SCMI_SHORT_NAME_MAX_SIZE];
__le32 clock_enable_latency;
};
struct scmi_msg_clock_possible_parents {
__le32 id;
__le32 skip_parents;
};
struct scmi_msg_resp_clock_possible_parents {
__le32 num_parent_flags;
#define NUM_PARENTS_RETURNED(x) ((x) & 0xff)
#define NUM_PARENTS_REMAINING(x) ((x) >> 24)
__le32 possible_parents[];
};
struct scmi_msg_clock_set_parent {
__le32 id;
__le32 parent_id;
};
struct scmi_msg_clock_config_set {
__le32 id;
__le32 attributes;
};
/* Valid only from SCMI clock v2.1 */
struct scmi_msg_clock_config_set_v2 {
__le32 id;
__le32 attributes;
#define NULL_OEM_TYPE 0
#define REGMASK_OEM_TYPE_SET GENMASK(23, 16)
#define REGMASK_CLK_STATE GENMASK(1, 0)
__le32 oem_config_val;
};
struct scmi_msg_clock_config_get {
__le32 id;
__le32 flags;
#define REGMASK_OEM_TYPE_GET GENMASK(7, 0)
};
struct scmi_msg_resp_clock_config_get {
__le32 attributes;
__le32 config;
#define IS_CLK_ENABLED(x) le32_get_bits((x), BIT(0))
__le32 oem_config_val;
};
struct scmi_msg_clock_describe_rates {
__le32 id;
__le32 rate_index;
};
struct scmi_msg_resp_clock_describe_rates {
__le32 num_rates_flags;
#define NUM_RETURNED(x) ((x) & 0xfff)
#define RATE_DISCRETE(x) !((x) & BIT(12))
#define NUM_REMAINING(x) ((x) >> 16)
struct {
__le32 value_low;
__le32 value_high;
} rate[];
#define RATE_TO_U64(X) \
({ \
typeof(X) x = (X); \
le32_to_cpu((x).value_low) | (u64)le32_to_cpu((x).value_high) << 32; \
})
};
struct scmi_clock_set_rate {
__le32 flags;
#define CLOCK_SET_ASYNC BIT(0)
#define CLOCK_SET_IGNORE_RESP BIT(1)
#define CLOCK_SET_ROUND_UP BIT(2)
#define CLOCK_SET_ROUND_AUTO BIT(3)
Annotation
- Immediate include surface: `linux/math64.h`, `linux/module.h`, `linux/limits.h`, `linux/sort.h`, `protocols.h`, `notify.h`, `quirks.h`.
- Detected declarations: `struct scmi_msg_resp_clock_protocol_attributes`, `struct scmi_msg_resp_clock_attributes`, `struct scmi_msg_clock_possible_parents`, `struct scmi_msg_resp_clock_possible_parents`, `struct scmi_msg_clock_set_parent`, `struct scmi_msg_clock_config_set`, `struct scmi_msg_clock_config_set_v2`, `struct scmi_msg_clock_config_get`, `struct scmi_msg_resp_clock_config_get`, `struct scmi_msg_clock_describe_rates`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: source 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.