STRUCT MPR_DATA(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ NAME πŸ¦‹

struct mpr_data β€” okay so bestie, the official description here is literally just a dash. Nothing. A whole void. πŸ’€ The kernel devs said "she's self-explanatory" and dipped. So the vibe is: this is the data struct for the MPR pressure sensor driver, and everything you actually need to know is in the members down below. Keep reading, iykyk.

This page is from section 9 of the Kernel API Manual, the kernel internals girlie section, so like... kernel devs only, no cap.


✨ SYNOPSIS ✨

Here's the whole shape of her, fr fr β€” copy it exactly, no edits:

struct mpr_data {
    struct device           *dev;
    const struct mpr_ops    *ops;
    struct mutex            lock;
    u32 pmin;
    u32 pmax;
    enum mpr_func_id        function;
    u32 outmin;
    u32 outmax;
    int scale;
    int scale2;
    int offset;
    struct gpio_desc        *gpiod_reset;
    int irq;
    struct completion       completion;
    struct {
      s32 pres;
      aligned_s64 ts;
    } chan;
    u8 rx_buf[MPR_MEASUREMENT_RD_SIZE];
    u8 tx_buf[MPR_MEASUREMENT_RD_SIZE];
 };

πŸŽ€ Members πŸŽ€

Let's go member by member, because every single field is eating and we're not skipping a single one 🫢

  • dev β€” the current device structure. Her whole identity, essentially πŸ’…
  • ops β€” the functions that implement the sensor reads/writes, and bus init. All the actual doing happens here.
  • lock β€” access to the device during read. She's a struct mutex, she keeps things orderly, we stan a boundaries queen.
  • pmin β€” minimal pressure in pascal.
  • pmax β€” maximal pressure in pascal.
  • function β€” the transfer function.
  • outmin β€” minimum raw pressure in counts (based on transfer function).
  • outmax β€” maximum raw pressure in counts (based on transfer function).
  • scale β€” pressure scale.
  • scale2 β€” pressure scale, decimal number.
  • offset β€” pressure offset.
  • gpiod_reset β€” reset. That's the whole description. Iconic brevity honestly πŸ‘‘
  • irq β€” end of conversion irq. Used to distinguish between irq mode and reading in a loop until data is ready. So she's literally the girl who tells you which mode you're in 😭
  • completion β€” handshake from irq to read. Passing the message along, love that for her.
  • chan β€” channel values for buffered mode.
    • chan.pres β€” pressure value.
    • chan.ts β€” timestamp.
  • rx_buf β€” raw conversion data.
  • tx_buf β€” output buffer.
Quick reminder bestie: rx_buf and tx_buf are both u8 arrays sized MPR_MEASUREMENT_RD_SIZE, exactly like the synopsis says. Don't go changing that number, I'm begging πŸ™ˆ

🌈 SEE ALSO 🌈

  • Kernel file ./drivers/iio/pressure/mprls0025pa.h β€” go read the header, she has the lore ✨

That's the whole page, babe! No notes, no drama, every field accounted for πŸ’–

And for the official sign-off: this little gem lives in ./drivers/iio/pressure, and the date on it is October 2026. So like, future-dated and flawless. Slay πŸŒΈπŸ’…

πŸ“¦ where this page comes from