i2c_atr_add_adapter(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:


πŸ’€ 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