i2c_dw_set_mode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ 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 🌈

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