drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c- Extension
.c- Size
- 9079 bytes
- Lines
- 379
- 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/bits.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/scmi_protocol.hlinux/scmi_imx_protocol.h../../protocols.h../../notify.h
Detected Declarations
struct scmi_imx_bbm_infostruct scmi_msg_imx_bbm_protocol_attributesstruct scmi_imx_bbm_set_timestruct scmi_imx_bbm_get_timestruct scmi_imx_bbm_alarm_timestruct scmi_msg_imx_bbm_rtc_notifystruct scmi_msg_imx_bbm_button_notifystruct scmi_imx_bbm_notify_payldenum scmi_imx_bbm_protocol_cmdfunction scmi_imx_bbm_attributes_getfunction scmi_imx_bbm_notifyfunction scmi_imx_bbm_set_notify_enabledfunction scmi_imx_bbm_rtc_time_setfunction scmi_imx_bbm_rtc_time_getfunction scmi_imx_bbm_rtc_alarm_setfunction scmi_imx_bbm_button_getfunction scmi_imx_bbm_protocol_init
Annotated Snippet
struct scmi_imx_bbm_info {
int nr_rtc;
int nr_gpr;
};
struct scmi_msg_imx_bbm_protocol_attributes {
__le32 attributes;
};
struct scmi_imx_bbm_set_time {
__le32 id;
__le32 flags;
__le32 value_low;
__le32 value_high;
};
struct scmi_imx_bbm_get_time {
__le32 id;
__le32 flags;
};
struct scmi_imx_bbm_alarm_time {
__le32 id;
__le32 flags;
__le32 value_low;
__le32 value_high;
};
struct scmi_msg_imx_bbm_rtc_notify {
__le32 rtc_id;
__le32 flags;
};
struct scmi_msg_imx_bbm_button_notify {
__le32 flags;
};
struct scmi_imx_bbm_notify_payld {
__le32 flags;
};
static int scmi_imx_bbm_attributes_get(const struct scmi_protocol_handle *ph,
struct scmi_imx_bbm_info *pi)
{
int ret;
struct scmi_xfer *t;
struct scmi_msg_imx_bbm_protocol_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->nr_rtc = GET_RTCS_NR(attr->attributes);
pi->nr_gpr = GET_GPRS_NR(attr->attributes);
}
ph->xops->xfer_put(ph, t);
return ret;
}
static int scmi_imx_bbm_notify(const struct scmi_protocol_handle *ph,
u32 src_id, int message_id, bool enable)
{
int ret;
struct scmi_xfer *t;
if (message_id == IMX_BBM_RTC_NOTIFY) {
struct scmi_msg_imx_bbm_rtc_notify *rtc_notify;
ret = ph->xops->xfer_get_init(ph, message_id,
sizeof(*rtc_notify), 0, &t);
if (ret)
return ret;
rtc_notify = t->tx.buf;
rtc_notify->rtc_id = cpu_to_le32(0);
rtc_notify->flags =
cpu_to_le32(enable ? SCMI_IMX_BBM_NOTIFY_RTC_FLAG : 0);
} else if (message_id == IMX_BBM_BUTTON_NOTIFY) {
struct scmi_msg_imx_bbm_button_notify *button_notify;
ret = ph->xops->xfer_get_init(ph, message_id,
sizeof(*button_notify), 0, &t);
if (ret)
return ret;
Annotation
- Immediate include surface: `linux/bits.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/scmi_protocol.h`, `linux/scmi_imx_protocol.h`, `../../protocols.h`.
- Detected declarations: `struct scmi_imx_bbm_info`, `struct scmi_msg_imx_bbm_protocol_attributes`, `struct scmi_imx_bbm_set_time`, `struct scmi_imx_bbm_get_time`, `struct scmi_imx_bbm_alarm_time`, `struct scmi_msg_imx_bbm_rtc_notify`, `struct scmi_msg_imx_bbm_button_notify`, `struct scmi_imx_bbm_notify_payld`, `enum scmi_imx_bbm_protocol_cmd`, `function scmi_imx_bbm_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.