1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/gpio/consumer.h>
3 #include <linux/gpio/driver.h>
5 #include <linux/gpio.h>
10 * **DEPRECATED** This function is deprecated and must not be used in new code.
12 void gpio_free(unsigned gpio)
14 gpiod_free(gpio_to_desc(gpio));
16 EXPORT_SYMBOL_GPL(gpio_free);
19 * gpio_request_one - request a single GPIO with initial configuration
20 * @gpio: the GPIO number
21 * @flags: GPIO configuration as specified by GPIOF_*
22 * @label: a literal description string of this GPIO
24 * **DEPRECATED** This function is deprecated and must not be used in new code.
26 int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
28 struct gpio_desc *desc;
31 /* Compatibility: assume unavailable "valid" GPIOs will appear later */
32 desc = gpio_to_desc(gpio);
36 err = gpiod_request(desc, label);
40 if (flags & GPIOF_ACTIVE_LOW)
41 set_bit(FLAG_ACTIVE_LOW, &desc->flags);
43 if (flags & GPIOF_DIR_IN)
44 err = gpiod_direction_input(desc);
46 err = gpiod_direction_output_raw(desc,
47 (flags & GPIOF_INIT_HIGH) ? 1 : 0);
58 EXPORT_SYMBOL_GPL(gpio_request_one);
61 * **DEPRECATED** This function is deprecated and must not be used in new code.
63 int gpio_request(unsigned gpio, const char *label)
65 struct gpio_desc *desc;
67 /* Compatibility: assume unavailable "valid" GPIOs will appear later */
68 desc = gpio_to_desc(gpio);
72 return gpiod_request(desc, label);
74 EXPORT_SYMBOL_GPL(gpio_request);