[PATCH v5 2/3] gpiolib: add get_config() and gpiochip_generic_get_config()
Linus Walleij
linusw at kernel.org
Mon Sep 14 05:05:19 PDT 2026
On Thu, Sep 3, 2026 at 9:59 AM Mehmet Fide <mehmet.fide at gmail.com> wrote:
> From: Mehmet Fide <mehmet.fide at screeningeagle.com>
>
> 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 at kernel.org>
> Signed-off-by: Mehmet Fide <mehmet.fide at screeningeagle.com>
Excellent Mehmet, exactly what I had in mind!
Reviewed-by: Linus Walleij <linusw at kernel.org>
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list