diff options
author | Lukas Wunner <lukas@wunner.de> | 2017-10-12 12:40:10 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-10-19 22:32:39 +0200 |
commit | eec1d566cdf94b57e8f5ba9fe60eea214929bcfc (patch) | |
tree | f10fab2d393d231f711123fcf66c1b01fc893370 /drivers/gpio/gpiolib.h | |
parent | 5307e2ad69ab3b0e0622fdf8b254c1d4565eb924 (diff) | |
download | linux-eec1d566cdf94b57e8f5ba9fe60eea214929bcfc.tar.gz linux-eec1d566cdf94b57e8f5ba9fe60eea214929bcfc.tar.bz2 linux-eec1d566cdf94b57e8f5ba9fe60eea214929bcfc.zip |
gpio: Introduce ->get_multiple callback
SPI-attached GPIO controllers typically read out all inputs in one go.
If callers desire the values of multipe inputs, ideally a single readout
should take place to return the desired values. However the current
driver API only offers a ->get callback but no ->get_multiple (unlike
->set_multiple, which is present). Thus, to read multiple inputs, a
full readout needs to be performed for every single value (barring
driver-internal caching), which is inefficient.
In fact, the lack of a ->get_multiple callback has been bemoaned
repeatedly by the gpio subsystem maintainer:
http://www.spinics.net/lists/linux-gpio/msg10571.html
http://www.spinics.net/lists/devicetree/msg121734.html
Introduce the missing callback. Add corresponding consumer functions
such as gpiod_get_array_value(). Amend linehandle_ioctl() to take
advantage of the newly added infrastructure. Update the documentation.
Cc: Rojhalat Ibrahim <imr@rtschenk.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.h')
-rw-r--r-- | drivers/gpio/gpiolib.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index d003ccb12781..10a48caf8477 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -180,6 +180,10 @@ static inline bool acpi_can_fallback_to_crs(struct acpi_device *adev, #endif 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, + struct gpio_desc **desc_array, + int *value_array); void gpiod_set_array_value_complex(bool raw, bool can_sleep, unsigned int array_size, struct gpio_desc **desc_array, |