gpiolib: implement low-level, shared GPIO support
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 12 Nov 2025 13:55:32 +0000 (14:55 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 17 Nov 2025 09:16:51 +0000 (10:16 +0100)
commita060b8c511abb0997381b397e52149a5e3e5259a
treeea03d4d2d25a860dedba9afe684d351fccbfb5a4
parentd4340ff75eaa083f261e16d49f13191236bfad06
gpiolib: implement low-level, shared GPIO support

This module scans the device tree (for now only OF nodes are supported
but care is taken to make other fwnode implementations easy to
integrate) and determines which GPIO lines are shared by multiple users.
It stores that information in memory. When the GPIO chip exposing shared
lines is registered, the shared GPIO descriptors it exposes are marked
as shared and virtual "proxy" devices that mediate access to the shared
lines are created. When a consumer of a shared GPIO looks it up, its
fwnode lookup is redirected to a just-in-time machine lookup that points
to this proxy device.

This code can be compiled out on platforms which don't use shared GPIOs.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20251112-gpio-shared-v4-3-b51f97b1abd8@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpiolib-shared.c [new file with mode: 0644]
drivers/gpio/gpiolib-shared.h [new file with mode: 0644]