STRUCT REALTEK_GPIO_CTRL(9)
π 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 associatedgpio_generic_chipinstance, 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms