Re: [PATCH v5 2/3] gpiolib: add get_config() and gpiochip_generic_get_config()

From: Linus Walleij

Date: Mon Sep 14 2026 - 08:29:07 EST


On Thu, Sep 3, 2026 at 9:59 AM Mehmet Fide <mehmet.fide@xxxxxxxxx> wrote:

> From: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>
>
> A chip with a pin control backend sets a line's configuration through
> set_config() and gpiochip_generic_config(), but has no way to read one
> back. gpio-mmio needs that to learn the direction of a line whose
> direction lives in the pin controller.
>
> Add the optional get_config() callback, taking the packed parameter to
> query and returning its bare argument the way pinctrl_gpio_get_config()
> does, and gpiochip_generic_get_config() as the pin control backed
> implementation, the mirror of gpiochip_generic_config(). Without
> CONFIG_PINCTRL the pinctrl stub returns 0 and leaves the config alone,
> so the helper answers -ENOTSUPP there instead.
>
> Nothing in gpiolib calls get_config() and there is no consumer API; it
> is for the chip's own use.
>
> Suggested-by: Linus Walleij <linusw@xxxxxxxxxx>
> Signed-off-by: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>

Excellent Mehmet, exactly what I had in mind!
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Yours,
Linus Walleij