Lines Matching +full:a +full:- +full:gpio

1 /* SPDX-License-Identifier: GPL-2.0 */
3 * devres.c - managed gpio resources
11 #include <linux/gpio.h>
12 #include <linux/gpio/consumer.h>
27 struct gpio_desc **this = res, **gpio = data; in devm_gpiod_match() local
29 return *this == *gpio; in devm_gpiod_match()
47 * devm_gpiod_get - Resource-managed gpiod_get()
48 * @dev: GPIO consumer
49 * @con_id: function within the GPIO consumer
50 * @flags: optional GPIO initialization flags
52 * Managed gpiod_get(). GPIO descriptors returned from this function are
65 * devm_gpiod_get_optional - Resource-managed gpiod_get_optional()
66 * @dev: GPIO consumer
67 * @con_id: function within the GPIO consumer
68 * @flags: optional GPIO initialization flags
70 * Managed gpiod_get_optional(). GPIO descriptors returned from this function
83 * devm_gpiod_get_index - Resource-managed gpiod_get_index()
84 * @dev: GPIO consumer
85 * @con_id: function within the GPIO consumer
86 * @idx: index of the GPIO to obtain in the consumer
87 * @flags: optional GPIO initialization flags
89 * Managed gpiod_get_index(). GPIO descriptors returned from this function are
106 * For non-exclusive GPIO descriptors, check if this descriptor is in devm_gpiod_get_index()
122 return ERR_PTR(-ENOMEM); in devm_gpiod_get_index()
133 * devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node
134 * @dev: GPIO consumer
135 * @fwnode: firmware node containing GPIO reference
136 * @con_id: function within the GPIO consumer
137 * @index: index of the GPIO to obtain in the consumer
138 * @flags: GPIO initialization flags
139 * @label: label to attach to the requested GPIO
141 * GPIO descriptors returned from this function are automatically disposed on
144 * On successful request the GPIO pin is configured in accordance with
159 return ERR_PTR(-ENOMEM); in devm_fwnode_gpiod_get_index()
175 * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional()
176 * @dev: GPIO consumer
177 * @con_id: function within the GPIO consumer
178 * @index: index of the GPIO to obtain in the consumer
179 * @flags: optional GPIO initialization flags
181 * Managed gpiod_get_index_optional(). GPIO descriptors returned from this
202 * devm_gpiod_get_array - Resource-managed gpiod_get_array()
203 * @dev: GPIO consumer
204 * @con_id: function within the GPIO consumer
205 * @flags: optional GPIO initialization flags
207 * Managed gpiod_get_array(). GPIO descriptors returned from this function are
221 return ERR_PTR(-ENOMEM); in devm_gpiod_get_array()
237 * devm_gpiod_get_array_optional - Resource-managed gpiod_get_array_optional()
238 * @dev: GPIO consumer
239 * @con_id: function within the GPIO consumer
240 * @flags: optional GPIO initialization flags
242 * Managed gpiod_get_array_optional(). GPIO descriptors returned from this
262 * devm_gpiod_put - Resource-managed gpiod_put()
263 * @dev: GPIO consumer
264 * @desc: GPIO descriptor to dispose of
266 * Dispose of a GPIO descriptor obtained with devm_gpiod_get() or
267 * devm_gpiod_get_index(). Normally this function will not be called as the GPIO
278 * devm_gpiod_unhinge - Remove resource management from a gpio descriptor
279 * @dev: GPIO consumer
280 * @desc: GPIO descriptor to remove resource management from
282 * Remove resource management from a GPIO descriptor. This is needed when
283 * you want to hand over lifecycle management of a descriptor to another
296 * If the GPIO descriptor is requested as nonexclusive, we in devm_gpiod_unhinge()
298 * so it is OK if devres_destroy() returns -ENOENT. in devm_gpiod_unhinge()
300 if (ret == -ENOENT) in devm_gpiod_unhinge()
308 * devm_gpiod_put_array - Resource-managed gpiod_put_array()
309 * @dev: GPIO consumer
310 * @descs: GPIO descriptor array to dispose of
312 * Dispose of an array of GPIO descriptors obtained with devm_gpiod_get_array().
325 unsigned *gpio = res; in devm_gpio_release() local
327 gpio_free(*gpio); in devm_gpio_release()
331 * devm_gpio_request - request a GPIO for a managed device
332 * @dev: device to request the GPIO for
333 * @gpio: GPIO to allocate
334 * @label: the name of the requested GPIO
341 int devm_gpio_request(struct device *dev, unsigned gpio, const char *label) in devm_gpio_request() argument
348 return -ENOMEM; in devm_gpio_request()
350 rc = gpio_request(gpio, label); in devm_gpio_request()
356 *dr = gpio; in devm_gpio_request()
364 * devm_gpio_request_one - request a single GPIO with initial setup
366 * @gpio: the GPIO number
367 * @flags: GPIO configuration as specified by GPIOF_*
368 * @label: a literal description string of this GPIO
370 int devm_gpio_request_one(struct device *dev, unsigned gpio, in devm_gpio_request_one() argument
378 return -ENOMEM; in devm_gpio_request_one()
380 rc = gpio_request_one(gpio, flags, label); in devm_gpio_request_one()
386 *dr = gpio; in devm_gpio_request_one()
401 * devm_gpiochip_add_data_with_key() - Resource managed gpiochip_add_data_with_key()
403 * @gc: the GPIO chip to register
404 * @data: driver-private data associated with this chip
410 * The gpio chip automatically be released when the device is unbound.
413 * A negative errno if the chip can't be registered, such as because the
414 * gc->base is invalid or already associated with a different chip.
415 * Otherwise it returns zero as a success code.