STRUCT I2C_CLIENT(9)
πΈ struct i2c_client(9) πΈ
okay so bestie, welcome to the Kernel API Manual π this one's about struct i2c_client and it's genuinely not that deep, i promise. it's just... the little ID card for one single chip on an i2c bus. slay.
β¨ NAME β¨
struct i2c_client β represent an I2C slave device π
like, literally, that's the whole vibe. it's the representation. the moment. the struct.
π SYNOPSIS π
okay here's the whole thing, verbatim, don't @ me:
struct i2c_client {
unsigned short flags;
#define I2C_CLIENT_PEC 0x04 ;
#define I2C_CLIENT_TEN 0x10 ;
#define I2C_CLIENT_SLAVE 0x20 ;
#define I2C_CLIENT_HOST_NOTIFY 0x40 ;
#define I2C_CLIENT_WAKE 0x80 ;
#define I2C_CLIENT_SCCB 0x9000 ;
unsigned short addr;
char name[I2C_NAME_SIZE];
struct i2c_adapter *adapter;
struct device dev;
int init_irq;
int irq;
struct list_head detected;
#if IS_ENABLED(CONFIG_I2C_SLAVE);
i2c_slave_cb_t slave_cb;
#endif;
void *devres_group_id;
struct dentry *debugfs;
};
look at her. gorgeous. no notes. π
π¦ Members π¦
okay so let's go field by field, group-chat style. every single one, no skipping, i would never π
flagsβ theI2C_CLIENT_*defines are where the actual possibilities live, so go check those out. literally "seeI2C_CLIENT_*for possible flags". that's the assignment bestie πaddrβ the address used on the I2C bus that's connected to the parent adapter. that's the address, that's it, that's the whole field β¨nameβ it tells you the type of the device. usually it's a chip name picked to be generic enough to hide second-sourcing and compatible revisions π so like, the name is doing PR work for the silicon. iconic honestly.adapterβ this one manages the bus segment that's hosting this I2C device. the adapter runs the block, this client just lives there πdevβ the driver model device node for the slave. your driver-model paperwork, basically πinit_irqβ the IRQ that was set at initialization. the original one. the one from the beginning βirqβ indicates the IRQ generated by this device, if any. note the "if any" β some devices are just out here with no interrupts at all and that's valid πdetectedβ this member is either part of ai2c_driver.clientslist, or part of i2c-core'suserspace_deviceslist. it's a list member, she's social πΈslave_cbβ the callback used when the adapter's I2C slave mode is in play. the adapter calls it to pass slave events along to the slave driver. also she's wrapped in#if IS_ENABLED(CONFIG_I2C_SLAVE)so if that's not enabled she's simply not invited π«Άdevres_group_idβ the id of the devres group that's gonna get created for the resources acquired when probing this device. it's giving resource management β¨debugfsβ pointer to the debugfs subdirectory that the I2C core created for this client. cute little debug home π‘
π Description π
okay so the actual plot: an i2c_client identifies one single device (read: chip) that's connected to an i2c bus. that's the job. one chip, one client.
and the behaviour that Linux actually gets to see? that's defined by the driver managing the device. so like, the struct is the ID card, the driver is the personality ππ
π₯ SEE ALSO π₯
the friend group, in full, no cuts:
Kernel file ./include/linux/i2c.h, i2c_master_recv(9), i2c_master_recv_dmasafe(9), i2c_master_send(9), i2c_master_send_dmasafe(9), struct i2c_device_identity(9), enum i2c_driver_flags(9), struct i2c_driver(9), struct i2c_board_info(9), I2C_BOARD_INFO(9), struct i2c_algorithm(9), struct i2c_lock_operations(9), struct i2c_timings(9), struct i2c_bus_recovery_info(9), struct i2c_adapter_quirks(9), i2c_lock_bus(9), i2c_trylock_bus(9), i2c_unlock_bus(9), i2c_mark_adapter_suspended(9), i2c_mark_adapter_resumed(9), i2c_check_quirks(9), module_i2c_driver(9), builtin_i2c_driver(9)
ok that's the whole page bestie, go build something, i believe in you π
and that's a wrap π this came out of ./include/linux, dated October 2026, for struct i2c_client(9) β mwah, bye β¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms