drivers/firmware/arm_scmi/sensors.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/sensors.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/sensors.c- Extension
.c- Size
- 32015 bytes
- Lines
- 1192
- 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/module.hlinux/scmi_protocol.hprotocols.hnotify.h
Detected Declarations
struct scmi_msg_resp_sensor_attributesstruct scmi_msg_resp_attrsstruct scmi_msg_sensor_descriptionstruct scmi_msg_resp_sensor_descriptionstruct scmi_sensor_descriptorstruct scmi_msg_sensor_axis_description_getstruct scmi_msg_resp_sensor_axis_descriptionstruct scmi_axis_descriptorstruct scmi_msg_resp_sensor_axis_names_descriptionstruct scmi_sensor_axis_name_descriptorstruct scmi_msg_sensor_list_update_intervalsstruct scmi_msg_resp_sensor_list_update_intervalsstruct scmi_msg_sensor_request_notifystruct scmi_msg_set_sensor_trip_pointstruct scmi_msg_sensor_config_setstruct scmi_msg_sensor_reading_getstruct scmi_resp_sensor_reading_completestruct scmi_sensor_reading_respstruct scmi_resp_sensor_reading_complete_v3struct scmi_sensor_trip_notify_payldstruct scmi_sensor_update_notify_payldstruct sensors_infostruct scmi_sens_iprivstruct scmi_aprivenum scmi_sensor_protocol_cmdfunction scmi_sensor_attributes_getfunction scmi_parse_range_attrsfunction iter_intervals_prepare_messagefunction iter_intervals_update_statefunction iter_intervals_process_responsefunction scmi_sensor_update_intervalsfunction iter_axes_desc_prepare_messagefunction iter_axes_desc_update_statefunction iter_axes_desc_process_responsefunction iter_axes_extended_name_update_statefunction iter_axes_extended_name_process_responsefunction scmi_sensor_axis_extended_names_getfunction scmi_sensor_axis_descriptionfunction iter_sens_descr_prepare_messagefunction iter_sens_descr_update_statefunction iter_sens_descr_process_responsefunction scmi_sensor_description_getfunction scmi_sensor_request_notifyfunction scmi_sensor_trip_point_notifyfunction scmi_sensor_continuous_update_notifyfunction scmi_sensor_trip_point_configfunction scmi_sensor_config_getfunction scmi_sensor_config_set
Annotated Snippet
struct scmi_msg_resp_sensor_attributes {
__le16 num_sensors;
u8 max_requests;
u8 reserved;
__le32 reg_addr_low;
__le32 reg_addr_high;
__le32 reg_size;
};
/* v3 attributes_low macros */
#define SUPPORTS_UPDATE_NOTIFY(x) FIELD_GET(BIT(30), (x))
#define SENSOR_TSTAMP_EXP(x) FIELD_GET(GENMASK(14, 10), (x))
#define SUPPORTS_TIMESTAMP(x) FIELD_GET(BIT(9), (x))
#define SUPPORTS_EXTEND_ATTRS(x) FIELD_GET(BIT(8), (x))
/* v2 attributes_high macros */
#define SENSOR_UPDATE_BASE(x) FIELD_GET(GENMASK(31, 27), (x))
#define SENSOR_UPDATE_SCALE(x) FIELD_GET(GENMASK(26, 22), (x))
/* v3 attributes_high macros */
#define SENSOR_AXIS_NUMBER(x) FIELD_GET(GENMASK(21, 16), (x))
#define SUPPORTS_AXIS(x) FIELD_GET(BIT(8), (x))
/* v3 resolution macros */
#define SENSOR_RES(x) FIELD_GET(GENMASK(26, 0), (x))
#define SENSOR_RES_EXP(x) FIELD_GET(GENMASK(31, 27), (x))
struct scmi_msg_resp_attrs {
__le32 min_range_low;
__le32 min_range_high;
__le32 max_range_low;
__le32 max_range_high;
};
struct scmi_msg_sensor_description {
__le32 desc_index;
};
struct scmi_msg_resp_sensor_description {
__le16 num_returned;
__le16 num_remaining;
struct scmi_sensor_descriptor {
__le32 id;
__le32 attributes_low;
/* Common attributes_low macros */
#define SUPPORTS_ASYNC_READ(x) FIELD_GET(BIT(31), (x))
#define SUPPORTS_EXTENDED_NAMES(x) FIELD_GET(BIT(29), (x))
#define NUM_TRIP_POINTS(x) FIELD_GET(GENMASK(7, 0), (x))
__le32 attributes_high;
/* Common attributes_high macros */
#define SENSOR_SCALE(x) FIELD_GET(GENMASK(15, 11), (x))
#define SENSOR_SCALE_SIGN BIT(4)
#define SENSOR_SCALE_EXTEND GENMASK(31, 5)
#define SENSOR_TYPE(x) FIELD_GET(GENMASK(7, 0), (x))
u8 name[SCMI_SHORT_NAME_MAX_SIZE];
/* only for version > 2.0 */
__le32 power;
__le32 resolution;
struct scmi_msg_resp_attrs scalar_attrs;
} desc[];
};
/* Base scmi_sensor_descriptor size excluding extended attrs after name */
#define SCMI_MSG_RESP_SENS_DESCR_BASE_SZ 28
/* Sign extend to a full s32 */
#define S32_EXT(v) \
({ \
int __v = (v); \
\
if (__v & SENSOR_SCALE_SIGN) \
__v |= SENSOR_SCALE_EXTEND; \
__v; \
})
struct scmi_msg_sensor_axis_description_get {
__le32 id;
__le32 axis_desc_index;
};
struct scmi_msg_resp_sensor_axis_description {
__le32 num_axis_flags;
#define NUM_AXIS_RETURNED(x) FIELD_GET(GENMASK(5, 0), (x))
#define NUM_AXIS_REMAINING(x) FIELD_GET(GENMASK(31, 26), (x))
struct scmi_axis_descriptor {
__le32 id;
__le32 attributes_low;
#define SUPPORTS_EXTENDED_AXIS_NAMES(x) FIELD_GET(BIT(9), (x))
__le32 attributes_high;
u8 name[SCMI_SHORT_NAME_MAX_SIZE];
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/module.h`, `linux/scmi_protocol.h`, `protocols.h`, `notify.h`.
- Detected declarations: `struct scmi_msg_resp_sensor_attributes`, `struct scmi_msg_resp_attrs`, `struct scmi_msg_sensor_description`, `struct scmi_msg_resp_sensor_description`, `struct scmi_sensor_descriptor`, `struct scmi_msg_sensor_axis_description_get`, `struct scmi_msg_resp_sensor_axis_description`, `struct scmi_axis_descriptor`, `struct scmi_msg_resp_sensor_axis_names_description`, `struct scmi_sensor_axis_name_descriptor`.
- 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.