STRUCT MESON_I2C(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 representing
  • dev β€” pointer to the device structure, the device's own little backstage pass
  • regs β€” 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 check
  • msg β€” pointer to the current I2C message, the one on deck right now
  • state β€” the current state in the driver's state machine πŸ”„ main character energy, honestly
  • last β€” flag set for the last message in the transfer 🏁 the finale flag
  • count β€” number of bytes to be sent/received in the current transfer, aka the byte tally
  • pos β€” current position in the send/receive buffer πŸ“ we know exactly where we are
  • error β€” flag set when an error is received 😭 yes it happens, and yes we flag it
  • lock β€” there to avoid race conditions between the irq handler and the xfer code πŸ”’ no cutting in line, periodt
  • done β€” 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 headcount
  • data β€” 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 the lock and respect the error flag πŸ™ˆ

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