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_gpiod_get_from_of_node() - obtain a GPIO from an OF node
136 * @propname: name of the DT property representing the GPIO
137 * @index: index of the GPIO to obtain for the consumer
138 * @dflags: GPIO initialization flags
139 * @label: label to attach to the requested GPIO
142 * On successful request the GPIO pin is configured in accordance with
161 * For non-exclusive GPIO descriptors, check if this descriptor is in devm_gpiod_get_from_of_node()
177 return ERR_PTR(-ENOMEM); in devm_gpiod_get_from_of_node()
188 * devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node
189 * @dev: GPIO consumer
190 * @fwnode: firmware node containing GPIO reference
191 * @con_id: function within the GPIO consumer
192 * @index: index of the GPIO to obtain in the consumer
193 * @flags: GPIO initialization flags
194 * @label: label to attach to the requested GPIO
196 * GPIO descriptors returned from this function are automatically disposed on
199 * On successful request the GPIO pin is configured in accordance with
214 return ERR_PTR(-ENOMEM); in devm_fwnode_gpiod_get_index()
230 * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional()
231 * @dev: GPIO consumer
232 * @con_id: function within the GPIO consumer
233 * @index: index of the GPIO to obtain in the consumer
234 * @flags: optional GPIO initialization flags
236 * Managed gpiod_get_index_optional(). GPIO descriptors returned from this
257 * devm_gpiod_get_array - Resource-managed gpiod_get_array()
258 * @dev: GPIO consumer
259 * @con_id: function within the GPIO consumer
260 * @flags: optional GPIO initialization flags
262 * Managed gpiod_get_array(). GPIO descriptors returned from this function are
276 return ERR_PTR(-ENOMEM); in devm_gpiod_get_array()
292 * devm_gpiod_get_array_optional - Resource-managed gpiod_get_array_optional()
293 * @dev: GPIO consumer
294 * @con_id: function within the GPIO consumer
295 * @flags: optional GPIO initialization flags
297 * Managed gpiod_get_array_optional(). GPIO descriptors returned from this
317 * devm_gpiod_put - Resource-managed gpiod_put()
318 * @dev: GPIO consumer
319 * @desc: GPIO descriptor to dispose of
321 * Dispose of a GPIO descriptor obtained with devm_gpiod_get() or
322 * devm_gpiod_get_index(). Normally this function will not be called as the GPIO
333 * devm_gpiod_unhinge - Remove resource management from a gpio descriptor
334 * @dev: GPIO consumer
335 * @desc: GPIO descriptor to remove resource management from
337 * Remove resource management from a GPIO descriptor. This is needed when
338 * you want to hand over lifecycle management of a descriptor to another
351 * If the GPIO descriptor is requested as nonexclusive, we in devm_gpiod_unhinge()
353 * so it is OK if devres_destroy() returns -ENOENT. in devm_gpiod_unhinge()
355 if (ret == -ENOENT) in devm_gpiod_unhinge()
363 * devm_gpiod_put_array - Resource-managed gpiod_put_array()
364 * @dev: GPIO consumer
365 * @descs: GPIO descriptor array to dispose of
367 * Dispose of an array of GPIO descriptors obtained with devm_gpiod_get_array().
383 unsigned *gpio = res; in devm_gpio_release() local
385 gpio_free(*gpio); in devm_gpio_release()
390 unsigned *this = res, *gpio = data; in devm_gpio_match() local
392 return *this == *gpio; in devm_gpio_match()
396 * devm_gpio_request - request a GPIO for a managed device
397 * @dev: device to request the GPIO for
398 * @gpio: GPIO to allocate
399 * @label: the name of the requested GPIO
406 * If an GPIO allocated with this function needs to be freed
410 int devm_gpio_request(struct device *dev, unsigned gpio, const char *label) in devm_gpio_request() argument
417 return -ENOMEM; in devm_gpio_request()
419 rc = gpio_request(gpio, label); in devm_gpio_request()
425 *dr = gpio; in devm_gpio_request()
433 * devm_gpio_request_one - request a single GPIO with initial setup
435 * @gpio: the GPIO number
436 * @flags: GPIO configuration as specified by GPIOF_*
437 * @label: a literal description string of this GPIO
439 int devm_gpio_request_one(struct device *dev, unsigned gpio, in devm_gpio_request_one() argument
447 return -ENOMEM; in devm_gpio_request_one()
449 rc = gpio_request_one(gpio, flags, label); in devm_gpio_request_one()
455 *dr = gpio; in devm_gpio_request_one()
463 * devm_gpio_free - free a GPIO
464 * @dev: device to free GPIO for
465 * @gpio: GPIO to free
472 void devm_gpio_free(struct device *dev, unsigned int gpio) in devm_gpio_free() argument
476 &gpio)); in devm_gpio_free()
488 * devm_gpiochip_add_data_with_key() - Resource managed gpiochip_add_data_with_key()
490 * @gc: the GPIO chip to register
491 * @data: driver-private data associated with this chip
497 * The gpio chip automatically be released when the device is unbound.
500 * A negative errno if the chip can't be registered, such as because the
501 * gc->base is invalid or already associated with a different chip.
502 * Otherwise it returns zero as a success code.