diff options
| author | Mark Brown <broonie@kernel.org> | 2025-11-20 12:39:38 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-11-20 12:39:38 +0000 |
| commit | be2b723d94f2fa3f8ca028a55d313ba0b3007d44 (patch) | |
| tree | cff5cffc26b0902dccbd1507ecb70578ce3e772f /sound/soc/codecs/wsa883x.c | |
| parent | bdf96e9135a0cf53a853a19c30fa11131a744062 (diff) | |
| parent | 7a0a87712120329c034b0aae88bdaa05bd046f10 (diff) | |
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.
Diffstat (limited to 'sound/soc/codecs/wsa883x.c')
| -rw-r--r-- | sound/soc/codecs/wsa883x.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c index 96dd66c4b88d..c3046e260cb9 100644 --- a/sound/soc/codecs/wsa883x.c +++ b/sound/soc/codecs/wsa883x.c @@ -1572,13 +1572,10 @@ static int wsa883x_get_reset(struct device *dev, struct wsa883x_priv *wsa883x) if (IS_ERR(wsa883x->sd_reset)) return dev_err_probe(dev, PTR_ERR(wsa883x->sd_reset), "Failed to get reset\n"); - /* - * if sd_reset: NULL, so use the backwards compatible way for powerdown-gpios, - * which does not handle sharing GPIO properly. - */ + + /* if sd_reset: NULL, so use the backwards compatible way for powerdown-gpios */ if (!wsa883x->sd_reset) { wsa883x->sd_n = devm_gpiod_get_optional(dev, "powerdown", - GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH); if (IS_ERR(wsa883x->sd_n)) return dev_err_probe(dev, PTR_ERR(wsa883x->sd_n), |