STRUCT MESON_I2C(9)
β¨ struct meson_i2c(9) β¨
okay so bestie, this page is straight out of the Kernel API Manual and it's literally the whole personality of the Meson I2C driver's private data π yes, private β this is the little struct where the driver keeps all its business, and we're gonna go through every single field because we do not skip anything in this house π
Think of it as the driver's group chat: adapter, device, regs, clocks, messages, state machine, locks, the whole vibe. Let's get into it π¦
π NAME π
struct meson_i2c β the Meson I2C device's private data, aka where the driver stores its own stuff πΈ
π SYNOPSIS π
struct meson_i2c {
struct i2c_adapter adap;
struct device *dev;
void __iomem *regs;
struct clk *clk;
struct i2c_msg *msg;
int state;
bool last;
int count;
int pos;
int error;
spinlock_t lock;
struct completion done;
u32 tokens[2];
int num_tokens;
const struct meson_i2c_data *data;
};
no cap, that's the whole struct, copied exactly, every field in order π
π Members π
adapβ the I2C adapter instance π«Ά the actual adapter this driver is out here representingdevβ pointer to the device structure, the device's own little backstage passregsβ base address of the device's memory-mapped registers, i.e. where the magic gets poked β¨clkβ pointer to the clock structure β° gotta keep that clock in checkmsgβ pointer to the current I2C message, the one on deck right nowstateβ the current state in the driver's state machine π main character energy, honestlylastβ flag set for the last message in the transfer π the finale flagcountβ number of bytes to be sent/received in the current transfer, aka the byte tallyposβ current position in the send/receive buffer π we know exactly where we areerrorβ flag set when an error is received π yes it happens, and yes we flag itlockβ there to avoid race conditions between the irq handler and the xfer code π no cutting in line, periodtdoneβ completion used to wait for transfer termination β³ "tell me when you're done bestie"tokensβ sequence of tokens to be written to the device ποΈποΈ literally an array of two:u32 tokens[2]num_tokensβ number of tokens, the token headcountdataβ pointer to the controller's platform data π§ the controller's own lore
π SEE ALSO π
- Kernel file
./drivers/i2c/busses/i2c-meson.cβ go read the source, iykyk π
fr fr, if you're touching this struct you're already deep in the Meson I2C driver, so respect thelockand respect theerrorflag π
and that's the whole page, bestie π this was ./drivers/i2c/busses, October 2026 β slay, go forth and read the kernel source π
π¦ 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