Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

extend documentation for gpiod_set_array() functions

Extend the documentation for the gpiod_set_array() functions and elaborate
a bit on possible use cases.

Signed-off-by: Rojhalat Ibrahim <imr@rtschenk.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Rojhalat Ibrahim and committed by
Linus Walleij
de3b6965 39521090

+20
+20
Documentation/gpio/consumer.txt
··· 259 259 corresponding chip driver. In that case a significantly improved performance 260 260 can be expected. If simultaneous setting is not possible the GPIOs will be set 261 261 sequentially. 262 + 263 + The gpiod_set_array() functions take three arguments: 264 + * array_size - the number of array elements 265 + * desc_array - an array of GPIO descriptors 266 + * value_array - an array of values to assign to the GPIOs 267 + 268 + The descriptor array can be obtained using the gpiod_get_array() function 269 + or one of its variants. If the group of descriptors returned by that function 270 + matches the desired group of GPIOs, those GPIOs can be set by simply using 271 + the struct gpio_descs returned by gpiod_get_array(): 272 + 273 + struct gpio_descs *my_gpio_descs = gpiod_get_array(...); 274 + gpiod_set_array(my_gpio_descs->ndescs, my_gpio_descs->desc, 275 + my_gpio_values); 276 + 277 + It is also possible to set a completely arbitrary array of descriptors. The 278 + descriptors may be obtained using any combination of gpiod_get() and 279 + gpiod_get_array(). Afterwards the array of descriptors has to be setup 280 + manually before it can be used with gpiod_set_array(). 281 + 262 282 Note that for optimal performance GPIOs belonging to the same chip should be 263 283 contiguous within the array of descriptors. 264 284