STRUCT REALTEK_GPIO_CTRL(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

struct realtek_gpio_ctrl β€” Realtek Otto GPIO driver data. Okay so this is the struct realtek_gpio_ctrl(9) page from the Kernel API Manual, and it is literally the driver-data struct for Realtek Otto GPIO. Bestie, we are getting into it. πŸ’…


✨ SYNOPSIS ✨

struct realtek_gpio_ctrl {
    struct gpio_generic_chip chip;
    void __iomem *base;
    void __iomem *cpumask_base;
    struct cpumask cpu_irq_maskable;
    raw_spinlock_t lock;
    u8 intr_mask[REALTEK_GPIO_MAX];
    u8 intr_type[REALTEK_GPIO_MAX];
    u32 (*bank_read)(void __iomem *reg);
    void (*bank_write)(void __iomem *reg, u32 value);
    unsigned int (*line_imr_pos)(unsigned int line);
};

🫢 Members 🫢

  • chip β€” the associated gpio_generic_chip instance, like its main-character companion.
  • base β€” base address of the register block for a GPIO bank.
  • cpumask_base β€” base address of the per-CPU interrupt mask registers.
  • cpu_irq_maskable β€” the CPUs that can receive GPIO interrupts.
  • lock β€” the lock for accessing the IRQ registers and values.
  • intr_mask β€” mask for interrupt lines.
  • intr_type β€” interrupt type selection.
  • bank_read β€” read a bank setting as a single 32-bit value.
  • bank_write β€” write a bank setting as a single 32-bit value.
  • line_imr_pos β€” bit shift of an IRQ line's IMR value.

🌸 Description 🌸

Real talk: the DIR, DATA, and ISR registers are made of four 8-bit port values packed into a single 32-bit register. So use bank_read (bank_write) to get (assign) a value from (to) these registers. The IMR register is made of four 16-bit port values, packed into two 32-bit registers. Use imr_line_pos to get the bit shift of the 2-bit field for a line's IMR settings β€” and yes, the prose says imr_line_pos while the member above is line_imr_pos; keeping both exactly as written, bestie, iykyk. Shifts larger than 32 overflow into the second register. Mind the overflow, no cap. 😭

Because the interrupt mask register (IMR) combines the function of IRQ type selection and masking, two extra values are stored. intr_mask is used to mask/unmask the interrupts for a GPIO line, and intr_type is used to store the selected interrupt types. The logical AND of these values is written to IMR on changes. periodt. πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/gpio/gpio-realtek-otto.c β€” that is the one to peek at, bestie. πŸ¦‹


okay bye bestie 🫢 β€” source/version: ./drivers/gpio; date: October 2026; page: struct realtek_gpio_ctrl(9). mwah. πŸ’–

πŸ“¦ where this page comes from