drivers/i2c/busses/i2c-amd-mp2-pci.c
Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-amd-mp2-pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/busses/i2c-amd-mp2-pci.c- Extension
.c- Size
- 12152 bytes
- Lines
- 480
- Domain
- Driver Families
- Bucket
- drivers/i2c
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/dma-mapping.hlinux/interrupt.hlinux/module.hlinux/pci.hlinux/slab.hi2c-amd-mp2.hlinux/io-64-nonatomic-lo-hi.h
Detected Declarations
function amd_mp2_c2p_mutex_lockfunction amd_mp2_c2p_mutex_unlockfunction amd_mp2_cmdfunction amd_mp2_bus_enable_setfunction amd_mp2_cmd_rw_fillfunction amd_mp2_rwfunction amd_mp2_pci_check_rw_eventfunction __amd_mp2_process_eventfunction amd_mp2_process_eventfunction amd_mp2_irq_isrfunction amd_mp2_rw_timeoutfunction amd_mp2_register_cbfunction amd_mp2_unregister_cbfunction amd_mp2_clear_regfunction amd_mp2_pci_initfunction amd_mp2_pci_probefunction amd_mp2_pci_removefunction amd_mp2_pci_suspendfunction amd_mp2_pci_resumeexport amd_mp2_bus_enable_setexport amd_mp2_rwexport amd_mp2_process_eventexport amd_mp2_rw_timeoutexport amd_mp2_register_cbexport amd_mp2_unregister_cbexport amd_mp2_find_device
Annotated Snippet
static struct pci_driver amd_mp2_pci_driver = {
.name = "i2c_amd_mp2",
.id_table = amd_mp2_pci_tbl,
.probe = amd_mp2_pci_probe,
.remove = amd_mp2_pci_remove,
#ifdef CONFIG_PM
.driver = {
.pm = &amd_mp2_pci_pm_ops,
},
#endif
};
module_pci_driver(amd_mp2_pci_driver);
struct amd_mp2_dev *amd_mp2_find_device(void)
{
struct amd_mp2_dev *privdata;
struct device *dev;
struct pci_dev *pci_dev;
dev = driver_find_next_device(&amd_mp2_pci_driver.driver, NULL);
if (!dev)
return NULL;
pci_dev = to_pci_dev(dev);
privdata = pci_get_drvdata(pci_dev);
put_device(dev);
return privdata;
}
EXPORT_SYMBOL_GPL(amd_mp2_find_device);
MODULE_DESCRIPTION("AMD(R) PCI-E MP2 I2C Controller Driver");
MODULE_AUTHOR("Shyam Sundar S K <Shyam-sundar.S-k@amd.com>");
MODULE_AUTHOR("Elie Morisse <syniurge@gmail.com>");
MODULE_LICENSE("Dual BSD/GPL");
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/interrupt.h`, `linux/module.h`, `linux/pci.h`, `linux/slab.h`, `i2c-amd-mp2.h`, `linux/io-64-nonatomic-lo-hi.h`.
- Detected declarations: `function amd_mp2_c2p_mutex_lock`, `function amd_mp2_c2p_mutex_unlock`, `function amd_mp2_cmd`, `function amd_mp2_bus_enable_set`, `function amd_mp2_cmd_rw_fill`, `function amd_mp2_rw`, `function amd_mp2_pci_check_rw_event`, `function __amd_mp2_process_event`, `function amd_mp2_process_event`, `function amd_mp2_irq_isr`.
- Atlas domain: Driver Families / drivers/i2c.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.