i2c_register_board_info(9)
π i2c_register_board_info(9) β the Kernel API Manual page you actually wanna read π
okay so bestie, gather round, because this one is from the Kernel API Manual (section 9, kernel devs only, iykyk) and it's literally the function that lets you hard-code your I2C devices before anything else wakes up. no cap, it's iconic.
β¨ NAME β¨
i2c_register_board_info β statically declare I2C devices π
like, you're writing down which devices exist ahead of time, on paper, before the kernel even knows what's up.
π¦ SYNOPSIS π¦
int i2c_register_board_info (int busnum , struct i2c_board_info const
*info , unsigned len );
that's the whole signature, copy it exactly bestie, don't get creative π«Ά
πΈ ARGUMENTS πΈ
busnumβ identifies the bus to which these devices belong π₯ like which I2C bus these little guys are gonna live on.infoβ vector of i2c device descriptors π a whole array of "here's what this device is" structs.lenβ how many descriptors in the vector; may be zero to reserve the specified bus number β yes, zero is legal, and it's giving "I'm just holding this bus number, don't touch it."
π DESCRIPTION π
so systems using the Linux I2C driver stack can declare tables of board info while they initialize π that's the whole vibe. This should be done in board-specific init code near arch_initcall time, or equivalent, and β listen β before any I2C adapter driver is registered. order matters bestie, fr fr.
for example, mainboard init code could define several devices, as could the init code for each daughtercard in a board stack π everybody gets to declare their own little roster.
the I2C devices will be created later, after the adapter for the relevant bus has been registered. after that moment, standard driver model tools are used to bind "new style" I2C drivers to the devices. and here's the spicy part: the bus number for any device declared using this routine is not available for dynamic allocation π it's spoken for, periodt.
β οΈ also! the board info passed can safely be__initdata, but be careful of embedded pointers (forplatform_data, functions, etc) since that won't be copied π those pointers are on their own, so don't let them dangle into freed memory, okay?
π SEE ALSO π
- Kernel file
./drivers/i2c/i2c-boardinfo.cβ go read the source, it's right there π§
okay that's the whole page, slay π
this came out of ./drivers/i2c and it's dated October 2026 β mwah, bye bestie, go register some board info ππβ¨
π¦ 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