i2c_atr_add_adapter(9)
π i2c_atr_add_adapter (kernel API manual, bestie edition)
okay so you found i2c_atr_add_adapter in the kernel API manual and you're like "what is this diva doing" β don't worry, I gotchu. She's a little function with main character energy and she's about to spawn a whole new I2C bus for you. β¨
πΈ NAME πΈ
i2c_atr_add_adapter β create a child ("downstream") I2C bus. literally birthing a bus, no cap π¦
β¨ SYNOPSIS β¨
int i2c_atr_add_adapter (struct i2c_atr *atr , struct i2c_atr_adap_desc
*desc );
π ARGUMENTS π
atrβ the I2C ATR. the parent, the origin story, the whole vibe. πdescβ an ATR adapter descriptor. it's giving "here's the blueprint for your new baby bus". πΌ
π DESCRIPTION π
so after you call this function, a brand new i2c bus just appears. pop! iconic. adding and removing devices on that downstream bus will result in calls to the i2c_atr_ops->attach_client and i2c_atr_ops->detach_client callbacks β that's how the driver gets to assign an alias to the device. teamwork, bestie. π«Ά
the adapter's fwnode is set to bus_handle, OR β plot twist β if bus_handle is NULL, the function goes looking for a child node whose 'reg' property matches the chan_id under the i2c-atr device's 'i2c-atr' node. detective era. π
and when you're done with your new bus? call i2c_atr_del_adapter to remove the adapter. clean up after yourself, we love a responsible queen. π
β RETURN β
0 on success, a negative error code otherwise. that's it, that's the vibe check. π
π SEE ALSO π
kernel file ./include/linux/i2c-atr.h, plus the whole squad:
enum i2c_atr_flags(9)struct i2c_atr_ops(9)struct i2c_atr_adap_desc(9)i2c_atr_new(9)i2c_atr_delete(9)i2c_atr_del_adapter(9)i2c_atr_set_driver_data(9)i2c_atr_get_driver_data(9)
π and that's the page, bestie β straight from./include/linux, dated October 2026,i2c_atr_add_adapter(9). go forth and add those adapters fr fr. π§π
π¦ 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