aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorThéo Lebrun <theo.lebrun@bootlin.com>2024-02-28 12:28:17 +0100
committerLinus Walleij <linus.walleij@linaro.org>2024-02-29 10:32:39 +0100
commit75d270fda64d4e12d0ce35334bca6d674cd7b943 (patch)
tree4cfcf4d3db7e1c4deccb0e426449aa5ff5a104c9 /drivers/gpio
parent2f8875ddd13ae797edc45384f56ecc8a9496d2ca (diff)
downloadlinux-75d270fda64d4e12d0ce35334bca6d674cd7b943.tar.gz
gpio: nomadik: request dynamic ID allocation
Move away from statically allocated GPIO IDs. Switch to dynamic ID allocation. Static IDs are deprecated because they cause issues when multiple GPIO controllers are to be found on the same platform. Add a bit of complexity to do pin number -> GPIO chip + offset. Previously, bank number and offsets were retrieved using division and remainder (bank size being constant 32). Now, to get the pin number matching a bank base, we must know the sum of ngpios of previous banks. This is done in find_nmk_gpio_from_pin() which also exposes the offset inside the bank. Also remove the assumption that bank sizes are constant. Instead of using NMK_GPIO_PER_CHIP as bank size, use nmk_gpio_chips[i]->ngpio. Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com> Link: https://lore.kernel.org/r/20240228-mbly-gpio-v2-19-3ba757474006@bootlin.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-nomadik.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
index fb821a9b6c5f9..b7d76cc901dcf 100644
--- a/drivers/gpio/gpio-nomadik.c
+++ b/drivers/gpio/gpio-nomadik.c
@@ -519,7 +519,7 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np,
nmk_chip->bank = id;
chip = &nmk_chip->chip;
- chip->base = id * NMK_GPIO_PER_CHIP;
+ chip->base = -1;
chip->ngpio = NMK_GPIO_PER_CHIP;
chip->label = dev_name(gpio_dev);
chip->parent = gpio_dev;