extend documentation for gpiod_set_array() functions
diff mbox

Message ID 1462335.iZUEobXSUA@pcimr
State New
Headers show

Commit Message

Rojhalat Ibrahim March 5, 2015, 1:36 p.m. UTC
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>
---
 Documentation/gpio/consumer.txt | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Linus Walleij March 9, 2015, 4:39 p.m. UTC | #1
On Thu, Mar 5, 2015 at 2:36 PM, Rojhalat Ibrahim <imr@rtschenk.de> wrote:

> 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>

Patch applied. Thanks!

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/Documentation/gpio/consumer.txt b/Documentation/gpio/consumer.txt
index d29a972..c21c131 100644
--- a/Documentation/gpio/consumer.txt
+++ b/Documentation/gpio/consumer.txt
@@ -259,6 +259,26 @@  GPIOs belonging to the same bank or chip simultaneously if supported by the
 corresponding chip driver. In that case a significantly improved performance
 can be expected. If simultaneous setting is not possible the GPIOs will be set
 sequentially.
+
+The gpiod_set_array() functions take three arguments:
+	* array_size	- the number of array elements
+	* desc_array	- an array of GPIO descriptors
+	* value_array	- an array of values to assign to the GPIOs
+
+The descriptor array can be obtained using the gpiod_get_array() function
+or one of its variants. If the group of descriptors returned by that function
+matches the desired group of GPIOs, those GPIOs can be set by simply using
+the struct gpio_descs returned by gpiod_get_array():
+
+	struct gpio_descs *my_gpio_descs = gpiod_get_array(...);
+	gpiod_set_array(my_gpio_descs->ndescs, my_gpio_descs->desc,
+			my_gpio_values);
+
+It is also possible to set a completely arbitrary array of descriptors. The
+descriptors may be obtained using any combination of gpiod_get() and
+gpiod_get_array(). Afterwards the array of descriptors has to be setup
+manually before it can be used with gpiod_set_array().
+
 Note that for optimal performance GPIOs belonging to the same chip should be
 contiguous within the array of descriptors.