i2c_add_numbered_adapter(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

i2c_add_numbered_adapter(9) β€” Kernel API Manual πŸ’…βœ¨

✨ NAME ✨

i2c_add_numbered_adapter β€” declare i2c adapter, use static bus number. bestie, this is the β€œmy bus number is not a vibe, it’s a fixed address” routine πŸŽ€

🌸 SYNOPSIS 🌸

int i2c_add_numbered_adapter (struct i2c_adapter *adap );

πŸŽ€ ARGUMENTS πŸŽ€

  • adap β€” the adapter to register, and yes, it has to have adap->nr initialized already. no cap, bestie, set that number first πŸ’…

😴 CONTEXT 😴

It can sleep 😴. That’s the whole context note, periodt.

πŸ’– DESCRIPTION πŸ’–

okay so this routine is used to declare an I2C adapter when its bus number matters. For example, use it for I2C adapters from system-on-chip CPUs, or otherwise built in to the system’s mainboard, and where i2c_board_info is used to properly configure I2C devices. it’s giving β€œI’m built in and I know my number” πŸ¦‹

If the requested bus number is set to -1, then this function will behave identically to i2c_add_adapter, and will dynamically assign a bus number. literally same behavior, it just picks one for you ✨

If no devices have pre-been declared for this bus, then be sure to register the adapter before any dynamically allocated ones. Otherwise the required bus ID may not be available. ⚠️ like, do not skip this ordering step, bestie β€” it’s important.

When this returns zero, the specified adapter became available for clients using the bus number provided in adap->nr. Also, the table of I2C devices pre-declared using i2c_register_board_info is scanned, and the appropriate driver model device nodes are created. Otherwise, a negative errno value is returned. 🫢

πŸ”Ž SEE ALSO πŸ”Ž

The kernel file is ./drivers/i2c/i2c-core-base.c, and the whole friend group is right here:


xoxo, the ./drivers/i2c girlies β€” October 2026 πŸ’‹πŸ’–

πŸ“¦ where this page comes from