STRUCT SAMSUNG_GPIO_CHIP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct samsung_gpio_chip(9)

okay so bestie, welcome to the Kernel API Manual, and today's main character is literally struct samsung_gpio_chip ✨ she's a wrapper, she's a struct, she's giving "I hold everything together" energy, and by the end of this page you're gonna be obsessed. no cap. 🫢


🌸 NAME 🌸

struct samsung_gpio_chip β€” a wrapper for a specific implementation of gpio. that's it, that's the tweet πŸ’…


✨ SYNOPSIS ✨

here's the whole vibe, laid out exactly as it lives in the header, bestie β€” every field, every alignment, nothing skipped πŸ‘‘

struct samsung_gpio_chip {
    struct gpio_chip        chip;
    struct samsung_gpio_cfg *config;
    struct samsung_gpio_pm  *pm;
    void __iomem            *base;
    int irq_base;
    int group;
    spinlock_t lock;
  #ifdef CONFIG_PM;
    u32 pm_save[4];
  #endif;
    u32 bitmap_gpio_int;
 };

πŸŽ€ Members πŸŽ€

okay these are the squad members, one by one, no one gets left out πŸ’–

  • chip β€” the chip structure that gets exported via gpiolib. she's the one out here actually being seen in public 🌈
  • config β€” special function and pull-resistor control information. yes, pull-resistor, she's got range πŸ’…
  • base β€” the base pointer to the gpio configuration registers.
  • irq_base β€” the base irq number.
  • group β€” the group register number for gpio interrupt support.
  • lock β€” lock for exclusive access to this gpio bank. do not touch without it, fr fr πŸ”’
  • pm_save β€” save information for suspend/resume support. she literally remembers things so you don't have to 😭
  • bitmap_gpio_int β€” bitmap for representing GPIO interrupt or not. iconic bit-flipping behaviour ⭐
ngl, notice how pm is chillin' up in the SYNOPSIS but the Members list doesn't give her a blurb? that's not me being lazy, that's just how the page is written πŸ™ˆ keeping it 100% accurate over here.

πŸ”₯ Description πŸ”₯

so this wrapper provides the necessary information for the Samsung specific gpios being registered with gpiolib. like, she's the little handler that makes sure the Samsung-specific bits get properly introduced to gpiolib. networking but for structs πŸ’€

the lock protects each gpio bank from multiple access of the shared configuration registers, or from reading of data whilst another thread is writing to the register set. read that again: whilst another thread is writing. so the lock is doing the absolute most and we love her for it 🫢

each chip has its own lock to avoid any contention between different CPU cores trying to get one lock for different GPIO banks, where each bank of GPIO has its own register space and configuration registers. translation: everybody gets their own lock, nobody's fighting in the group chat over a single shared resource, zero drama, maximum throughput πŸ‘‘βœ¨


πŸ¦‹ SEE ALSO πŸ¦‹

go read those next, bestie, iykyk πŸ“š


πŸ’€ reminder that this is all about shared configuration registers and lock discipline β€” do NOT go poking at base without respecting lock. that's the whole point. periodt.

and that's the page, bestie πŸŽ€ cute little sign-off time: this one's from ./arch/arm/mach-s3c, dated October 2026, and it's literally struct samsung_gpio_chip(9) β€” same energy, same facts, way more sparkle βœ¨πŸ’œπŸ¦‹

πŸ“¦ where this page comes from