diff options
author | Janusz Krzysztofik <jmkrzyszt@gmail.com> | 2018-09-05 23:50:06 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-09-13 11:16:12 +0200 |
commit | bf9346f5d47b4506aafbc384dfb5796b0adc3f8d (patch) | |
tree | 36059c2536ba006875029d5edbe9615d98dc3180 /drivers/gpio/gpiolib.h | |
parent | b9762bebc6332b40c33e03dea03e30fa12d9e3ed (diff) | |
download | linux-stable-bf9346f5d47b4506aafbc384dfb5796b0adc3f8d.tar.gz linux-stable-bf9346f5d47b4506aafbc384dfb5796b0adc3f8d.tar.bz2 linux-stable-bf9346f5d47b4506aafbc384dfb5796b0adc3f8d.zip |
gpiolib: Identify arrays matching GPIO hardware
Certain GPIO array lookup results may map directly to GPIO pins of a
single GPIO chip in hardware order. If that condition is recognized
and handled efficiently, significant performance gain of get/set array
functions may be possible.
While processing a request for an array of GPIO descriptors, identify
those which represent corresponding pins of a single GPIO chip. Skip
over pins which require open source or open drain special processing.
Moreover, identify pins which require inversion. Pass a pointer to
that information with the array to the caller so it can benefit from
enhanced performance as soon as get/set array functions can accept and
make efficient use of it.
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.h')
-rw-r--r-- | drivers/gpio/gpiolib.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 11e83d2eef89..b60905d558b1 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -183,6 +183,15 @@ static inline bool acpi_can_fallback_to_crs(struct acpi_device *adev, } #endif +struct gpio_array { + struct gpio_desc **desc; + unsigned int size; + struct gpio_chip *chip; + unsigned long *get_mask; + unsigned long *set_mask; + unsigned long invert_mask[]; +}; + struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip, u16 hwnum); int gpiod_get_array_value_complex(bool raw, bool can_sleep, unsigned int array_size, |