drivers/mailbox/qcom-apcs-ipc-mailbox.c
Source file repositories/reference/linux-study-clean/drivers/mailbox/qcom-apcs-ipc-mailbox.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mailbox/qcom-apcs-ipc-mailbox.c- Extension
.c- Size
- 6183 bytes
- Lines
- 199
- Domain
- Driver Families
- Bucket
- drivers/mailbox
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/module.hlinux/io.hlinux/slab.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/regmap.hlinux/mailbox_controller.h
Detected Declarations
struct qcom_apcs_ipcstruct qcom_apcs_ipc_datafunction qcom_apcs_ipc_send_datafunction qcom_apcs_ipc_probefunction qcom_apcs_ipc_removefunction qcom_apcs_ipc_initfunction qcom_apcs_ipc_exit
Annotated Snippet
struct qcom_apcs_ipc {
struct mbox_controller mbox;
struct mbox_chan mbox_chans[QCOM_APCS_IPC_BITS];
struct regmap *regmap;
unsigned long offset;
struct platform_device *clk;
};
struct qcom_apcs_ipc_data {
int offset;
char *clk_name;
};
static const struct qcom_apcs_ipc_data ipq6018_apcs_data = {
.offset = 8, .clk_name = "qcom,apss-ipq6018-clk"
};
static const struct qcom_apcs_ipc_data msm8916_apcs_data = {
.offset = 8, .clk_name = "qcom-apcs-msm8916-clk"
};
static const struct qcom_apcs_ipc_data msm8994_apcs_data = {
.offset = 8, .clk_name = NULL
};
static const struct qcom_apcs_ipc_data msm8996_apcs_data = {
.offset = 16, .clk_name = "qcom-apcs-msm8996-clk"
};
static const struct qcom_apcs_ipc_data apps_shared_apcs_data = {
.offset = 12, .clk_name = NULL
};
static const struct qcom_apcs_ipc_data sdx55_apcs_data = {
.offset = 0x1008, .clk_name = "qcom-sdx55-acps-clk"
};
static const struct regmap_config apcs_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.max_register = 0x1008,
};
static int qcom_apcs_ipc_send_data(struct mbox_chan *chan, void *data)
{
struct qcom_apcs_ipc *apcs = container_of(chan->mbox,
struct qcom_apcs_ipc, mbox);
unsigned long idx = (unsigned long)chan->con_priv;
return regmap_write(apcs->regmap, apcs->offset, BIT(idx));
}
static const struct mbox_chan_ops qcom_apcs_ipc_ops = {
.send_data = qcom_apcs_ipc_send_data,
};
static int qcom_apcs_ipc_probe(struct platform_device *pdev)
{
struct qcom_apcs_ipc *apcs;
const struct qcom_apcs_ipc_data *apcs_data;
struct regmap *regmap;
void __iomem *base;
unsigned long i;
int ret;
apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL);
if (!apcs)
return -ENOMEM;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
regmap = devm_regmap_init_mmio(&pdev->dev, base, &apcs_regmap_config);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
apcs_data = of_device_get_match_data(&pdev->dev);
apcs->regmap = regmap;
apcs->offset = apcs_data->offset;
/* Initialize channel identifiers */
for (i = 0; i < ARRAY_SIZE(apcs->mbox_chans); i++)
apcs->mbox_chans[i].con_priv = (void *)i;
apcs->mbox.dev = &pdev->dev;
apcs->mbox.ops = &qcom_apcs_ipc_ops;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/io.h`, `linux/slab.h`, `linux/of.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/regmap.h`.
- Detected declarations: `struct qcom_apcs_ipc`, `struct qcom_apcs_ipc_data`, `function qcom_apcs_ipc_send_data`, `function qcom_apcs_ipc_probe`, `function qcom_apcs_ipc_remove`, `function qcom_apcs_ipc_init`, `function qcom_apcs_ipc_exit`.
- Atlas domain: Driver Families / drivers/mailbox.
- Implementation status: integration 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.