drivers/i2c/muxes/i2c-mux-pca954x.c
Source file repositories/reference/linux-study-clean/drivers/i2c/muxes/i2c-mux-pca954x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/muxes/i2c-mux-pca954x.c- Extension
.c- Size
- 18903 bytes
- Lines
- 718
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/i2c-mux.hlinux/interrupt.hlinux/irq.hlinux/module.hlinux/pm.hlinux/property.hlinux/regulator/consumer.hlinux/reset.hlinux/slab.hlinux/spinlock.hdt-bindings/mux/mux.h
Detected Declarations
struct chip_descstruct pca954xenum pca_typeenum muxtypefunction pca954x_reg_writefunction pca954x_regvalfunction pca954x_select_chanfunction pca954x_deselect_muxfunction idle_state_showfunction idle_state_storefunction pca954x_irq_handlerfunction pca954x_irq_set_typefunction pca954x_irq_setupfunction pca954x_cleanupfunction pca954x_initfunction pca954x_get_resetfunction pca954x_reset_deassertfunction pca954x_probefunction pca954x_removefunction pca954x_resume
Annotated Snippet
struct chip_desc {
u8 nchans;
u8 enable; /* used for muxes only */
u8 has_irq;
enum muxtype {
pca954x_ismux = 0,
pca954x_isswi
} muxtype;
struct i2c_device_identity id;
};
struct pca954x {
const struct chip_desc *chip;
u8 last_chan; /* last register value */
/* MUX_IDLE_AS_IS, MUX_IDLE_DISCONNECT or >= 0 for channel */
s32 idle_state;
struct i2c_client *client;
struct irq_domain *irq;
unsigned int irq_mask;
raw_spinlock_t lock;
struct regulator *supply;
struct gpio_desc *reset_gpio;
struct reset_control *reset_cont;
};
/* Provide specs for the MAX735x, PCA954x and PCA984x types we know about */
static const struct chip_desc chips[] = {
[max_7356] = {
.nchans = 8,
.muxtype = pca954x_isswi,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
},
[max_7357] = {
.nchans = 8,
.muxtype = pca954x_isswi,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
/*
* No interrupt controller support. The interrupt
* provides information about stuck channels.
*/
},
[max_7358] = {
.nchans = 8,
.muxtype = pca954x_isswi,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
/*
* No interrupt controller support. The interrupt
* provides information about stuck channels.
*/
},
[max_7367] = {
.nchans = 4,
.muxtype = pca954x_isswi,
.has_irq = 1,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
},
[max_7368] = {
.nchans = 4,
.muxtype = pca954x_isswi,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
},
[max_7369] = {
.nchans = 4,
.enable = 0x4,
.muxtype = pca954x_ismux,
.has_irq = 1,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
},
[pca_9540] = {
.nchans = 2,
.enable = 0x4,
.muxtype = pca954x_ismux,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
},
[pca_9542] = {
.nchans = 2,
.enable = 0x4,
.has_irq = 1,
.muxtype = pca954x_ismux,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
},
[pca_9543] = {
.nchans = 2,
.has_irq = 1,
.muxtype = pca954x_isswi,
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
Annotation
- Immediate include surface: `linux/device.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/i2c-mux.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/module.h`.
- Detected declarations: `struct chip_desc`, `struct pca954x`, `enum pca_type`, `enum muxtype`, `function pca954x_reg_write`, `function pca954x_regval`, `function pca954x_select_chan`, `function pca954x_deselect_mux`, `function idle_state_show`, `function idle_state_store`.
- Atlas domain: Driver Families / drivers/i2c.
- Implementation status: source 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.