drivers/i2c/busses/i2c-qcom-cci.c
Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-qcom-cci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/busses/i2c-qcom-cci.c- Extension
.c- Size
- 20425 bytes
- Lines
- 855
- Domain
- Driver Families
- Bucket
- drivers/i2c
- 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/clk.hlinux/completion.hlinux/i2c.hlinux/io.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.h
Detected Declarations
struct hw_paramsstruct ccistruct cci_masterstruct cci_datastruct ccienum cci_i2c_queue_tfunction cci_isrfunction cci_haltfunction cci_initfunction cci_resetfunction cci_run_queuefunction cci_validate_queuefunction cci_i2c_readfunction cci_i2c_writefunction cci_xferfunction cci_funcfunction cci_enable_clocksfunction cci_disable_clocksfunction cci_suspend_runtimefunction cci_resume_runtimefunction cci_suspendfunction cci_resumefunction cci_probefunction for_each_available_child_of_nodefunction cci_remove
Annotated Snippet
struct hw_params {
u16 thigh; /* HIGH period of the SCL clock in clock ticks */
u16 tlow; /* LOW period of the SCL clock */
u16 tsu_sto; /* set-up time for STOP condition */
u16 tsu_sta; /* set-up time for a repeated START condition */
u16 thd_dat; /* data hold time */
u16 thd_sta; /* hold time (repeated) START condition */
u16 tbuf; /* bus free time between a STOP and START condition */
u8 scl_stretch_en;
u16 trdhld;
u16 tsp; /* pulse width of spikes suppressed by the input filter */
};
struct cci;
struct cci_master {
struct i2c_adapter adap;
u16 master;
u8 mode;
int status;
struct completion irq_complete;
struct cci *cci;
};
struct cci_data {
unsigned int num_masters;
struct i2c_adapter_quirks quirks;
u16 queue_size[NUM_QUEUES];
struct hw_params params[3];
};
struct cci {
struct device *dev;
void __iomem *base;
unsigned int irq;
const struct cci_data *data;
struct clk_bulk_data *clocks;
int nclocks;
struct cci_master master[NUM_MASTERS];
};
static irqreturn_t cci_isr(int irq, void *dev)
{
struct cci *cci = dev;
u32 val, reset = 0;
int ret = IRQ_NONE;
val = readl(cci->base + CCI_IRQ_STATUS_0);
writel(val, cci->base + CCI_IRQ_CLEAR_0);
writel(0x1, cci->base + CCI_IRQ_GLOBAL_CLEAR_CMD);
if (val & CCI_IRQ_STATUS_0_RST_DONE_ACK) {
complete(&cci->master[0].irq_complete);
if (cci->master[1].master)
complete(&cci->master[1].irq_complete);
ret = IRQ_HANDLED;
}
if (val & CCI_IRQ_STATUS_0_I2C_M0_RD_DONE ||
val & CCI_IRQ_STATUS_0_I2C_M0_Q0_REPORT ||
val & CCI_IRQ_STATUS_0_I2C_M0_Q1_REPORT) {
cci->master[0].status = 0;
complete(&cci->master[0].irq_complete);
ret = IRQ_HANDLED;
}
if (val & CCI_IRQ_STATUS_0_I2C_M1_RD_DONE ||
val & CCI_IRQ_STATUS_0_I2C_M1_Q0_REPORT ||
val & CCI_IRQ_STATUS_0_I2C_M1_Q1_REPORT) {
cci->master[1].status = 0;
complete(&cci->master[1].irq_complete);
ret = IRQ_HANDLED;
}
if (unlikely(val & CCI_IRQ_STATUS_0_I2C_M0_Q0Q1_HALT_ACK)) {
reset = CCI_RESET_CMD_M0_MASK;
ret = IRQ_HANDLED;
}
if (unlikely(val & CCI_IRQ_STATUS_0_I2C_M1_Q0Q1_HALT_ACK)) {
reset = CCI_RESET_CMD_M1_MASK;
ret = IRQ_HANDLED;
}
if (unlikely(reset))
writel(reset, cci->base + CCI_RESET_CMD);
if (unlikely(val & CCI_IRQ_STATUS_0_I2C_M0_ERROR)) {
if (val & CCI_IRQ_STATUS_0_I2C_M0_Q0_NACK_ERR ||
val & CCI_IRQ_STATUS_0_I2C_M0_Q1_NACK_ERR)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/completion.h`, `linux/i2c.h`, `linux/io.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct hw_params`, `struct cci`, `struct cci_master`, `struct cci_data`, `struct cci`, `enum cci_i2c_queue_t`, `function cci_isr`, `function cci_halt`, `function cci_init`, `function cci_reset`.
- Atlas domain: Driver Families / drivers/i2c.
- 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.