STRUCT MAX3191X_CHIP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct max3191x_chip(9) β€” the max3191x daisy-chain, explained by your favorite kernel bestie

okay so this is from the Kernel API Manual, and it's literally the struct that makes a whole daisy-chain of max3191x chips behave like one big happy GPIO family. let's get into it πŸŽ€


✨ NAME ✨

struct max3191x_chip β€” max3191x daisy-chain


🌸 SYNOPSIS 🌸

struct max3191x_chip {
    struct gpio_chip gpio;
    struct mutex lock;
    u32 nchips;
    enum max3191x_mode mode;
    struct gpio_descs *modesel_pins;
    struct gpio_descs *fault_pins;
    struct gpio_descs *db0_pins;
    struct gpio_descs *db1_pins;
    struct spi_message mesg;
    struct spi_transfer xfer;
    unsigned long *crc_error;
    unsigned long *overtemp;
    unsigned long *undervolt1;
    unsigned long *undervolt2;
    unsigned long *fault;
    bool ignore_uv;
};

πŸ’– Members πŸ’–

the whole squad, one member at a time 🫢

  • gpio β€” the GPIO controller struct. main character energy, honestly ✨
  • lock β€” this one protects read sequences. it's giving bouncer at the club πŸšͺπŸ’…
  • nchips β€” how many chips are in the daisy-chain. count 'em, bestie πŸ”’
  • mode β€” the current mode: 0 for 16-bit, 1 for 8-bit. and for simplicity, all chips in the daisy-chain are assumed to use the same mode (no mixing, we don't do that here πŸ™…β€β™€οΈ)
  • modesel_pins β€” GPIO pins to configure modesel of each chip πŸŽ›οΈ
  • fault_pins β€” GPIO pins to detect fault of each chip 🚨
  • db0_pins β€” GPIO pins to configure debounce of each chip 🎚️
  • db1_pins β€” GPIO pins to configure debounce of each chip 🎚️ (yep, db1_pins has the exact same description as db0_pins β€” that's what it says, not me making stuff up, i'm just the messenger 😭)
  • mesg β€” the SPI message used to perform a readout πŸ“¨
  • xfer β€” the SPI transfer used by mesg πŸ”
  • crc_error β€” bitmap signaling CRC error for each chip πŸ’€
  • overtemp β€” bitmap signaling overtemperature alarm for each chip πŸ”₯
  • undervolt1 β€” bitmap signaling undervoltage alarm for each chip ⚑
  • undervolt2 β€” bitmap signaling undervoltage warning for each chip ⚠️
  • fault β€” bitmap signaling assertion of fault_pins for each chip 🚩
  • ignore_uv β€” whether to ignore undervoltage alarms. it gets set by a device property if the chips are powered through 5VOUT instead of VCC24V, and in that case they will constantly signal undervoltage (iconic behavior, honestly 😭). and again, for simplicity, all chips in the daisy-chain are assumed to be powered the same way πŸ”Œ
lowkey important: those "for simplicity" bits are real constraints, not vibes. the struct assumes uniform mode and uniform powering across the whole chain. periodt. πŸ‘‘

πŸ¦‹ SEE ALSO πŸ¦‹

  • Kernel file ./drivers/gpio/gpio-max3191x.c β€” go read the source, bestie, it's right there πŸ“–βœ¨

and that's the whole page, no cap πŸ’œ huge shoutout to the ./drivers/gpio crew β€” this one's dated October 2026, manual name Kernel API Manual, so go off and read those registers responsibly, mwah πŸŽ€πŸŒΈπŸ’…

πŸ“¦ where this page comes from