ENUM GPIO_REGMAP_OPERATION(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

enum gpio_regmap_operation β€” okay so this is the operation type for your gpio_regmap callbacks, bestie. That's the whole vibe. It's an enum, it tells things what kinda op they're doing, and honestly it ate.

This page lives in the Kernel API Manual, and yeah, the function is enum gpio_regmap_operation(9) β€” iconic, no notes.


✨ SYNOPSIS ✨

enum gpio_regmap_operation {
    GPIO_REGMAP_GET_OP ,
    GPIO_REGMAP_SET_OP ,
    GPIO_REGMAP_GET_DIR_OP ,
    GPIO_REGMAP_SET_DIR_OP

};

Look at her. Four members, zero drama (mostly). πŸŽ€


πŸ¦‹ Constants πŸ¦‹

These are the four moods the enum can be in, and each one is lowkey doing exactly what it says on the label:

  • GPIO_REGMAP_GET_OP β€” the "read" mood πŸ’– β€” it indicates a read operation to get the current GPIO value.
  • GPIO_REGMAP_SET_OP β€” the "write" mood ✍️ β€” it indicates a write operation to set the GPIO output value.
  • GPIO_REGMAP_GET_DIR_OP β€” the "which way are we pointing" read mood 🧭 β€” it indicates a read operation to get the GPIO direction.
  • GPIO_REGMAP_SET_DIR_OP β€” the "okay point this way" write mood πŸ‘‘ β€” it indicates a write operation to set the GPIO direction.

🌸 Description 🌸

So here's the lore, and tbh it's giving "we tried it the old way and it did not slay."

Traditionally, the operation type was inferred from the base register. Simple, cute, worked sometimes. But β€” and this is the important part, bestie β€” that approach does not always work. For example, when all control bits of a single GPIO reside in the same register, the whole "just look at the base register" trick falls apart πŸ˜­πŸ’€.

Enter this enum. It allows the callbacks (reg_mask_xlate and value_xlate) to explicitly distinguish between operation types. No guessing, no vibe-checking the register, just ✨clarity✨.

And because the kernel respects your autonomy: the user is free to choose which method to use. Your code, your rules, periodt. 🫢

Then the page hits us with these ✨literally three✨ headings and honestly they're main-character energy with no supporting cast:

Read operation:

Write operation:

Direction operations:

(Yeah β€” that's it. That's the whole bit. The page puts them there and leaves them hanging, no cap. Not me waiting for the rest of the sentence πŸ™ˆ.)


πŸŽ€ SEE ALSO πŸŽ€

  • Kernel file ./include/linux/gpio/regmap.h β€” go read her, she's the source of truth πŸ¦‹
  • struct gpio_regmap_config(9) β€” the struct bestie that makes all this work πŸ’œ

⭐ aaaand that's the page!! go touch some registers (responsibly) πŸŒˆπŸ’…

Sign-off time: this one comes from ./include/linux/gpio, stamped October 2026, and yeah β€” it's enum gpio_regmap_operation(9) all the way down. mwah πŸ“πŸ§š

πŸ“¦ where this page comes from