gpiolib: Pass array info to get/set array functions
[linux-2.6-block.git] / Documentation / driver-api / gpio / consumer.rst
index 7e0298b9a7b90f3ab94ebfc2268aa3cd27cc4c36..0afd95a12b104a78bc29c67fded0271be5e8e81b 100644 (file)
@@ -325,28 +325,36 @@ The following functions get or set the values of an array of GPIOs::
 
        int gpiod_get_array_value(unsigned int array_size,
                                  struct gpio_desc **desc_array,
+                                 struct gpio_array *array_info,
                                  unsigned long *value_bitmap);
        int gpiod_get_raw_array_value(unsigned int array_size,
                                      struct gpio_desc **desc_array,
+                                     struct gpio_array *array_info,
                                      unsigned long *value_bitmap);
        int gpiod_get_array_value_cansleep(unsigned int array_size,
                                           struct gpio_desc **desc_array,
+                                          struct gpio_array *array_info,
                                           unsigned long *value_bitmap);
        int gpiod_get_raw_array_value_cansleep(unsigned int array_size,
                                           struct gpio_desc **desc_array,
+                                          struct gpio_array *array_info,
                                           unsigned long *value_bitmap);
 
        void gpiod_set_array_value(unsigned int array_size,
                                   struct gpio_desc **desc_array,
+                                  struct gpio_array *array_info,
                                   unsigned long *value_bitmap)
        void gpiod_set_raw_array_value(unsigned int array_size,
                                       struct gpio_desc **desc_array,
+                                      struct gpio_array *array_info,
                                       unsigned long *value_bitmap)
        void gpiod_set_array_value_cansleep(unsigned int array_size,
                                            struct gpio_desc **desc_array,
+                                           struct gpio_array *array_info,
                                            unsigned long *value_bitmap)
        void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
                                                struct gpio_desc **desc_array,
+                                               struct gpio_array *array_info,
                                                unsigned long *value_bitmap)
 
 The array can be an arbitrary set of GPIOs. The functions will try to access
@@ -358,6 +366,7 @@ accessed sequentially.
 The functions take three arguments:
        * array_size    - the number of array elements
        * desc_array    - an array of GPIO descriptors
+       * array_info    - optional information obtained from gpiod_array_get()
        * value_bitmap  - a bitmap to store the GPIOs' values (get) or
                          a bitmap of values to assign to the GPIOs (set)
 
@@ -368,12 +377,13 @@ the struct gpio_descs returned by gpiod_get_array()::
 
        struct gpio_descs *my_gpio_descs = gpiod_get_array(...);
        gpiod_set_array_value(my_gpio_descs->ndescs, my_gpio_descs->desc,
-                             my_gpio_value_bitmap);
+                             my_gpio_descs->info, my_gpio_value_bitmap);
 
 It is also possible to access 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 passed to one of the above functions.
+manually before it can be passed to one of the above functions.  In that case,
+array_info should be set to NULL.
 
 Note that for optimal performance GPIOs belonging to the same chip should be
 contiguous within the array of descriptors.