drivers/mailbox/qcom-ipcc.c
Source file repositories/reference/linux-study-clean/drivers/mailbox/qcom-ipcc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mailbox/qcom-ipcc.c- Extension
.c- Size
- 9780 bytes
- Lines
- 383
- Domain
- Driver Families
- Bucket
- drivers/mailbox
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/interrupt.hlinux/irq.hlinux/irqdomain.hlinux/mailbox_controller.hlinux/module.hlinux/platform_device.hdt-bindings/mailbox/qcom-ipcc.h
Detected Declarations
struct qcom_ipcc_chan_infostruct qcom_ipccfunction qcom_ipcc_get_hwirqfunction qcom_ipcc_irq_fnfunction qcom_ipcc_mask_irqfunction qcom_ipcc_unmask_irqfunction qcom_ipcc_domain_mapfunction qcom_ipcc_domain_xlatefunction qcom_ipcc_mbox_send_datafunction qcom_ipcc_mbox_shutdownfunction qcom_ipcc_setup_mboxfunction qcom_ipcc_pm_resumefunction qcom_ipcc_probefunction qcom_ipcc_removefunction qcom_ipcc_init
Annotated Snippet
struct qcom_ipcc_chan_info {
u16 client_id;
u16 signal_id;
};
/**
* struct qcom_ipcc - Holder for the mailbox driver
* @dev: Device associated with this instance
* @base: Base address of the IPCC frame associated to APSS
* @irq_domain: The irq_domain associated with this instance
* @chans: The mailbox channels array
* @mchan: The per-mailbox channel info array
* @mbox: The mailbox controller
* @num_chans: Number of @chans elements
* @irq: Summary irq
*/
struct qcom_ipcc {
struct device *dev;
void __iomem *base;
struct irq_domain *irq_domain;
struct mbox_chan *chans;
struct qcom_ipcc_chan_info *mchan;
struct mbox_controller mbox;
int num_chans;
int irq;
};
static inline struct qcom_ipcc *to_qcom_ipcc(struct mbox_controller *mbox)
{
return container_of(mbox, struct qcom_ipcc, mbox);
}
static inline u32 qcom_ipcc_get_hwirq(u16 client_id, u16 signal_id)
{
return FIELD_PREP(IPCC_CLIENT_ID_MASK, client_id) |
FIELD_PREP(IPCC_SIGNAL_ID_MASK, signal_id);
}
static irqreturn_t qcom_ipcc_irq_fn(int irq, void *data)
{
struct qcom_ipcc *ipcc = data;
u32 hwirq;
int virq;
for (;;) {
hwirq = readl(ipcc->base + IPCC_REG_RECV_ID);
if (hwirq == IPCC_NO_PENDING_IRQ)
break;
virq = irq_find_mapping(ipcc->irq_domain, hwirq);
writel(hwirq, ipcc->base + IPCC_REG_RECV_SIGNAL_CLEAR);
generic_handle_irq(virq);
}
return IRQ_HANDLED;
}
static void qcom_ipcc_mask_irq(struct irq_data *irqd)
{
struct qcom_ipcc *ipcc = irq_data_get_irq_chip_data(irqd);
irq_hw_number_t hwirq = irqd_to_hwirq(irqd);
writel(hwirq, ipcc->base + IPCC_REG_RECV_SIGNAL_DISABLE);
}
static void qcom_ipcc_unmask_irq(struct irq_data *irqd)
{
struct qcom_ipcc *ipcc = irq_data_get_irq_chip_data(irqd);
irq_hw_number_t hwirq = irqd_to_hwirq(irqd);
writel(hwirq, ipcc->base + IPCC_REG_RECV_SIGNAL_ENABLE);
}
static struct irq_chip qcom_ipcc_irq_chip = {
.name = "ipcc",
.irq_mask = qcom_ipcc_mask_irq,
.irq_unmask = qcom_ipcc_unmask_irq,
.flags = IRQCHIP_SKIP_SET_WAKE,
};
static int qcom_ipcc_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw)
{
struct qcom_ipcc *ipcc = d->host_data;
irq_set_chip_and_handler(irq, &qcom_ipcc_irq_chip, handle_level_irq);
irq_set_chip_data(irq, ipcc);
irq_set_noprobe(irq);
return 0;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/mailbox_controller.h`, `linux/module.h`, `linux/platform_device.h`, `dt-bindings/mailbox/qcom-ipcc.h`.
- Detected declarations: `struct qcom_ipcc_chan_info`, `struct qcom_ipcc`, `function qcom_ipcc_get_hwirq`, `function qcom_ipcc_irq_fn`, `function qcom_ipcc_mask_irq`, `function qcom_ipcc_unmask_irq`, `function qcom_ipcc_domain_map`, `function qcom_ipcc_domain_xlate`, `function qcom_ipcc_mbox_send_data`, `function qcom_ipcc_mbox_shutdown`.
- Atlas domain: Driver Families / drivers/mailbox.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.