mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
gpiolib: convert 'devprop_gpiochip_set_names' to support multiple gpiochip banks per device
The default gpiolib-of implementation does not work with the multiple gpiochip banks per device structure used for example by the gpio-mt7621 and gpio-brcmstb drivers. To fix these kind of situations driver code is forced to fill the names to avoid the gpiolib code to set names repeated along the banks. Instead of continue with that antipattern fix the gpiolib core function to get expected behaviour for every single situation adding a field 'offset' in the gpiochip structure. Doing in this way, we can assume this offset will be zero for normal driver code where only one gpiochip bank per device is used but can be set explicitly in those drivers that really need more than one gpiochip. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
parent
f3f1017a98
commit
4e804c39f1
2 changed files with 31 additions and 5 deletions
|
@ -312,6 +312,9 @@ struct gpio_irq_chip {
|
|||
* get rid of the static GPIO number space in the long run.
|
||||
* @ngpio: the number of GPIOs handled by this controller; the last GPIO
|
||||
* handled is (base + ngpio - 1).
|
||||
* @offset: when multiple gpio chips belong to the same device this
|
||||
* can be used as offset within the device so friendly names can
|
||||
* be properly assigned.
|
||||
* @names: if set, must be an array of strings to use as alternative
|
||||
* names for the GPIOs in this chip. Any entry in the array
|
||||
* may be NULL if there is no alias for the GPIO, however the
|
||||
|
@ -398,6 +401,7 @@ struct gpio_chip {
|
|||
|
||||
int base;
|
||||
u16 ngpio;
|
||||
u16 offset;
|
||||
const char *const *names;
|
||||
bool can_sleep;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue