]> Gentwo Git Trees - linux/.git/commit
gpio: improve support for shared GPIOs
authorMark Brown <broonie@kernel.org>
Thu, 20 Nov 2025 09:23:08 +0000 (09:23 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 20 Nov 2025 09:23:08 +0000 (09:23 +0000)
commitc22f7a5cd205492c48c6deb72f5efe2ae63c931e
treef0dc02e8a02f97b06548d4f9b42fcc9f83e1e316
parent21e68bcb1b0c688c2d9ca0d457922febac650ac1
parentb871d9adffe5a64a1fd9edcb1aebbcc995b17901
gpio: improve support for shared GPIOs

Merge series from Bartosz Golaszewski <brgl@bgdev.pl>:

Problem statement: GPIOs are implemented as a strictly exclusive
resource in the kernel but there are lots of platforms on which single
pin is shared by multiple devices which don't communicate so need some
way of properly sharing access to a GPIO. What we have now is the
GPIOD_FLAGS_BIT_NONEXCLUSIVE flag which was introduced as a hack and
doesn't do any locking or arbitration of access - it literally just hand
the same GPIO descriptor to all interested users.

The proposed solution is composed of three major parts: the high-level,
shared GPIO proxy driver that arbitrates access to the shared pin and
exposes a regular GPIO chip interface to consumers, a low-level shared
GPIOLIB module that scans firmware nodes and creates auxiliary devices
that attach to the proxy driver and finally a set of core GPIOLIB
changes that plug the former into the GPIO lookup path.

The changes are implemented in a way that allows to seamlessly compile
out any code related to sharing GPIOs for systems that don't need it.

The practical use-case for this are the powerdown GPIOs shared by
speakers on Qualcomm db845c platform, however I have also extensively
tested it using gpio-virtuser on arm64 qemu with various DT
configurations.
drivers/regulator/core.c