drivers/firmware/arm_scmi/powercap.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/powercap.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/powercap.c- Extension
.c- Size
- 27637 bytes
- Lines
- 1038
- 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/bitfield.hlinux/io.hlinux/module.hlinux/scmi_protocol.htrace/events/scmi.hprotocols.hnotify.h
Detected Declarations
struct scmi_msg_resp_powercap_domain_attributesstruct scmi_msg_powercap_set_cap_or_paistruct scmi_msg_resp_powercap_cap_set_completestruct scmi_msg_resp_powercap_meas_getstruct scmi_msg_powercap_notify_capstruct scmi_msg_powercap_notify_threshstruct scmi_powercap_cap_changed_notify_payldstruct scmi_powercap_meas_changed_notify_payldstruct scmi_powercap_statestruct powercap_infoenum scmi_powercap_protocol_cmdfunction scmi_powercap_attributes_getfunction scmi_powercap_validatefunction scmi_powercap_domain_attributes_getfunction scmi_powercap_num_domains_getfunction scmi_powercap_dom_info_getfunction scmi_powercap_xfer_cap_getfunction __scmi_powercap_cap_getfunction scmi_powercap_cap_getfunction scmi_powercap_xfer_cap_setfunction __scmi_powercap_cap_setfunction scmi_powercap_cap_setfunction scmi_powercap_xfer_pai_getfunction scmi_powercap_pai_getfunction scmi_powercap_xfer_pai_setfunction scmi_powercap_pai_setfunction scmi_powercap_measurements_getfunction scmi_powercap_measurements_threshold_getfunction scmi_powercap_measurements_threshold_setfunction scmi_powercap_cap_enable_setfunction scmi_powercap_cap_enable_getfunction scmi_powercap_domain_init_fcfunction scmi_powercap_notifyfunction scmi_powercap_notify_supportedfunction scmi_powercap_set_notify_enabledfunction scmi_powercap_fill_custom_reportfunction scmi_powercap_get_num_sourcesfunction scmi_powercap_protocol_init
Annotated Snippet
struct scmi_msg_resp_powercap_domain_attributes {
__le32 attributes;
#define SUPPORTS_POWERCAP_CAP_CHANGE_NOTIFY(x) ((x) & BIT(31))
#define SUPPORTS_POWERCAP_MEASUREMENTS_CHANGE_NOTIFY(x) ((x) & BIT(30))
#define SUPPORTS_ASYNC_POWERCAP_CAP_SET(x) ((x) & BIT(29))
#define SUPPORTS_EXTENDED_NAMES(x) ((x) & BIT(28))
#define SUPPORTS_POWERCAP_CAP_CONFIGURATION(x) ((x) & BIT(27))
#define SUPPORTS_POWERCAP_MONITORING(x) ((x) & BIT(26))
#define SUPPORTS_POWERCAP_PAI_CONFIGURATION(x) ((x) & BIT(25))
#define SUPPORTS_POWERCAP_FASTCHANNELS(x) ((x) & BIT(22))
#define POWERCAP_POWER_UNIT(x) \
(FIELD_GET(GENMASK(24, 23), (x)))
#define SUPPORTS_POWER_UNITS_MW(x) \
(POWERCAP_POWER_UNIT(x) == 0x2)
#define SUPPORTS_POWER_UNITS_UW(x) \
(POWERCAP_POWER_UNIT(x) == 0x1)
u8 name[SCMI_SHORT_NAME_MAX_SIZE];
__le32 min_pai;
__le32 max_pai;
__le32 pai_step;
__le32 min_power_cap;
__le32 max_power_cap;
__le32 power_cap_step;
__le32 sustainable_power;
__le32 accuracy;
__le32 parent_id;
};
struct scmi_msg_powercap_set_cap_or_pai {
__le32 domain;
__le32 flags;
#define CAP_SET_ASYNC BIT(1)
#define CAP_SET_IGNORE_DRESP BIT(0)
__le32 value;
};
struct scmi_msg_resp_powercap_cap_set_complete {
__le32 domain;
__le32 power_cap;
};
struct scmi_msg_resp_powercap_meas_get {
__le32 power;
__le32 pai;
};
struct scmi_msg_powercap_notify_cap {
__le32 domain;
__le32 notify_enable;
};
struct scmi_msg_powercap_notify_thresh {
__le32 domain;
__le32 notify_enable;
__le32 power_thresh_low;
__le32 power_thresh_high;
};
struct scmi_powercap_cap_changed_notify_payld {
__le32 agent_id;
__le32 domain_id;
__le32 power_cap;
__le32 pai;
};
struct scmi_powercap_meas_changed_notify_payld {
__le32 agent_id;
__le32 domain_id;
__le32 power;
};
struct scmi_powercap_state {
bool enabled;
u32 last_pcap;
bool meas_notif_enabled;
u64 thresholds;
#define THRESH_LOW(p, id) \
(lower_32_bits((p)->states[(id)].thresholds))
#define THRESH_HIGH(p, id) \
(upper_32_bits((p)->states[(id)].thresholds))
};
struct powercap_info {
int num_domains;
bool notify_cap_cmd;
bool notify_measurements_cmd;
struct scmi_powercap_state *states;
struct scmi_powercap_info *powercaps;
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/io.h`, `linux/module.h`, `linux/scmi_protocol.h`, `trace/events/scmi.h`, `protocols.h`, `notify.h`.
- Detected declarations: `struct scmi_msg_resp_powercap_domain_attributes`, `struct scmi_msg_powercap_set_cap_or_pai`, `struct scmi_msg_resp_powercap_cap_set_complete`, `struct scmi_msg_resp_powercap_meas_get`, `struct scmi_msg_powercap_notify_cap`, `struct scmi_msg_powercap_notify_thresh`, `struct scmi_powercap_cap_changed_notify_payld`, `struct scmi_powercap_meas_changed_notify_payld`, `struct scmi_powercap_state`, `struct powercap_info`.
- 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.