diff options
| author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2025-11-12 14:55:39 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-11-19 11:52:04 +0000 |
| commit | b871d9adffe5a64a1fd9edcb1aebbcc995b17901 (patch) | |
| tree | f7a79ae62d60ebcc9cbccc0aa9f95bc7fc61c664 | |
| parent | eb374f764a7012eda28019266a6d9191670c4fa5 (diff) | |
regulator: make the subsystem aware of shared GPIOs
GPIOLIB is now aware of shared GPIOs and - for platforms where access to
such pins is managed internally - we don't need to keep track of the
enable count.
Once all users in the kernel switch to using the new mechanism, we'll be
able to drop the internal counting of users from the regulator code.
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://patch.msgid.link/20251112-gpio-shared-v4-10-b51f97b1abd8@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/regulator/core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index dd7b10e768c0..f9690f0689fd 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2616,6 +2616,13 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, mutex_lock(®ulator_list_mutex); + if (gpiod_is_shared(gpiod)) + /* + * The sharing of this GPIO pin is managed internally by + * GPIOLIB. We don't need to keep track of its enable count. + */ + goto skip_compare; + list_for_each_entry(pin, ®ulator_ena_gpio_list, list) { if (gpiod_is_equal(pin->gpiod, gpiod)) { rdev_dbg(rdev, "GPIO is already used\n"); @@ -2628,6 +2635,7 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, return -ENOMEM; } +skip_compare: pin = new_pin; new_pin = NULL; |
