drivers/firmware/arm_scmi/power.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/power.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/power.c- Extension
.c- Size
- 8930 bytes
- Lines
- 367
- 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.
- 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/module.hlinux/scmi_protocol.hprotocols.hnotify.h
Detected Declarations
struct scmi_msg_resp_power_attributesstruct scmi_msg_resp_power_domain_attributesstruct scmi_power_set_statestruct scmi_power_state_notifystruct scmi_power_state_notify_payldstruct power_dom_infostruct scmi_power_infoenum scmi_power_protocol_cmdfunction scmi_power_attributes_getfunction scmi_power_domain_attributes_getfunction SUPPORTS_EXTENDED_NAMESfunction scmi_power_state_setfunction scmi_power_state_getfunction scmi_power_num_domains_getfunction scmi_power_name_getfunction scmi_power_request_notifyfunction scmi_power_notify_supportedfunction scmi_power_set_notify_enabledfunction scmi_power_fill_custom_reportfunction scmi_power_get_num_sourcesfunction scmi_power_protocol_init
Annotated Snippet
struct scmi_msg_resp_power_attributes {
__le16 num_domains;
__le16 reserved;
__le32 stats_addr_low;
__le32 stats_addr_high;
__le32 stats_size;
};
struct scmi_msg_resp_power_domain_attributes {
__le32 flags;
#define SUPPORTS_STATE_SET_NOTIFY(x) ((x) & BIT(31))
#define SUPPORTS_STATE_SET_ASYNC(x) ((x) & BIT(30))
#define SUPPORTS_STATE_SET_SYNC(x) ((x) & BIT(29))
#define SUPPORTS_EXTENDED_NAMES(x) ((x) & BIT(27))
u8 name[SCMI_SHORT_NAME_MAX_SIZE];
};
struct scmi_power_set_state {
__le32 flags;
#define STATE_SET_ASYNC BIT(0)
__le32 domain;
__le32 state;
};
struct scmi_power_state_notify {
__le32 domain;
__le32 notify_enable;
};
struct scmi_power_state_notify_payld {
__le32 agent_id;
__le32 domain_id;
__le32 power_state;
};
struct power_dom_info {
bool state_set_sync;
bool state_set_async;
bool state_set_notify;
char name[SCMI_MAX_STR_SIZE];
};
struct scmi_power_info {
bool notify_state_change_cmd;
int num_domains;
u64 stats_addr;
u32 stats_size;
struct power_dom_info *dom_info;
};
static int scmi_power_attributes_get(const struct scmi_protocol_handle *ph,
struct scmi_power_info *pi)
{
int ret;
struct scmi_xfer *t;
struct scmi_msg_resp_power_attributes *attr;
ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES,
0, sizeof(*attr), &t);
if (ret)
return ret;
attr = t->rx.buf;
ret = ph->xops->do_xfer(ph, t);
if (!ret) {
pi->num_domains = le16_to_cpu(attr->num_domains);
pi->stats_addr = le32_to_cpu(attr->stats_addr_low) |
(u64)le32_to_cpu(attr->stats_addr_high) << 32;
pi->stats_size = le32_to_cpu(attr->stats_size);
}
ph->xops->xfer_put(ph, t);
if (!ret)
if (!ph->hops->protocol_msg_check(ph, POWER_STATE_NOTIFY, NULL))
pi->notify_state_change_cmd = true;
return ret;
}
static int
scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph,
u32 domain, struct power_dom_info *dom_info,
bool notify_state_change_cmd)
{
int ret;
u32 flags;
struct scmi_xfer *t;
struct scmi_msg_resp_power_domain_attributes *attr;
Annotation
- Immediate include surface: `linux/module.h`, `linux/scmi_protocol.h`, `protocols.h`, `notify.h`.
- Detected declarations: `struct scmi_msg_resp_power_attributes`, `struct scmi_msg_resp_power_domain_attributes`, `struct scmi_power_set_state`, `struct scmi_power_state_notify`, `struct scmi_power_state_notify_payld`, `struct power_dom_info`, `struct scmi_power_info`, `enum scmi_power_protocol_cmd`, `function scmi_power_attributes_get`, `function scmi_power_domain_attributes_get`.
- Atlas domain: Driver Families / drivers/firmware.
- 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.