diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/gpio/consumer.txt | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/Documentation/gpio/consumer.txt b/Documentation/gpio/consumer.txt index d85fbae451ea..2924f2ffcd91 100644 --- a/Documentation/gpio/consumer.txt +++ b/Documentation/gpio/consumer.txt | |||
@@ -58,7 +58,6 @@ pattern where a GPIO is optional, the gpiod_get_optional() and | |||
58 | gpiod_get_index_optional() functions can be used. These functions return NULL | 58 | gpiod_get_index_optional() functions can be used. These functions return NULL |
59 | instead of -ENOENT if no GPIO has been assigned to the requested function: | 59 | instead of -ENOENT if no GPIO has been assigned to the requested function: |
60 | 60 | ||
61 | |||
62 | struct gpio_desc *gpiod_get_optional(struct device *dev, | 61 | struct gpio_desc *gpiod_get_optional(struct device *dev, |
63 | const char *con_id, | 62 | const char *con_id, |
64 | enum gpiod_flags flags) | 63 | enum gpiod_flags flags) |
@@ -68,6 +67,27 @@ instead of -ENOENT if no GPIO has been assigned to the requested function: | |||
68 | unsigned int index, | 67 | unsigned int index, |
69 | enum gpiod_flags flags) | 68 | enum gpiod_flags flags) |
70 | 69 | ||
70 | For a function using multiple GPIOs all of those can be obtained with one call: | ||
71 | |||
72 | struct gpio_descs *gpiod_get_array(struct device *dev, | ||
73 | const char *con_id, | ||
74 | enum gpiod_flags flags) | ||
75 | |||
76 | This function returns a struct gpio_descs which contains an array of | ||
77 | descriptors: | ||
78 | |||
79 | struct gpio_descs { | ||
80 | unsigned int ndescs; | ||
81 | struct gpio_desc *desc[]; | ||
82 | } | ||
83 | |||
84 | The following function returns NULL instead of -ENOENT if no GPIOs have been | ||
85 | assigned to the requested function: | ||
86 | |||
87 | struct gpio_descs *gpiod_get_array_optional(struct device *dev, | ||
88 | const char *con_id, | ||
89 | enum gpiod_flags flags) | ||
90 | |||
71 | Device-managed variants of these functions are also defined: | 91 | Device-managed variants of these functions are also defined: |
72 | 92 | ||
73 | struct gpio_desc *devm_gpiod_get(struct device *dev, const char *con_id, | 93 | struct gpio_desc *devm_gpiod_get(struct device *dev, const char *con_id, |
@@ -91,8 +111,15 @@ A GPIO descriptor can be disposed of using the gpiod_put() function: | |||
91 | 111 | ||
92 | void gpiod_put(struct gpio_desc *desc) | 112 | void gpiod_put(struct gpio_desc *desc) |
93 | 113 | ||
94 | It is strictly forbidden to use a descriptor after calling this function. The | 114 | For an array of GPIOs this function can be used: |
95 | device-managed variant is, unsurprisingly: | 115 | |
116 | void gpiod_put_array(struct gpio_descs *descs) | ||
117 | |||
118 | It is strictly forbidden to use a descriptor after calling these functions. | ||
119 | It is also not allowed to individually release descriptors (using gpiod_put()) | ||
120 | from an array acquired with gpiod_get_array(). | ||
121 | |||
122 | The device-managed variant is, unsurprisingly: | ||
96 | 123 | ||
97 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) | 124 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) |
98 | 125 | ||