STRUCT MTK(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ NAME

okay so bestie, meet struct mtk β€” it's the state container for the data of the platform driver, and here's the gag: it is 3 separate gpio-chip all vibing together, having an IRQ linear domain shared for all of them 🫢. One domain, three chips, zero drama. Slay.

This is the struct mtk(9) page from the Kernel API Manual, and yes we're reading it for fun, that's just who we are now πŸ’…


✨ SYNOPSIS ✨

struct mtk {
    struct platform_device *pdev;
    void __iomem *base;
    struct irq_domain *irq_domain;
    int gpio_irq;
    int num_gpios;
    struct mtk_gc gc_map[MTK_BANK_CNT];
 };

Like, look at her. Iconic. πŸŽ€


🌸 MEMBERS 🌸

okay let's go through the squad one by one, no skipping, we respect all the fields here πŸ’–

  • pdev β€” the platform device instance. the main character of the struct ngl πŸ‘‘
  • base β€” the memory base address. it's giving "where everything actually lives" ✨
  • irq_domain β€” the IRQ linear domain that's shared across the three gpio chips. one domain for all three, they're literally sharing, we love a communal vibe πŸ¦‹
  • gpio_irq β€” the irq number, pulled from the device tree. it's the origin story fr fr 🌈
  • num_gpios β€” the total number of gpio pins on the three gpio chips. total, as in all of them together, not per-chip, don't come for me πŸ’…
  • gc_map β€” the array of the gpio chips. it's struct mtk_gc gc_map[MTK_BANK_CNT], which is literally an array of the gpio chips, walking in formation πŸŽ€
lowkey important: those three gpio-chip all share that one IRQ linear domain β€” that's the whole point of this struct being a "state container" for it all. no cap. 🧚

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./drivers/gpio/gpio-mt7621.c β€” go read her, she's right there, iykyk πŸ“

and that's the page bestie!! πŸ’– source: ./drivers/gpio, dated October 2026, so like, future vibes only ⭐ tysm for reading, you ate that 🫢✨

πŸ“¦ where this page comes from