i2c_dw_set_mode(9)
π i2c_dw_set_mode(9) β like, the Kernel API Manual, bestie
okay so picture this: you're deep in the kernel, in the i2c_dw zone, and you need your controller to pick a lane β master or slave. that's literally this function. it's from the Kernel API Manual and it's lowkey iconic. π
β¨ NAME β¨
i2c_dw_set_mode β picks the controller's mode of operation, aka master or slave, no big deal π
πΈ SYNOPSIS πΈ
void i2c_dw_set_mode (struct dw_i2c_dev *dev , int mode );
π¦ ARGUMENTS π¦
devβ the device private data, the whole personality of your controller basically π«Άmodeβ the I2C mode of operation you want, king π
π₯ DESCRIPTION π₯
So this function configures the controller to operate in mode. that's the whole vibe. and the way you need to call it is whenever a mode swap is required β like, every single time. no skipping. π
now here's the tea about slave mode β β setting the slave mode does not have an effect before a slave device is registered. so before that slave device gets registered, the controller is just kept in master mode regardless of mode. yes, regardless. it's giving "i'll do it when i'm ready." π
β οΈ and this is the important one, bestie: the controller must be disabled before this function is called. like actually must. don't come for me if you skip that step. π
π SEE ALSO π
- Kernel file
./drivers/i2c/busses/i2c-designware-common.c i2c_dw_init_regmap(9)i2c_dw_init(9)
go read those too, they're fr fr worth it β¨
mwah, that's the page π this lil beauty lives in ./drivers/i2c/busses and it's dated October 2026 β slay, periodt, see you in the next manpage ππ¦
π¦ 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