fwnode_gpiod_get_index(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fwnode_gpiod_get_index(9) β€” Kernel API Manual πŸ’…

✨ NAME ✨

fwnode_gpiod_get_index β€” obtain a GPIO from firmware node. That's literally the whole name vibe, bestie: it grabs a GPIO from a firmware node.


πŸŽ€ SYNOPSIS πŸŽ€

struct gpio_desc * fwnode_gpiod_get_index (struct fwnode_handle *fwnode
       , const char *con_id , int index , enum gpiod_flags flags , const char
       *label );

πŸ’– ARGUMENTS πŸ’–

  • fwnode β€” handle of the firmware node.
  • con_id β€” function within the GPIO consumer.
  • index β€” index of the GPIO to obtain for the consumer.
  • flags β€” GPIO initialization flags.
  • label β€” label to attach to the requested GPIO.

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this function is for drivers that get their configuration from opaque firmware. Very mysterious, very main character energy.

The function properly finds the corresponding GPIO using whatever is the underlying firmware interface, and then makes sure that the GPIO descriptor is requested before it is returned to the caller. Like, it does the finding and the requesting, and only then hands it over. Obsessed with the follow-through. 🫢

In case of error an ERR_PTR is returned. Yep, that's the tea.


🌸 RETURN 🌸

On successful request the GPIO pin is configured in accordance with provided flags. Slay. That's the successful-request situation, and the flags are the ones calling the shots.

Reminder from the DESCRIPTION bestie: in case of error an ERR_PTR is returned.

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/gpio/gpiolib.c plus the whole linked bestie squad, in the exact order we stan:

Cute sign-off time: source/version is ./drivers/gpio, date is October 2026, and this iconic page is fwnode_gpiod_get_index(9) πŸ’œπŸ’…

πŸ“¦ where this page comes from