Merge tag 'gpio-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[sfrench/cifs-2.6.git] / include / linux / gpio / consumer.h
index 33695a1d8b35bf32b2eb3566513b3a16236fc151..f2f887795d43e9ae2cbe8b15be896547dbebbb43 100644 (file)
@@ -17,11 +17,20 @@ struct device;
  */
 struct gpio_desc;
 
+/**
+ * Opaque descriptor for a structure of GPIO array attributes.  This structure
+ * is attached to struct gpiod_descs obtained from gpiod_get_array() and can be
+ * passed back to get/set array functions in order to activate fast processing
+ * path if applicable.
+ */
+struct gpio_array;
+
 /**
  * Struct containing an array of descriptors that can be obtained using
  * gpiod_get_array().
  */
 struct gpio_descs {
+       struct gpio_array *info;
        unsigned int ndescs;
        struct gpio_desc *desc[];
 };
@@ -105,36 +114,46 @@ int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
 /* Value get/set from non-sleeping context */
 int gpiod_get_value(const struct gpio_desc *desc);
 int gpiod_get_array_value(unsigned int array_size,
-                         struct gpio_desc **desc_array, int *value_array);
+                         struct gpio_desc **desc_array,
+                         struct gpio_array *array_info,
+                         unsigned long *value_bitmap);
 void gpiod_set_value(struct gpio_desc *desc, int value);
-void gpiod_set_array_value(unsigned int array_size,
-                          struct gpio_desc **desc_array, int *value_array);
+int gpiod_set_array_value(unsigned int array_size,
+                         struct gpio_desc **desc_array,
+                         struct gpio_array *array_info,
+                         unsigned long *value_bitmap);
 int gpiod_get_raw_value(const struct gpio_desc *desc);
 int gpiod_get_raw_array_value(unsigned int array_size,
                              struct gpio_desc **desc_array,
-                             int *value_array);
+                             struct gpio_array *array_info,
+                             unsigned long *value_bitmap);
 void gpiod_set_raw_value(struct gpio_desc *desc, int value);
 int gpiod_set_raw_array_value(unsigned int array_size,
-                              struct gpio_desc **desc_array,
-                              int *value_array);
+                             struct gpio_desc **desc_array,
+                             struct gpio_array *array_info,
+                             unsigned long *value_bitmap);
 
 /* Value get/set from sleeping context */
 int gpiod_get_value_cansleep(const struct gpio_desc *desc);
 int gpiod_get_array_value_cansleep(unsigned int array_size,
                                   struct gpio_desc **desc_array,
-                                  int *value_array);
+                                  struct gpio_array *array_info,
+                                  unsigned long *value_bitmap);
 void gpiod_set_value_cansleep(struct gpio_desc *desc, int value);
-void gpiod_set_array_value_cansleep(unsigned int array_size,
-                                   struct gpio_desc **desc_array,
-                                   int *value_array);
+int gpiod_set_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_value_cansleep(const struct gpio_desc *desc);
 int gpiod_get_raw_array_value_cansleep(unsigned int array_size,
                                       struct gpio_desc **desc_array,
-                                      int *value_array);
+                                      struct gpio_array *array_info,
+                                      unsigned long *value_bitmap);
 void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value);
 int gpiod_set_raw_array_value_cansleep(unsigned int array_size,
-                                       struct gpio_desc **desc_array,
-                                       int *value_array);
+                                      struct gpio_desc **desc_array,
+                                      struct gpio_array *array_info,
+                                      unsigned long *value_bitmap);
 
 int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
 int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);
@@ -331,7 +350,8 @@ static inline int gpiod_get_value(const struct gpio_desc *desc)
 }
 static inline int gpiod_get_array_value(unsigned int array_size,
                                        struct gpio_desc **desc_array,
-                                       int *value_array)
+                                       struct gpio_array *array_info,
+                                       unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
@@ -342,12 +362,14 @@ static inline void gpiod_set_value(struct gpio_desc *desc, int value)
        /* GPIO can never have been requested */
        WARN_ON(1);
 }
-static inline void gpiod_set_array_value(unsigned int array_size,
-                                        struct gpio_desc **desc_array,
-                                        int *value_array)
+static inline int gpiod_set_array_value(unsigned int array_size,
+                                       struct gpio_desc **desc_array,
+                                       struct gpio_array *array_info,
+                                       unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
+       return 0;
 }
 static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
 {
@@ -357,7 +379,8 @@ static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
 }
 static inline int gpiod_get_raw_array_value(unsigned int array_size,
                                            struct gpio_desc **desc_array,
-                                           int *value_array)
+                                           struct gpio_array *array_info,
+                                           unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
@@ -369,8 +392,9 @@ static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
        WARN_ON(1);
 }
 static inline int gpiod_set_raw_array_value(unsigned int array_size,
-                                            struct gpio_desc **desc_array,
-                                            int *value_array)
+                                           struct gpio_desc **desc_array,
+                                           struct gpio_array *array_info,
+                                           unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
@@ -385,7 +409,8 @@ static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
 }
 static inline int gpiod_get_array_value_cansleep(unsigned int array_size,
                                     struct gpio_desc **desc_array,
-                                    int *value_array)
+                                    struct gpio_array *array_info,
+                                    unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
@@ -396,12 +421,14 @@ static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
        /* GPIO can never have been requested */
        WARN_ON(1);
 }
-static inline void gpiod_set_array_value_cansleep(unsigned int array_size,
+static inline int gpiod_set_array_value_cansleep(unsigned int array_size,
                                            struct gpio_desc **desc_array,
-                                           int *value_array)
+                                           struct gpio_array *array_info,
+                                           unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
+       return 0;
 }
 static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
 {
@@ -411,7 +438,8 @@ static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
 }
 static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size,
                                               struct gpio_desc **desc_array,
-                                              int *value_array)
+                                              struct gpio_array *array_info,
+                                              unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
@@ -425,7 +453,8 @@ static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
 }
 static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size,
                                                struct gpio_desc **desc_array,
-                                               int *value_array)
+                                               struct gpio_array *array_info,
+                                               unsigned long *value_bitmap)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);