gpio: of: support gpio-ranges for multiple gpiochip devices
authorDoug Berger <opendmb@gmail.com>
Wed, 24 Apr 2024 18:50:38 +0000 (11:50 -0700)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 26 Apr 2024 07:32:54 +0000 (09:32 +0200)
commite818cd3c8a345c046edff00b5ad0be4d39f7e4d4
treeb2e1b5c63c3e64b7b836a8965ffc667c1b9ffcad
parent7c66f8173360556ac0c3c38a91234af5a0a5a4a9
gpio: of: support gpio-ranges for multiple gpiochip devices

Some drivers (e.g. gpio-mt7621 and gpio-brcmstb) have multiple
gpiochip banks within a single device. Unfortunately, the
gpio-ranges property of the device node was being applied to
every gpiochip of the device with device relative GPIO offset
values rather than gpiochip relative GPIO offset values.

This commit makes use of the gpio_chip offset value which can be
non-zero for such devices to split the device node gpio-ranges
property into GPIO offset ranges that can be applied to each
of the relevant gpiochips of the device.

Signed-off-by: Doug Berger <opendmb@gmail.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240424185039.1707812-3-opendmb@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib-of.c